Difference between revisions of "Avahi Zeroconf"

From Official Kodi Wiki
Jump to navigation Jump to search
(→‎NFS service (/etc/avahi/services/nfs.service): The default NFS port is 2049, not 2149. I'm pretty sure that this is meant here.)
m (Bot: Automated text replacement (- XBMC + Kodi ))
Line 2: Line 2:
== General ==
== General ==
=== What is Avahi (Zeroconf) ===
=== What is Avahi (Zeroconf) ===
<section begin="intro"/>Avahi is a system which facilitates service discovery on a local network via the mDNS/DNS-SD protocol suite. This enables XBMC 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.<section end="intro"/>
<section begin="intro"/>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.<section end="intro"/>


For more details have a look at [http://www.avahi.org avahi.org].
For more details have a look at [http://www.avahi.org avahi.org].
Line 9: Line 9:
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".
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 XBMC ==
== Services supported by Kodi ==


XBMC can receive service announcements for the following protocols. [[Windows File Sharing (SMB/SAMBA/CIFS)|samba]], [[Media Source FTP|FTP]], [[HTS Tvheadend|HTSP]], [[WebDAV]], [[NFS]] and [[SFTP]] (ssh server).
XBMC can receive service announcements for the following protocols. [[Windows File Sharing (SMB/SAMBA/CIFS)|samba]], [[Media Source FTP|FTP]], [[HTS Tvheadend|HTSP]], [[WebDAV]], [[NFS]] and [[SFTP]] (ssh server).
Line 17: Line 17:
== Static service announcement ==
== Static service announcement ==
=== What about it? ===
=== 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 XBMC zeroconf browser supports txt-records. This means that it can parse some of the official DNS-SD keys (see [http://www.dns-sd.org/ServiceTypes.html ServiceTypes] under "Defined TXT keys"). XBMC 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.
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 [http://www.dns-sd.org/ServiceTypes.html 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 Avahi daemon has to run on the same server which hosts the services which should be announced.'''
Line 26: Line 26:


==== NFS service (/etc/avahi/services/nfs.service) ====
==== 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''. XBMC 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 - XBMC 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/'''
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/'''




Line 41: Line 41:


==== WEBDAV service (/etc/avahi/services/webdav.service) ====
==== 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''. XBMC 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 - XBMC 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/'''.
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'?>
   <?xml version="1.0" standalone='no'?>
Line 55: Line 55:


==== SFTP service (/etc/avahi/services/sftp.service) ====
==== 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''. XBMC 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 - XBMC would show the available path on that service with ''/path/to/be/accessed''. Clicking on that one would generate the following url: '''sftp://sshuser:[email protected]<ip of server>:22/path/to/be/accessed/'''.
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:[email protected]<ip of server>:22/path/to/be/accessed/'''.


   <?xml version="1.0" standalone='no'?>
   <?xml version="1.0" standalone='no'?>
Line 71: Line 71:


==== FTP service (/etc/avahi/services/ftp.service) ====
==== 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''. XBMC 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 - XBMC would show the available path on that service with ''/ftppath''. Clicking on that one would generate the following url: '''ftp:/ftpuser:[email protected]<ip of server>:21/ftppath/'''.
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:[email protected]<ip of server>:21/ftppath/'''.


   <?xml version="1.0" standalone='no'?>
   <?xml version="1.0" standalone='no'?>
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). XBMC 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 - XBMC would show the available shares on that samba server.
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.


   <?xml version="1.0" standalone='no'?>
   <?xml version="1.0" standalone='no'?>

Revision as of 08:26, 4 May 2015

1 General

1.1 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.

1.2 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".

2 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.

3 Static service announcement

3.1 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.

3.2 Sample service configurations

3.2.1 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>

3.2.2 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>

3.2.3 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:[email protected]<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>

3.2.4 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:[email protected]<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>

3.2.5 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.

 <?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>139</port>  
   </service>
 </service-group>