Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a Windows machine called abcd for example and it uses DHCP to receive an IP address (172.28.45.5 for example)

When I perform ping -a 172.28.45.5 sometimes I receive abcd as the hostname. Sometimes I receive the FQDN, for example abcd.xxx.yyy.com, which is the preferred and accurate way.

Why do I receive the hostname sometimes, and the FQDN other times? Is this a sign of DNS being corrupt in some way?

share|improve this question
    
Is the zone your host is in a Active Directory hosted zone? –  Wesley Dec 11 '13 at 5:52
    
Also, will you get the same sketchy results if you use nslookup 172.28.45.5 multiple times? How many DNS servers are in your environment? –  Wesley Dec 11 '13 at 6:01

1 Answer 1

up vote 3 down vote accepted

ping is not a name resolution tool. It's an ICMP tool that has some DNS wonkery tacked on. When using ping as a name resolution troubleshooting tool on a Windows machine you're going to be batted around between responses from NetBIOS, potentially WINS, the hosts file, resolver cache, and (if you're lucky) a DNS server. Your mileage may vary, contents may settle during shipping, product sold by weight not volume, and photo enlarged to show texture.

The preferable method, and indeed the authoritative troubleshooting method for DNS resolution on Windows, would be to use nslookup to perform reverse lookups. For example, nslookup 172.28.45.5. You can explicitly set the server that you're querying against, and also scope your return record types down to only PTR records.

If you use nslookup to perform reverse queries from the same server and you get mixed responses, then something is wrong with DNS in a bad way. If for some reason you really, really want ping -a to be consistent, then you'll want to flush your resolver cache (ipconfog /flushdns), disable NetBIOS entirely (feels good, man), make sure nothing is in your hosts file, and then engage in somber prayer before each ping -a because I still wouldn't trust it 100%.

nslookup is good and wants to be your friend.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.