The Avahi System facilitates service discovery on local networks using the Multicast DNS/DNS-SD protocol suite.
The current implementation of Avahi (v0.8) does not yet support aliases (i.e., CNAME records). Avahi-alias, in its many variations, fills this gap.
This variation of avahi-alias provides:
- Python 3 compatibility,
- Avahi v0.8 compatibility,
- Systemd compatibility, and
- Full install and remove capability.
For proper installation and execution of this variation of avahi-alias, the following are required:
-
Python 3. Python 3 is now the defacto version distributed with nearly all Linux distributions.
-
Avahi v0.8. Avahi v0.8, released Feb 18, 2020, includes Python 3 bindings. Its availability varies across Linux distributions. In particular, many long-term support releases (e.g., Ubuntu 20.04 LTS) still include Avahi v0.7. (Although in the case of Ubuntu 20.04 LTS, it appears the Avahi v0.8 packages available for Debian Bulleye can replace the v0.7 packages transparently. This has not been well tested!)
-
Systemd. The install and uninstall make targets work with Systemd. A rudimentary init system script is also include.
From the avahi-alias directory, run make install
. This will install the scripts to
/usr/local/bin
, setup systemd services, and start the service. Installation and removal
options include:
make install
performs full installation (and reinstallation).make install-binaries
creates the/etc/avahi/aliases
files and installes the scripts to/usr/local/bin
.make install-unit
installs and starts the systemd service.make remove
performs a full removal.make remove-binaries
removes the scripts from/usr/local/bin
.make remove-unit
stops and removes the systemd service.
Note: The install and remove make targets assume the current user has sudo rights and
executes most steps using sudo
.
Aliases are stored in /etc/avahi/aliases
. Add and remove aliases by editing
/etc/avahi/aliases
directly. Althernatively, use the avahi-add-alias
and
avahi-remove-alias
scripts. Examples:
sudo avahi-add-alias alias1.local
addsalias1.local
to/etc/avahi/aliases
.sudo avahi-remove-alias alias1.local
removesalias1.local
from/etc/avahi/aliases
.
- Original Python 2 sources (This is now offline. Archive.org has an archived copy.)
- Discussion on Stack Overflow.
- Original repo on GitHub.
- Original systemd repo on GitHub.
- Service implementation gist.