4

I'm trying to get dns resolution of Avahi .local domains.

I can do:

$ avahi-resolve-host-name redacted.local
Redacted.local  10.xx.xx.xx

but not

ping redacted.local
ping: redacted.local: Name or service not known
muru
  • 197,895
  • 55
  • 485
  • 740

2 Answers2

0

It appears that your machine is not configured to actually use Avahi to do (or assist) it's DNS lookups. Try adding the following to the /etc/resolvconf/resolv.conf.d/base file:

nameserver 127.0.0.1

The IP address might be different in your case, make sure that it points to the server running Avahi. Then reload your resolve configuration by running:

sudo resolvconf -u

The system should now (also) check your Avahi server to resolve redacted.local into an IP address.

Oldskool
  • 161
  • 10
  • I'm running out of the box ubuntu 16.10. I don't know what my nameserver is – Thomas Grainger Oct 28 '16 at 21:28
  • If you installed Avahi on the same machine from which you're trying to resolve the domain name, 127.0.0.1 should work. – Oldskool Oct 29 '16 at 09:37
  • As I said, I didn't install Avahi. It's supposed to be pre-installed and pre-configured. – Thomas Grainger Oct 31 '16 at 09:44
  • Where did you say that? You just said your using "out of the box ubuntu 16.10". And no, it's not supposed to be pre-installed and pre-configured on a new install. Somewhere, someone installed Avahi, but apparently did not take the time to configure it in such a way that the server uses Avahi's DNS zones for lookups. But try the steps I mentioned in my answer, it should get your lookups working. – Oldskool Oct 31 '16 at 16:10
  • avahi-resolve-host-name is definitely pre-installed – Thomas Grainger Nov 01 '16 at 10:08
  • Wheter or not it is is besides the point, Did you make the changes to the resolv.conf base file and how did that work out? – Oldskool Nov 01 '16 at 14:15
  • I already have mdns4_minimal in my /etc/nsswitch.conf this should be enough – Thomas Grainger Nov 02 '16 at 09:47
0

I ran into the same problem. Looks like a known issue with libnss-resolve/systemd-resolved and /etc/nsswitch.conf. Check out this other answer on Ask Ubuntu:

Some other reading with alternate options for /etc/nsswitch.conf:

nitrogen
  • 226
  • Thanks for contributing :) A couple of general points... If your answer is essentially a referral to another post on Ask Ubuntu, consider flagging the question as a duplicate instead. If you are posting links, please include the key information here. Answers should be complete in themselves as far as possible. – Zanna Dec 15 '16 at 12:54