1

Supposing I have a server on a network that has a private IP address, and somewhere on a another network is a client that has the same private IP address. It is possible beaucase they are on different networks? Now if the client performs a DNS lookup to find the server IP address it will get the private IP address of the server, or the address of the network the server belongs to? Normally it should receive the address of the network, but then how it can know which is the station in that network corresponding to the server?

2 Answers 2

2

The most used private network is 192.168.0.0 (/24). 192.168.0.1 is probably the most used IP address, so a lot of different hosts have the same IP adress.

DNS returns host IP addresses and no network IP adresses, so you will always get the IP adress of a host and not of a network.

To know what the network to an IP adress is, you have to know the subnet mask. 192.168.0.33 with subnet mask 255.255.255.0 says that 192.168.0.0 is the network (address). (But mostly you don't know the subnet mask of remote networks / hosts and you don't need to know it.)

Assume a workstation PC01 with 192.168.0.33 subnet 255.255.255.0 is asking a DNS for the hostname AnyRemoteServer and the DNS returns the IP address 192.168.0.200. So PC01 will assume that AnyRemoteServer is in its own network and try to reach it there. Even when AnyRemoteServer is in a remote netzwork, there won't be tried to route the packets to the remote network.

When AnyRemoteServer (which belongs to a remote network) has the IP address 192.168.0.200 which also fits to the network of PC01, then PC01 will try to reach in its network the host AnyRemoteServer. When in the network of PC01 does also exist a host with 192.168.0.200 (lets call it MyServer), PC01 will connect MyServer, thinking it talks to AnyRemoteServer. On the other side, if there is no machine with that IP then PC01 will run in a time out (depends on the protocoll PC01 is using).

8
  • What happens if AnyRemoteServer is in a remote network, but PC01 will try to reach it in PC01 network (it assumes that AnyRemoteServer is in its own network)? The connection cannot be established?
    – SebiSebi
    Dec 6, 2014 at 11:12
  • @SebiSebi When AnyRemoteServer has the IP address 192.168.0.200 that is in the network of PC01 then PC01 will try to reach the PC with this IP address. Maybe there is MyServer with 192.168.0.200 attached to the network of PC01 then PC01 will connect this server, thinking it talks to AnyRemoteServer. If there is no machine with that IP then PC01 will run in a time out (depends on the protocoll PC01 is using). Dec 6, 2014 at 11:26
  • OK. That is the problem. How can I connect to that server which has an private IP address of 192.168.0.200, but is in another network? The problem is that the two networks (the one of my PC and the server one) have the same address 192.168.0.0.
    – SebiSebi
    Dec 6, 2014 at 11:53
  • @SebiSebi I suspect that the networks are connected in any way (else you will need magic to solve that). You can use a cheap hardware router (like Linksys WRT54GL) and use natting (NAT) to solve that. It's to broad to explain it here. You will find examples on the internet for that. If you need assistance you may ask a new question here. Good luck!! Dec 6, 2014 at 12:16
  • OK. Let's start from the beginning. Supposing I have two local networks, each of that have a router and a switch. The first network is 192.168.1.0/24 with the default gateway 192.168.0.1 and the second one is also 192.168.1.0/24 with the gateway 192.168.0.1 . This is possible since we talk about private IP addresses. Now the first network contains two PC's: PC1 with address 192.168.0.2 and PC2 with address 192.168.0.3. Moreover, the second network has PC3 with address 192.168.4.2 and a server whose IP address is 192.168.0.5. OK. I'll continue the post in another comm since I've run out of char
    – SebiSebi
    Dec 6, 2014 at 12:40
0

it should receive the address of the network, how it can know which is the station in that network corresponding to the server

That is the job of the public facing router of the network. This is usually done by Network Address Translation with Port Forwarding.

How to Set Up Port Forwarding on a Router explains how to do this.

Port forwarding opens certain ports on your home or small business network, usually blocked from access by your router, to the Internet. Opening specific ports can allow games, servers, BitTorrent clients, and other applications to work through the usual security of your router that otherwise does not permit connections to these ports.

For more information see http://portforward.com/ one of the best references for all things to do with port forwarding ...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .