IP address used by nslookup and ping is different

18,315

Solution 1

You've configured the client to lookup against your internal DNS for its primary, and an external DNS server as a secondary? You have a race condition; if the internal DNS happens to be too slow to respond, then the client gets an unusable response from the public DNS server. ping is using the cached response from the lookup against the external DNS server, while nslookup sends a fresh request that gets a valid response from your internal DNS server.

Having inconsistent views of DNS between your primary and secondary servers is bound to cause problems like this. Instead, either stand up a second internal DNS server and use it as secondary, or configure the client with no secondary DNS server at all.

Solution 2

This problem is caused by your using RFC1918 private addresses inside your internal network. As a result, you have to access the server using one address while on one side of the network and a different address on the other.

The short-term solution to this is to implement split-horizon DNS. This provides you consistent DNS entries within the network and without.

The long-term solution to this is to implement IPv6, in which you will have the same address for the server regardless of whether you're internal or external.

Share:
18,315

Related videos on Youtube

ht2
Author by

ht2

Updated on September 18, 2022

Comments

  • ht2
    ht2 over 1 year

    I have a web server hosted in the network. It has a domain name registered. However, I also host a DNS server for the LAN. So, when someone wants to access the web server, it would check the DNS server and use the internal address 192.168.x.x. The web server's public address is 203.x.x.x.

    When my computer is working fine, I would ping or try nslookup www.mydomain.com. Both points to 192.168.x.x which is internal address. Sometimes, I or someone could not access www.mydomain.com. When I check, nslookup returns the internal address. But when I ping, it would try to connect using the public address like this.

    Pinging www.mydomain.com [203.x.x.x] with 32 bytes of data:
    

    If that happens, repairing the connection mostly help. Sometimes, the workstation (Win XP) has to be restarted. In DNS settings of the workstations, primary DNS points to the DNS Sserver and secondary DNS points to ISP DNS server.

    What I want to know is the cause of this problem and prevention from it? Or a better fix than my current ones. Thanks

  • ht2
    ht2 almost 12 years
    Thank you. I have limited budget to have another DNS server. My current DNS server is running on Windows. For the secondary one, could I host it on bind using Ubuntu (or any free Linux distribution)? Is there a guide for doing so?
  • ht2
    ht2 almost 12 years
    Thanks for the help. IPv6 would be a nice standard once I am able to use it.
  • ravi yarlagadda
    ravi yarlagadda almost 12 years
    @h82 You could set up a second DNS server on BIND as a slave, yes, but it's probably simpler and easier for you to set up your DNS replica as a second Windows system, especially if DNS is active directory integrated. If you're set on going down this path, googling for "ubuntu bind slave" turns up some good options, just keep in mind that the steps those guides have for configuring the master to allow zone transfers to the slave will need to be translated to the equivalents for your Windows system.