Avahi Zeroconf: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 11: Line 11:
== Services supported by Kodi ==
== Services supported by Kodi ==


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


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.
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.
Line 87: Line 87:


==== SAMBA service - pre 3.3.x (/etc/avahi/services/smb.service) ====
==== 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 <name of server>''. The "%h" gets substituted by the hostname of the server. When clicking this entry - Kodi would show the available shares on that samba server.
The following configuration would announce a SAMBA server (on default port 445). Kodi Zeroconf browser would show this entry as ''SAMBA on <name of server>''. 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'?>
   <?xml version="1.0" standalone='no'?>
Line 95: Line 95:
     <service>
     <service>
       <type>_smb._tcp</type>
       <type>_smb._tcp</type>
       <port>139</port>   
       <port>445</port>   
     </service>
     </service>
   </service-group>
   </service-group>

Revision as of 23:03, 18 August 2020

General

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

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

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.

Static service announcement

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.

Sample service configurations

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 <name of server>. 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://<ip of server>:2049/path/to/nfsexport/


 <?xml version="1.0" standalone='no'?>
 <!DOCTYPE service-group SYSTEM "avahi-service.dtd">
 <service-group>
   <name replace-wildcards="yes">NFS server at %h</name>  
   <service>
     <type>_nfs._tcp</type>
     <port>2049</port>
     <txt-record>path=/path/to/nfsexport</txt-record>
   </service>
 </service-group>

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 <name of server>. 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://<ip of server>:80/webdav/path/.

 <?xml version="1.0" standalone='no'?>
 <!DOCTYPE service-group SYSTEM "avahi-service.dtd">
 <service-group>
   <name replace-wildcards="yes">WebDav on %h</name>  
   <service>
     <type>_webdav._tcp</type>
     <port>80</port>
     <txt-record>path=/webdav/path</txt-record> 
   </service>
 </service-group>

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 <name of server>. 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@<ip of server>:22/path/to/be/accessed/.

 <?xml version="1.0" standalone='no'?>
 <!DOCTYPE service-group SYSTEM "avahi-service.dtd">
 <service-group>
   <name replace-wildcards="yes">SFTP on %h</name>
   <service>
     <type>_sftp-ssh._tcp</type>
     <port>22</port>
     <txt-record>path=/path/to/be/accessed</txt-record>
     <txt-record>u=sshuser</txt-record>
     <txt-record>p=sshpass</txt-record>  
   </service>
 </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 <name of server>. 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@<ip of server>:21/ftppath/.

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

SAMBA service - pre 3.3.x (/etc/avahi/services/smb.service)

The following configuration would announce a SAMBA server (on default port 445). Kodi Zeroconf browser would show this entry as SAMBA on <name of server>. 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">
 <service-group>
   <name replace-wildcards="yes">SAMBA on %h</name>
   <service>
     <type>_smb._tcp</type>
     <port>445</port>  
   </service>
 </service-group>