Saturday, December 04, 2010

DNS domain resolution works with nslookup but not ping command

A fine conundrum indeed to be able to resolve Internet addresses with the nslookup command, yet ping fails to do the same. Pinging IP addresses works just fine, though.

It turns out this happens if the following two files get corrupted: dnsapi.dll and dnsrslvr.dll.

It's a simple task to replace these with good copies if you happen to have a Ubuntu LiveUSB and appropriate Windows setup CD on hand. Just boot into the LiveUSB, pop in the Windows CD, make sure the hard disk partition containing Windows is mounted, and do the following:

~$ sudo apt-get install cabextract
~$ rm /media/hdd/Windows/system32/dnsapi.dll
~$ rm /media/hdd/Windows/system32/dnsrslvr.dll
~$ cabextract -d /media/hdd/Windows/system32 /media/cdrom0/i386/dnsapi.dl_
~$ cabextract -d /media/hdd/Windows/system32 /media/cdrom0/i386/dnsrslvr.dl_

Be sure to replace /media/hdd with the appropriate mount point on your system.

Alternatively, you can boot into Windows Recovery Console to restore the files:

:\> expand d:\i386\dnsapi.dl_ c:\windows\system32\dnsapi.dll
:\> expand d:\i386\dnsrslvr.dl_ c:\windows\system32\dnsrslvr.dll

Here, I'm assuming drive D: is your CD-ROM drive but it could be different depending on your specific system.

Reboot into Windows, and DNS domain name resolution should be back to normal.