IP address used by nslookup and ping is different

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.