5

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?

Wesley
  • 32,690
  • 9
  • 82
  • 117
Blue Tongue
  • 107
  • 2
  • 3
  • 8
  • Is the zone your host is in a Active Directory hosted zone? – Wesley Dec 11 '13 at 05: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 06:01

1 Answers1

8

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 (ipconfig /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.

Wesley
  • 32,690
  • 9
  • 82
  • 117