Avahi Logo

The Avahi project, helmed by Trent Lloyd, is a Bonjour compatible mDNS/DNS-SD service discovery server for Linux systems. Bonjour is a protocol that Apple uses on their devices (i.e. laptops, phones, Apple TVs, etc) to multicast a DNS record and available services on a local area network (LAN). This avoids a need for a local DNS server to be necessary for simple home networks.

If you have avahi installed on a Linux server, you can pull up a list of available services with the avahi-browse command.

$ avahi-browse -art

By default, an Apple device would use its <hostname>.local address, and would list what services are available for that host. Avahi does this as well out of the box, but we can take it a step further. Using the avahi-aliases pip package, you can broadcast multiple other .local domains for the same machine.

$ apt-get install python-avahi
$ pip install git+git://github.com/airtonix/avahi-aliases.git
$ vim /etc/avahi/aliases.d/default

Just add the other domain names you want to respond to on the network in the /etc/avahi/aliases.d/default file. Finally, stop/start the avahi-aliases python script and you'll be able to ping the new domain names on the network.

$ python /usr/local/bin/avahi-alias stop
$ python /usr/local/bin/avahi-alias start

If you want to see if the script is active use the ps -aux command.

$ ps -aux | grep avahi

If you are having trouble resolving *.local hostnames from an Apple computer, you can always try resetting the DNS cache. You could also simply toggle your WIFI to force a reset.