What IP Address is DNS Service Returning?

dnsipnetworking

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?

Best Answer

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).

Related Question