nslookup finds ip for a hostname in .local domain, but ping does not
I believe this is caused by mdns - multicast dns, for autoconfiguration of the .local domain.
If you check in /etc/nsswitch.conf
, you will probably see:
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
mdns4 is what is doing multicast dns. Try changing this to:
hosts: files dns
And see if it makes any difference. If it makes it work, you can remove mdns permanently with:
Try apt-get remove libnss-mdns
Which will do the nsswitch.conf
change for you as well.
Alternatively, don't use .local - use .lan or something instead.
Just to complete things:
nslookup just asks the given DNS server for the assigned A-record, it does NOT guarantee, that the device behind that record actually HAS that IP.
Even when the device has the correct IP (ex.: fixed IP of the device matches the one provided by DNS) - it doesn't guarantee the device is configured to respond to pings. This is a common point of frustration. (Im talking about you, windows firewall)
When you're crossing subnets, the router / gateway / firewall may restrict ICMP traffic (that's what a ping is) as well.
So you always need to check the full service chain from sender to recipient and vice versa. In case three, there may be settings like a) default gateway or b) (default) routes involved. So add them to your checklist.
Sorry for digging up this old one, but given from the header it seemed like a bit of information, someone could profit from.
Greetz.
Another thing that I have seen interfere with DNS is installing winbind. It seems to put a wins
entry before [NOTFOUND=return]
in /etc/nsswitch.conf
, which causes DNS to fail, but can be fixed by moving wins
to after the "NOTFOUND" part, also, preferably after dns so that dns lookup happens first, see this:
http://ubuntuforums.org/showthread.php?t=1496488
(not sure why this happens by default though; comments welcome!)