# nslookup works but hostname lookup failure on ping



## ziyanm (Nov 18, 2012)

I have bind 9.8 on FreeBSD 9.1-RC running as a recursive resolver and authoratative primary for a private subnet. Windows users on our LAN complain periodically that they're unable to access our local servers. On investigation it turned out to be a name resolution failure.

The funny thing is that doing an nslookup on the windows clients for say http://www.xxx.ac.lk works fine. However, if I try to ping http://www.xxx.ac.lk or access it in the browser I get a hostname lookup failure (Accessing http://www.xxx.ac.lk by its IP works just fine.)

So why is the name lookup failing in ping and the in the browser, while nslookup of the name works just fine?


----------



## mamalos (Nov 19, 2012)

I've witnessed many times Windows machines being able to nslookup but unable to open a web page when they had been infected by a virus, but I don't remember them not being able to ping.

If you want to be sure of what's going on, run tcpdump(1) on your FreeBSD machine and wireshark on your windows host when this happens.


----------



## kpa (Nov 19, 2012)

This problem is usually cured by running this on command line, may require admin priviledges on vista and newer:

`# ipconfig /flushdns`

Another option is to turn off the DNS cache (not sure about the exact name) service completely.


----------



## SirDice (Nov 19, 2012)

You may also want to check C:\Windows\system32\drivers\etc\hosts.. It's the same kind of hosts file as /etc/hosts on unix.


----------



## nakal (Nov 19, 2012)

You can get similar issues when IPv6 is enabled in your BIND configuration (or resolv.conf), but your hosts are not configured properly for IPv6. In this case some of the recursive queries go to some IPv6 and get never answered or host lookups are sent to nowhere.


----------



## freethread (Nov 19, 2012)

kpa said:
			
		

> This problem is usually cured by running this on command line, may require admin priviledges on vista and newer:
> 
> `# ipconfig /flushdns`
> 
> Another option is to turn off the DNS cache (not sure about the exact name) service completely.



This is what I usually do, the service is 'Client DNS', disabling it there will be no needs to run ipconfig command above, the DNS service must be reliable at start-up.

*P.S.*
I also install the ISC BIND tools (host and dig commands) (in Windows).


----------



## ziyanm (Nov 21, 2012)

Thank you everyone, for all the suggestions. I'll have to wait till the next time someone has this problem to try them out.


----------

