NST Avahi (mDNS) FAQ

From NST Wiki
Jump to: navigation, search

Avahi/mDNS General

What Services Need to Be Running?

The avahi-daemon.service needs to be running. You can check its status via:

 systemctl status avahi-daemon.service

You can start it via:

 sudo systemctl start avahi-daemon.service

You can enable it so it is started at boot time via:

 sudo systemctl enable avahi-daemon.service

How Do I Resolve Using Avahi (mDNS)?

You can use the avahi-resolve command to verify that a host name resolves to an IPv4 or IPv6 address.

[root@nst-test ~]# avahi-resolve -4 -n nst-test.local
[root@nst-test ~]# avahi-resolve -6 -n nst-test.local
nst-test.local	2600:1700:1850:e820:56a0:f48:d01f:86bd
[root@nst-test ~]# 

How Do I Add Avahi Resolving to nsswitch.conf?

You need to have the following packages installed:

 sudo dnf install avahi-daemon nss-mdns

You need to have the avahi-daemon service running:

 sudo systemctl start avahi-daemon.service
 sudo systemctl enable avahi-daemon.service

In order for normal commands (like ping, ssh, etc) to resolve Avahi host names, you need to have the following configuration line in your /etc/nsswitch.conf file:

hosts:      files mdns4_minimal [NOTFOUND=return] dns myhostname

This line is typically added automatically when you add the nss-mdns package.

What Happens If My Router Resolves .local Domains?

I have run into AT&T WIFI access points that resolve .local domains under the normal DNS protocol. This breaks normal Avahi lookups and was driving me crazy for several weeks. I finally came across an answer to this issue at Red Hat Bugzilla – Bug 1690078. Basically on an NST system, you need to:

  • Change the /etc/nsswitch.conf file to use the mdns4 library instead of the mdns4_minimal library:
# Work around to dang AT&T Access Point resolving .local domains
hosts:      files mdns4 [NOTFOUND=return] dns myhostname
  • Create a /etc/mdns.allow file with the following entries:
# Work around to dang AT&T Access Point resolving .local domains

How Do I Scan My Network For Avahi Service?

The easy was is to use the NST Web Interface. From the menu bar, select Security -> Active Scanners -> NST Avahi (mDNS) Discovery. This will generate a table of available services and hosts with active links that allow further inspection.

Alternatively, you can run the following from the command line:

sudo avahi-browse --all