I learned to write a client and server application and how to connect them. The server host has to forward a port in the router to be able to a establish a connection.
Is it possible to connect two devices in the same network without port forwarding/triggering?
The server host has to forward a port in the router to be able to establish a connection.
You have this back to front. The router has to forward a port to the server host in order for clients outside the router to be able to form connections.
Clients inside the router, i.e. in the same subnet as the server host, can connect directly.
Yes as long as the devices are in the same network, no port forwarding is required.
Whenever a server is inside a NAT and you try to access it from outside, you have to configure port forwarding in your router.
Example:
You create a server running on port 8080 with IP 192.168.1.12
Suppose your router's public IP is 10.2.2.5
So you need to enable port forwarding in your router for port 8080 to 192.168.1.12:8080
Then you can access that server from outside with 10.2.2.5:8080
Related
I’ve set up a Mariadb server on my raspberry pi and I can access it over 192.x.x.x but I can’t access it over my public IP address, I know I need to port forward can anyone tell me how to do this exactly, I use talk talk wifi.
You need to create a port forward as you mention.
external IP:port > Internal IP:port
x.x.x.x:3306 > 192.x.x.x:3306
The default port of MySql is 3306.
Okay so I have a tcp running on port 1302. I've port forwarded the servers IP on my router. But how would the client and server send messages to each other... Wouldn't the client have to port forward too. If so, is there any way around this?
I assume you have a server in local network (i.e. without global IP-address) and you set port-forwarding on your router to have clients sending message to your app which is running on the server on port 1302, right? If so, clients don't need to set their port-forwarding cause it is done automatically by their local provider network. It is typical: server (listener of income messages) without global IP needs port-forwarding but client (who is first to send message) doesn't need port-forwarding.
Working in VMWare vCloud.
Webserver has internal ip 172.16.0.61, public ip 148.25.6.22 (invented numbers);
App Server has internal ip 172.16.0.52
From App Server I can ping and surf Webserver using its internal 172.16.0.61, but... how can I reach it (from App Server) using its public 148.25.6.22?
Just searching for something that let me say to the App Server
148.25.6.22 => 172.16.0.61
If I had a domain name I could resolv it in /etc/hosts, but at the moment I have just ip.
Thanks in advance
If I understand you correctly, your servers are behind a NAT, which masquerades their IP addresses (which is why your webserver has both an internal and an external IP address - the external one is actually the NAT's public address).
You can define a local route on your appserver, which will direct packets sent to 148.25.6.22 to 172.16.0.61, however that defeats the purpose, as that would cause the appserver to just send everything to the internal address.
What you should do is configure port forwarding on your NAT - this means that the NAT will listen on a port you specify, and all communication which reaches this port will be forwarded to the webserver's internal IP to another port you specify, for example: 148.25.6.22:8080 => 172.16.0.61:8080. Now, if your appserver connects to 148.25.6.22:8080, the packets will reach the webserver at port 8080.
Im new to networking,If I have a window server and in that server I have a normal soho router, will that server assign the ip address to each device? or will that router do it. What I've learned is that the server is suppose to be the DHCP but sometimes if you plug a router directly in the server it kicks the server off and the router starts to assign the ip address. If that is so, how would you fix that?
Most routers will take on the role of a DHCP Server out-of-the-box. That is, they will distribute ip addresses to whatever DHCP Client requests an address.
By default, a Windows server will not have set up a fully configured DHCP Server.
By default a Windows machine (either client or server) and most other networked devices will have set their network interface to be a DHCP Client.
Therefore, by simply plugging in your Windows server to one of your router's LAN ports will make the router set the Windows server's network interface to the next available ip address using DHCP.
If you were to connect more devices to the router's LAN ports it will still be the router that assigns those extra devices an ip address.
Ideally you want only one DHCP server in your network.
Also, if you want your Windows server to always have the same ip address you can do two things:
Log in to the router and set a fixed ip address for your Windows server network card's unique MAC address.
Modify the router's DHCP range (e.g. from .10 to .200) so it leaves some addresses free (e.g. .1 to .9 and from .201 to .254). Then set your Windows server network card's fixed IPV4 address to a fixed address (e.g. .210). You may also need to set a DNS server then.
This is only briefly skimming the subject of IPV4 networks, DHCP and friends so when you have some time try to read the wikipedia pages for them.
http://en.wikipedia.org/wiki/IPv4
http://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol
Server assigns your public IP address, in fact it assigns your router a public IP address.
While the router assigns each device connected a local IP address.
With respect to your router, the IP address server assigns it is its IPv4 address and the addresses router assigns to its clients are IPv6 address.
When you browse the internet through your router, the router reads your requests and responds according to that IPv6 address and when the router requests something to the server, server sees it as its IPv4 address. :)
I am learning how to create an ubuntu server to use to host a database and run a script as a thread to do some things for my graduation project...
I installed ubuntu server with lamp environment and managed to connect it to an ethernet local network that connects to the internet .. my design looks like this
except the router is also connected to a dsl modem and to the internet...
I can easily connect to the server from the local network but how can I connect to it from outside this private network ?
I know the router public ip address and the server private ip address
You need port forwarding. mean, in your router settings you define that incoming requests to specific port/protocol will redirects to specific ip (of the ubuntu).
See https://en.wikipedia.org/wiki/Port_forwarding
You will need to set up port forwarding on the router such that the router's external port 80 is forwarded to the server's private port 80.
What router is it? Its guide should detail how to set up port forwarding