If you have ever encountered the situation where name-based resolution fails, yet a check against dig or nslookup succeeds for the same hostname, you may be experiencing a conflict with Multicast DNS (mDNS) name resolution.
On February 20, 2013, IETF published and approved RFC 6762 which reserves .local as a fake TLD for hostnames that are to be resolved via mDNS—not to be confused with traditional unicast DNS! If the local area network (LAN) has been configured with a domain name ending in .local, then all LAN hostname resolutions will be passed to mDNS first—bypassing unicast DNS altogether!
However, dig and nslookup are unicast DNS utilities, so they will both bypass the system hostname resolution order and query unicast DNS directly.
How do I fix it?
Changing the local domain name to use a TLD other than .local would be one way to fix the problem. For Unixes, one could also change the hosts: line of /etc/nsswitch.conf so that unicast DNS resolution preceeds mDNS resolution.
hosts: files dns mdns4_minimal mdns4
hosts: files mdns4_minimal mdns4 dns
On an editorial note, the Microsofties have been using .local for internal network examples for over a decade. Of all the things one could have chosen as a pseudo-TLD to single-out for non-standard functionality, .local was an extremely inconsiderate choice. Of course, the RFC comes from Apple, so it figures.