Ping unable to resolve but nslookup works fine – workaround

Sometimes if you make changes to your local DNS server windows do not works ok to resolve this DNS record in a local network.

What?

nslookup ykylo
Server: 
Address: 192.168.50.1
Name: ykylo
Address: 192.168.50.100

C:\> ping ykylo
Ping request could not find host wolfman. Please check the name and try again.

C:\> ping 192.168.50.100
Pinging 192.168.50.100 with 32 bytes of data:

Reply from 192.168.50.100: bytes=32 time=41ms TTL=126
Reply from 192.168.50.100: bytes=32 time=41ms TTL=126
Reply from 192.168.50.100: bytes=32 time=44ms TTL=126
Reply from 192.168.50.100: bytes=32 time=38ms TTL=126

Why?

On Windows (even recent versions such as Windows 10), the first step can easily fail. For the sake of backward compatibility, Windows supports various methods of hostname resolution (hosts file, DNS, NetBIOS/WINS, LMHOST file).

Unfortunately, it seems that Windows’ ping command doesn’t always attempt a DNS lookup. I don’t know the specific conditions that trigger this behavior.

Fortunately, we can force Windows to do a DNS lookup by using an FQDN (fully qualified domain name). In practice, we do this by suffixing a . dot to the hostname: ykylo.. Try ping ykylo.and verify that it works.

Workaround 0!

Try adding . to the DNS suffixes for that connection. I.e, go to:

  1. Ethernet Status
  2. Click Properties
  3. Internet Protocol Version 4
  4. Click Properties
  5. Click Advanced
  6. Append these DNS suffices (in order)
  7. Add . as a suffix

Workaround 1!

Some commands that will reinitialize various network states :

Reset WINSOCK entries to installation defaults : netsh winsock reset catalog
Reset TCP/IP stack to installation defaults : netsh int ip reset reset.log
Flush DNS resolver cache : ipconfig /flushdns
Renew DNS client registration and refresh DHCP leases : ipconfig /registerdns
Flush routing table : route /f (reboot required)