Avahi is and mDNS/DNS daemon, service which implements Apples’s Zeroconf mechanism. Zeroconf is als known Rendezvous or Bonjour. Zeroconf have there main task to process.
- Automatic assignment of numeric network addresses
- Automatic distribution and resolution of host names,
- Automatic location of network services such as printing devices.
Avahi-daemon can be install with yum and apt like below.
$ sudo apt install avahi-daemon/yakkety
After installing avahi as we know avahi works as daemon generally. We will start the avahi daemon. Using init scripts following command can be issued. Keep in mind that avahi requires root privileges as we can see from following screenshot it asks for root password.
$ /etc/init.d/avahi-daemon start
Another way to start avahi daemon is using
systemctl command like below. with the avahi service name avahi-daemon . The avahi service current status can be seen too
$ sudo systemctl start avahi-daemon
Stopping avahi in init system can be done with the following command. Stopping avahi service requires root privileges too.
$ /etc/init.d/avahi-daemon stop
$ sudo systemctl stop avahi-daemon
Enable Avahi Daemon
Avahi daemon can be enabled to start automatically in the system start with the systemctl command like below.
$ sudo systemctl enable avahi-daemon
Disable Avahi Daemon
Avahi daemon can be disabled to start automatically in the system start with the following command.
$ sudo systemctl disable avahi-daemon
Avahi configuration files resides in
/etc/avahi . Avahi daemon configuration file is named
avahi-daemon.conf . There are different type of configuration abilities with this file.
Avahi served host names and ip addresses are stored in
hosts file. Services are stored in
services directory as xml file.
Adding host to the DNS service of avahi is like adding host Linux hosts file. Add following line into the
host file like in the screenshot and than restart avahi daemon.
Adding services is harder than adding hosts. There is an xml configuration file used to describe services and this file will be put into
/etc/avahi/services/ directory. Following service configuration file defines ftp file which is served from tcp 21 port.
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<name>FTP file sharing</name>