apt install avahi-utils avahi-daemon
The service starts automatically.
Services are configured by placing .service
files under /etc/avahi/services
. The following service files publish their respective services. Additional service types are defined in DNS SRV (RFC 2782).
File: /etc/avahi/services/ssh.service
<?xml version="1.0" standalone="no"?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_ssh._tcp</type>
<port>22</port>
</service>
</service-group>
File: /etc/avahi/services/sftp.service
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_sftp-ssh._tcp</type>
<port>22</port>
</service>
</service-group>
While Avahi will pick up the new configurations automatically, it's a good idea to restart the daemon to reset the state.
service avahi-daemon restart
Now the service should show up when browsing.
avahi-browse -a
To resolve local Zeroconf hostnames, e.g. foobar.local
, add mdns_minimal [NOTFOUND=return]
to the hosts
configuration line of /etc/nsswitch.conf
.
# /etc/nsswitch.conf
hosts: files mdns_minimal [NOTFOUND=return] dns
https://wiki.debian.org/ZeroConf https://wiki.archlinux.org/index.php/Avahi