Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I own a D-Link DIR-600. You can see part of its configuration here:

D-Link configuration screenshot

As you can see, I set two fixed hostnames, "wilson", and "sheldon". However, if I try to access them by name, no matter from which of my computers in my LAN, no matter whether Ubuntu/Windows, this doesn't work:

$ nslookup wilson

** server can't find wilson: NXDOMAIN

$ nslookup wilson.local

** server can't find wilson.local: NXDOMAIN

$ nslookup

Non-authoritative answer:

Is there a way to get these hostnames, besides adding them to /etc/hosts?

share|improve this question
up vote 4 down vote accepted

Using Linux on both matchines, try getent hosts wilson.local, or simply ping wilson.local. This assumes you already have avahi-daemon and nss-mdns installed, which is usually the case.

Specific DNS tools like nslookup and dig don't automatically support .local over MDNS (multicast DNS). They bypass the standard C library for name resolution, and don't integrate with avahi-daemon themselves.

I have also tried setting "search local" in /etc/resolv.conf / asking NetworkManager to use "local" as a local domain. I.e. allowing ping wilson without the .local. But it looks like nss-mdns doesn't implement it.

I don't have instructions for Windows. The simplest way might be to use Bonjour from Apple.

That's the Apple-derived system that Linux adopted. There's also a Windows-based alternative. Linux can integrate into it using the "winbind" daemon from samba. I don't have instructions for that either :).

I don't think my Netgear DG834 returns local DNS names either. Interestingly, I think they could if they wanted to. My router and others uses dnsmasq, and the default dnsmasq configuration already returns local DNS names. I've tested this myself - I run dnsmasq on a Linux server, and disable/ignore my router's DHCP/DNS services.

share|improve this answer
ping, ssh, with or without .local, all this don't work. For the time being, I added the hostnames to /etc/hosts. They have fixed IPs anyway. Thanks for the info about your Netgear device. Where does the default dnsmasq get all the hostnames of the LAN from? – Torsten Bronger Jan 21 '13 at 12:43
The hostnames are provided in their DHCP requests. – sourcejedi Jan 21 '13 at 14:32
Update: hostnames can be provided in DHCP requests, but may not be. A recent version of Windows does it. Recent NetworkManager does it (Ubuntu, debian unstable, but seemingly NOT debian 6.0). It's not done on non-NetworkManager setups on debian 6.0 either (I haven't tested others). – sourcejedi Jan 30 '13 at 11:56
Thank you for the explanation. Actually, I was just confused because I thought the router got the local names from the computers. But obviously, it is the other way round. Be that as it may, both my D-Link and your Netgear don't return the hostnames in DNS lookups, and this is the problem. – Torsten Bronger Jan 30 '13 at 13:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .