Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

Ubuntu uses 'avahi' to perform host name lookups on the local network, which allows me to find other computers just by adding '.local' to the name, e.g. laptop.local or desktop.local.

However, avahi does not seem to perform reverse lookups for the IP addresses of computers on the local network. So when applications look up IP addresses for local computers, a request goes out to an Internet DNS server on the Internet which returns NXDOMAIN (name does not exist).

Is it possible for avahi to perform reverse lookups for IP addresses? If it is, how do I do it?

share|improve this question
Reverse lookups of local IP-addresses return the appropriate *.local hostname here. What tools are you using to do reverse lookups? – JanC Feb 2 '11 at 3:31
Thanks, JanC. You were right! I have learned that how you check this can make all the difference. – user8979 Feb 13 '11 at 10:07
up vote 4 down vote accepted

Yes, avahi supports reverse IP address lookups for the .local names that are registered on the local network. However, most of the commands for performing test queries contact DNS servers directly without using avahi. In order to confirm that this is working at the command line, you have to use the getent hosts command instead of nslookup, dig, or host.

For example, you can look up an IP address using the following commands:

$ nslookup
$ dig -x
$ host
$ getent hosts

Only the getent hosts command will return the corresponding name because it is the only command that uses avahi to perform the reverse lookup.

(Actually, this also applies to looking up names, but it is usually simpler to just type ping hostname.local which performs a name lookup using DNS or avahi and checks connectivity at the same time.)

share|improve this answer

dig also could perform reverse DNS lookup using avahi:

dig -x @ -p 5353

share|improve this answer
That's fantastic, vagran. I didn't realise dig could perform multicast DNS queries. I investigated and found that you can also do this using nslookup: nslookup -port=5353 -querytype=PTR However, I also found that if ufw (which allows multicast by default) is running, only getent hosts works. Aargh! If I figure this out, I'll update my answer. – user8979 Feb 20 '11 at 22:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.