Avahi Zeroconf

What is Avahi (Zeroconf)
Avahi is a system which facilitates service discovery on a local network via the mDNS/DNS-SD protocol suite. This enables Kodi to recognize media sources inside your local network without knowing where the sources are located and what protocol is used. Compatible technology is found in Apple MacOS X (branded Bonjour and sometimes Zeroconf). Avahi is available for linux and derivates (BSD) afaik.

For more details have a look at avahi.org.

Installing
Since the Installation of Avahi depends on the used operating system please realise that this page only covers the configuration of static service announcements (for services which don't have avahi support included). For installation instructions just use a www search engine with the keywords "install avahi on <enter operting system here".

Services supported by Kodi
XBMC can receive service announcements for the following protocols. samba, FTP, HTSP, WebDAV, NFS and SFTP (ssh server).

The most HTSP, samba (minimum version 3.3.x), WEBDAV and iTunes (DAAP) servers are supposed to have support for zeroconf built in. This means that these services should be announcent automatically when avahi is installed. No static service announcement configuration should be needed then.

What about it?
For services which don't support zeroconf registration there is an easy possibility to make avahi announce them. For each service which should be announced there has to be a configuration file. Normally these files should reside in /etc/avahi/services and end with the file extension ".service". The Kodi zeroconf browser supports txt-records. This means that it can parse some of the official DNS-SD keys (see ServiceTypes under "Defined TXT keys"). Kodi parses the "path","u"(username) and "p"(password) keys. This allows to specify a complete service including the path and account information for accessing it.

The Avahi daemon has to run on the same server which hosts the services which should be announced.

The section below has some sample configurations which would allow static announcements for the supported protocols. For general information according to the config files see the official man page.

NFS service (/etc/avahi/services/nfs.service)
The following configuration would announce a NFS server (with the nfs default port 2049) with the exported path /path/to/nfsexport. Kodi Zeroconf browser would show this entry as NFS server at . The "%h" gets substituted by the hostname of the server. When clicking this entry - Kodi would show the available path on that service with /path/to/nfsexport. Clicking on that one would generate the following url: nfs:// :2049/path/to/nfsexport/

 <!DOCTYPE service-group SYSTEM "avahi-service.dtd">  NFS server at %h _nfs._tcp 2049      path=/path/to/nfsexport 

WEBDAV service (/etc/avahi/services/webdav.service)
The following configuration would announce a WebDAV server (e.x. apache at port 80) with the accessible path /webdav/path. Kodi Zeroconf browser would show this entry as WebDav on . The "%h" gets substituted by the hostname of the server. When clicking this entry - Kodi would show the available path on that service with /webdav/path. Clicking on that one would generate the following url: dav:// :80/webdav/path/.

 <!DOCTYPE service-group SYSTEM "avahi-service.dtd">  WebDav on %h _webdav._tcp 80      path=/webdav/path 

SFTP service (/etc/avahi/services/sftp.service)
The following configuration would announce a sftp/ssh server (on default port 22) with the accessible path /path/to/be/accessed, the user sshuser and the password sshpass. Kodi Zeroconf browser would show this entry as SFTP on . The "%h" gets substituted by the hostname of the server. When clicking this entry - Kodi would show the available path on that service with /path/to/be/accessed. Clicking on that one would generate the following url: sftp://sshuser:sshpass@ :22/path/to/be/accessed/.

 <!DOCTYPE service-group SYSTEM "avahi-service.dtd">  SFTP on %h _sftp-ssh._tcp 22      path=/path/to/be/accessed</txt-record> u=sshuser</txt-record> p=sshpass</txt-record> </service-group>

FTP service (/etc/avahi/services/ftp.service)
The following configuration would announce a FTP server (on default port 21) with the accessible path /ftppath, the user ftpuser and the password ftppass. Kodi Zeroconf browser would show this entry as FTP on . The "%h" gets substituted by the hostname of the server. When clicking this entry - Kodi would show the available path on that service with /ftppath. Clicking on that one would generate the following url: ftp:/ftpuser:ftppass@ :21/ftppath/.

<?xml version="1.0" standalone='no'?> <!DOCTYPE service-group SYSTEM "avahi-service.dtd">  <name replace-wildcards="yes">FTP on %h _ftp._tcp 21      path=/ftppath</txt-record> u=ftpuser</txt-record> p=ftppass</txt-record> </service-group>

SAMBA service - pre 3.3.x (/etc/avahi/services/smb.service)
The following configuration would announce a SAMBA server (on default port 139). Kodi Zeroconf browser would show this entry as SAMBA on . The "%h" gets substituted by the hostname of the server. When clicking this entry - Kodi would show the available shares on that samba server.

<?xml version="1.0" standalone='no'?> <!DOCTYPE service-group SYSTEM "avahi-service.dtd">  <name replace-wildcards="yes">SAMBA on %h _smb._tcp 139   </service-group>