You've come to this page because you've asked a question similar to the following:
When I pass a domain name to ping it ends up communicating with one particular IP address/reporting a non-existent domain. Why, therefore, when I look up that domain name with nslookup (or dnsip, host, khost, or dig) do I see something entirely different to that?
This is the Frequently Given Answer to that question.
ping is not a tool for diagnosing DNS problems. It is a tool for diagnosing IP connectivity problems. If you are trying to use it for the former task, stop.
Moreover, nslookup is a bad tool and there are better DNS diagnostic tools. Stop using it. Nonetheless, you will still see this discrepancy with other DNS diagnosis tools.
The reason that nslookup can operate differently to ping when it comes to converting domain names to IP addresses is that ping uses the system-supplied library, as used by other applications, for name-to-address mapping whereas nslookup has its own, built in, DNS client library. The system-supplied library consults sources other than one's configured proxy DNS servers, when performing name-to-address mappings. The DNS client library built in to nslookup consults only the DNS. (The same is true for other DNS lookup tools such as dnsip or host from the djbwares package.) If, therefore, those other sources contain relevant information, the results obtained by using the system-supplied lookup facilities, and thus the operation of ping, will be different to the results obtained via nslookup (and the other DNS lookup tools).
For examples:
On Windows, the system-supplied lookup routines also consult WINS and a HOSTS file, if one has one. If any information is available from either source about the name being looked up, ping will use that information whereas nslookup will not.
On Unices and on Linux-based operating systems, if information is available via NIS or in /etc/hosts, ping will use that information whereas nslookup and the other tools will not. (On many Unices and on Linux-based operating systems, this behaviour is controllable via /etc/nsswitch.conf and one can tell the system-supplied lookup facilities to consult only the DNS if one wishes to.)
On Windows, on Unices, and on Linux-based operating systems, the system-supplied lookup routines mechanisms may involve local caching (nscd on Unices and on Linux-based operating systems, the caching in the DNS Client service on Windows), whereas nslookup and the other tools will not. (The difference is often most noticable when it comes to negative answers to lookups.)
Incidentally: The version of nslookup supplied with HP/UX by the vendor has been altered to use these extraneous sources of information in addition to the DNS. However, this makes it unsuitable for use in DNS problem diagnosis.