Archlinux MDNS

Once all the necessary configuration for ArchLinux ARM is up and running, it’s time to access it over the network. Since I’m on an DHCP network, its best if I can access the Pi without needing to know the IP in advance. This is where mDNS comes in useful.

mDNS in short allows you to resolve the name of your machine without needing a nameserver or extra domain. Just by appending .local to a computer name, you will be able to see the machine on your network. On Raspbian, this is up and running by default but on ArchLinux, you need to do some work to get it working. Below are the steps to get it working.

  1. Install avahi and nss-mdns

    pacman -Syu avahi nss-mdns
  2. Edit /etc/nsswitchnsswitch.conf to allow resolution of mDNs hosts. This is for the ArchLinux host to resolve other .local domains which I use quite regularly so I set it up as well. Make sure the hosts line looks like the following

    hosts: files mymachines mdns4_minimal [NOTFOUND=return] mdns4  myhostname resolve [!UNAVAIL=return] dns
  3. Save and quit this file.

  4. Now we want to start Avahi however DBus needs to be informed about the changes otherwise Avahi will fail.

    systemctl restart dbus
  5. Finally we start and enable avahi

    systemctl start avahi-daemon
    systemctl enable avahi-daemon

Enjoy! :-D