Unable to resolve .local domains with getent even though avahi-resolve-host-name succeeds

1.4k views Asked by At

Trying to set up a network printer with CUPS.

Followed online documentation that stated:

To discover or share printers using DNS-SD/mDNS, setup .local hostname resolution with Avahi and restart cups.service.

Followed directions for setting up Avahi to the point where avahi-browse --all --ignore-local --resolve --terminate and avahi-resolve-host-name my-domain.local are both working.

But getent hosts my-domain.local fails to resolve. This results in CUPS failing to print because it can't find my-printer.local.

1

There are 1 answers

0
Eric Ihli On BEST ANSWER

I read the mdns Github page and saw a note that made me think I didn't need a /etc/mdns.allow file.

nss-mdns has a simple configuration file /etc/mdns.allow for enabling name lookups via mDNS in other domains than .local.

Note: The "minimal" version of nss-mdns does not read /etc/mdns.allow under any circumstances. It behaves as if the file does not exist.

In the recommended configuration, no /etc/mdns.allow file is present.

But then I saw the last note in that section:

If, during a request, the system-configured unicast DNS (specified in /etc/resolv.conf) reports an SOA record for the top-level local name, the request is rejected. Example: host -t SOA local returns something other than Host local not found: 3(NXDOMAIN). This is the unicast SOA heuristic.

I tested that out on my machine and sure enough, I was getting something OTHER than Host local not found....

Adding a /etc/mdns.allow file with a line for .local. and for .local and now I can ping my-printer.local.