https://wiki.archlinux.org/api.php?action=feedcontributions&user=Qxu21&feedformat=atomArchWiki - User contributions [en]2024-03-28T19:40:39ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Avahi&diff=569148Avahi2019-03-19T20:13:35Z<p>Qxu21: Undo revision 569146 by Qxu21 (talk) - python-gobject is already mentioned</p>
<hr />
<div>[[Category:Multicast DNS]]<br />
[[fr:Avahi]]<br />
[[ja:Avahi]]<br />
From [[Wikipedia:Avahi (software)]]:<br />
:[http://avahi.org/ Avahi] is a free [[Wikipedia:Zero-configuration networking|Zero-configuration networking]] (zeroconf) implementation, including a system for multicast DNS/DNS-SD service discovery. It allows programs to publish and discover services and hosts running on a local network with no specific configuration. For example you can plug into a network and instantly find printers to print to, files to look at and people to talk to. It is licensed under the GNU Lesser General Public License (LGPL).<br />
<br />
== Installation ==<br />
<br />
[[Install]] the {{Pkg|avahi}} package.<br />
<br />
You can manage the Avahi daemon with {{ic|avahi-daemon.service}} [[systemd#Using units|using systemd]].<br />
<br />
{{Note|[[systemd-resolved]] has a built-in multicast DNS service, make sure to disable systemd-resolved's mDNS resolver and responder or [[disable]] {{ic|systemd-resolved.service}} entirely before using Avahi. For details, refer to {{man|5|resolved.conf}}.}}<br />
<br />
== Using Avahi ==<br />
<br />
=== Hostname resolution ===<br />
<br />
Avahi provides local hostname resolution using a "''hostname''.local" naming scheme. To enable it, install the {{Pkg|nss-mdns}} package and [[start]] {{ic|avahi-daemon.service}}.<br />
<br />
Then, edit the file {{ic|/etc/nsswitch.conf}} and change the {{ic|hosts}} line to include {{ic|1=mdns_minimal [NOTFOUND=return]}} before {{ic|resolve}} and {{ic|dns}}:<br />
<br />
hosts: ... '''mdns_minimal [NOTFOUND=return]''' resolve [!UNAVAIL=return] dns ...<br />
<br />
{{Note|If you experience slowdowns in resolving {{ic|.local}} hosts try to use {{ic|mdns4_minimal}} instead of {{ic|mdns_minimal}}.}}<br />
<br />
==== Configuring mDNS for custom TLD ====<br />
<br />
The {{ic|mdns_minimal}} module handles queries for the {{ic|.local}} TLD only. Note the {{ic|<nowiki>[NOTFOUND=return]</nowiki>}}, which specifies that if {{ic|mdns_minimal}} cannot find {{ic|*.local}}, it will not continue to search for it in {{ic|dns}}, {{ic|myhostname}}, etc.<br />
<br />
In case you want Avahi to support other TLDs, you should:<br />
<br />
* replace {{ic|1=mdns_minimal [NOTFOUND=return]}} with the full {{ic|mdns}} module. There also are IPv4-only and IPv6-only modules {{ic|mdns[46](_minimal)}}<br />
* customize {{ic|/etc/avahi/avahi-daemon.conf}} with the {{ic|domain-name}} of your choice<br />
* whitelist Avahi custom TLDs in {{ic|/etc/mdns.allow}}<br />
<br />
==== Tools ====<br />
<br />
Avahi includes several utilities which help you discover the services running on a network. For example, run<br />
<br />
$ avahi-browse --all --ignore-local --resolve --terminate<br />
<br />
to discover services in your network.<br />
<br />
The Avahi Zeroconf Browser ({{ic|avahi-discover}} – note that it needs avahi's optional dependencies {{Pkg|gtk3}}, {{Pkg|python-dbus}} and {{Pkg|python-gobject}}) shows the various services on your network. You can also browse SSH and VNC Servers using {{ic|bssh}} and {{ic|bvnc}} respectively.<br />
<br />
=== Firewall ===<br />
<br />
Be sure to open UDP port {{ic|5353}} if you're using a [[firewall]].<br />
<br />
=== Link-Local (Bonjour/Zeroconf) chat ===<br />
<br />
Avahi can be used for bonjour protocol support under linux. Check [[Wikipedia:Comparison of instant messaging clients]] or [[List of applications#Instant messaging clients]] for a list of clients supporting the bonjour protocol.<br />
<br />
=== Obtaining IPv4LL IP address ===<br />
<br />
{{Merge|dhcpcd|should be merged into the main page}}<br />
<br />
By default, if you are getting IP using DHCP, you are using the {{Pkg|dhcpcd}} package. It can attempt to obtain an IPv4LL address if it failed to get one via DHCP. By default this option is disabled. To enable it, comment noipv4ll string:<br />
<br />
{{hc|/etc/dhcpcd.conf|<br />
...<br />
#noipv4ll<br />
...}}<br />
<br />
Alternatively, run {{ic|avahi-autoipd}}:<br />
<br />
# avahi-autoipd -D<br />
<br />
== Adding services ==<br />
<br />
Avahi advertises the services whose {{ic|*.service}} files are found in {{ic|/etc/avahi/services}}. Files in this directory must be readable by the {{ic|avahi}} user/group.<br />
<br />
If you want to advertise a service for which there is no {{ic|*.service}} file, it is very easy to create your own.<br />
As an example, let's say you wanted to advertise a quote of the day (QOTD) service operating per RFC 865 on TCP port {{ic|17}} which you are running on your machine<br />
<br />
The first thing to do is to determine the {{ic|<type>}}. {{man|5|avahi.service}} indicates that the type should be "the DNS-SD service type for this service. e.g. '_http._tcp'". Since the [http://www.dns-sd.org/ServiceTypes.html DNS-SD register was merged into the IANA register in 2010], we look for the service name on the [http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml IANA register] or in {{ic|/etc/services}} file. The service name shown there is {{ic|qotd}}. Since we're running QOTD on tcp, we now know the service is {{ic|_qotd._tcp}} and the port (per IANA and RFC 865) is {{ic|17}}.<br />
<br />
Our service file is thus:<br />
<br />
{{hc|qotd.service|<nowiki><br />
<?xml version="1.0" standalone='no'?><!--*-nxml-*--><br />
<!DOCTYPE service-group SYSTEM "avahi-service.dtd"><br />
<br />
<service-group><br />
<br />
<name replace-wildcards="yes">%h</name><br />
<br />
<service><br />
<type>_qotd._tcp</type><br />
<port>17</port><br />
</service><br />
<br />
</service-group><br />
</nowiki>}}<br />
<br />
For more complicated scenarios, such as advertising services running on a different server, DNS sub-types and so on, consult {{man|5|avahi.service}}.<br />
<br />
=== SSH ===<br />
<br />
Avahi comes with an example service file to advertise a SSH server. To enable it:<br />
<br />
# cp /usr/share/doc/avahi/ssh.service /etc/avahi/services/<br />
<br />
=== File sharing ===<br />
<br />
==== NFS ====<br />
<br />
If you have an [[NFS]] share set up, you can use Avahi to be able to automount them in Zeroconf-enabled browsers (such as Konqueror on KDE and Finder on macOS) or file managers such as [[GNOME/Files]].<br />
<br />
Create a {{ic|.service}} file in {{ic|/etc/avahi/services}} with the following contents:<br />
<br />
{{hc|/etc/avahi/services/nfs_Zephyrus_Music.service|<nowiki><br />
<?xml version="1.0" standalone='no'?><br />
<!DOCTYPE service-group SYSTEM "avahi-service.dtd"><br />
<service-group><br />
<name replace-wildcards="yes">NFS Music Share on %h</name><br />
<service><br />
<type>_nfs._tcp</type><br />
<port>2049</port><br />
<txt-record>path=/data/shared/Music</txt-record><br />
</service><br />
</service-group><br />
</nowiki>}}<br />
<br />
The port is correct if you have ''insecure'' as an option in your {{ic|/etc/exports}}; otherwise, it needs to be changed (note that ''insecure'' is needed for macOS clients). The path is the path to your export, or a subdirectory of it. For some reason the automount functionality has been removed from Leopard, however [http://www.macosxhints.com/article.php?story=20071116042238744 a script is available]. This was based upon [http://ubuntuforums.org/showthread.php?p=4387032#post4387032 this post].<br />
<br />
==== Samba ====<br />
<br />
With the Avahi daemon running on both the server and client, the file manager on the client should automatically find the server.<br />
<br />
==== Vsftpd ====<br />
<br />
You can also auto-discover regular FTP servers, such as [[vsftpd]]. Install the {{Pkg|vsftpd}} package and change the settings of vsftpd according to your own personal preferences (see [http://ubuntuforums.org/showthread.php?t=218630 this thread on ubuntuforums.org] or {{man|5|vsftpd.conf}}).<br />
<br />
Create a {{ic|.service}} file in {{ic|/etc/avahi/services}} with the following contents:<br />
<br />
{{hc|/etc/avahi/services/ftp.service|<nowiki><br />
<?xml version="1.0" standalone='no'?><br />
<!DOCTYPE service-group SYSTEM "avahi-service.dtd"><br />
<service-group><br />
<name>FTP file sharing</name><br />
<service><br />
<type>_ftp._tcp</type><br />
<port>21</port><br />
</service><br />
</service-group><br />
</nowiki>}}<br />
<br />
The FTP server should now be advertised by Avahi. You should now be able to find the FTP server from a file manager on another computer in your network. You might need to enable [[#Hostname resolution]] on the client.<br />
<br />
=== AirPrint from Mobile Devices ===<br />
<br />
{{Merge | AirPort#Printing | AirPrint is a feature provided by the Apple AirPort Express and by some printers. The manual configuration technique (using JetDirect) can also apply here and may be easier.}}<br />
<br />
Avahi along with [[CUPS]] also provides the capability to print to just about any printer from airprint compatible mobile devices. In order to enable print capability from your device, simply create an Avahi service file for your printer in {{ic|/etc/avahi/services/}}. An example of a generic services file for an HP-Laserjet printer would be similar to the following with the {{ic|name}}, {{ic|rp}}, {{ic|ty}}, {{ic|adminurl}} and {{ic|note}} fields changed.<br />
<br />
{{hc|/etc/avahi/services/airprint.service|<nowiki><br />
<?xml version="1.0" standalone='no'?><!--*-nxml-*--><br />
<!DOCTYPE service-group SYSTEM "avahi-service.dtd"><br />
<service-group><br />
<name>yourPrnterName</name><br />
<service><br />
<type>_ipp._tcp</type><br />
<subtype>_universal._sub._ipp._tcp</subtype><br />
<port>631</port><br />
<txt-record>txtver=1</txt-record><br />
<txt-record>qtotal=1</txt-record><br />
<txt-record>rp=printers/yourPrnterName</txt-record><br />
<txt-record>ty=yourPrnterName</txt-record><br />
<txt-record>adminurl=http://198.168.7.15:631/printers/yourPrnterName</txt-record><br />
<txt-record>note=Office Laserjet 4100n</txt-record><br />
<txt-record>priority=0</txt-record><br />
<txt-record>product=(GPL Ghostscript)</txt-record><br />
<txt-record>printer-state=3</txt-record><br />
<txt-record>printer-type=0x801046</txt-record><br />
<txt-record>Transparent=T</txt-record><br />
<txt-record>Binary=T</txt-record><br />
<txt-record>Fax=F</txt-record><br />
<txt-record>Color=T</txt-record><br />
<txt-record>Duplex=T</txt-record><br />
<txt-record>Staple=F</txt-record><br />
<txt-record>Copies=T</txt-record><br />
<txt-record>Collate=F</txt-record><br />
<txt-record>Punch=F</txt-record><br />
<txt-record>Bind=F</txt-record><br />
<txt-record>Sort=F</txt-record><br />
<txt-record>Scan=F</txt-record><br />
<txt-record>pdl=application/octet-stream,application/pdf,application/postscript,image/jpeg,image/png,image/urf</txt-record><br />
<txt-record>URF=W8,SRGB24,CP1,RS600</txt-record><br />
</service><br />
</service-group><br />
</nowiki>}}<br />
<br />
Alternatively, https://raw.github.com/tjfontaine/airprint-generate/master/airprint-generate.py can be used to generate Avahi service files. It depends on {{Pkg|python2}} and {{Pkg|python2-pycups}}. The script can be run using:<br />
<br />
# python2 airprint-generate.py -d /etc/avahi/services<br />
<br />
{{Note|If your printer under http://localhost:631/printers is "Not Shared", this python script won't output any file to /etc/avahi/services; in that case, you'll need to "Modify Printer" under one of the CUPS drop-down menus to turn sharing on. If that doesn't work, check out the ArchWiki on [[CUPS printer sharing]].}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Hostname changes with appending incrementing numbers ===<br />
<br />
This is a [https://github.com/lathiat/avahi/issues/117 known bug] that is caused by a hostname race condition. One possible workaround is [https://github.com/lathiat/avahi/issues/117#issuecomment-302849130 disabling IPv6] to attempt to prevent the race condition. If multiple interfaces are present [https://github.com/lathiat/avahi/issues/117#issuecomment-401225716 use allow-interfaces] to limit Avahi to a single interface. Another possible workaround is to [https://github.com/lathiat/avahi/issues/117#issuecomment-442201162 disable the cache] to prevent Avahi from checking for host name conflicts altogether, but this prevents Avahi from performing lookups.<br />
<br />
== See also ==<br />
<br />
* [http://avahi.org/ Avahi] - Official project website<br />
* [[Wikipedia:Avahi (software)]]<br />
* [https://www.apple.com/itunes/download/ iTunes (includes Bonjour)] - Enable Zeroconf on Windows<br />
* http://www.zeroconf.org/</div>Qxu21https://wiki.archlinux.org/index.php?title=Avahi&diff=569146Avahi2019-03-19T20:12:27Z<p>Qxu21: added a troubleshooting blurb about an error I found while using avahi-discover</p>
<hr />
<div>[[Category:Multicast DNS]]<br />
[[fr:Avahi]]<br />
[[ja:Avahi]]<br />
From [[Wikipedia:Avahi (software)]]:<br />
:[http://avahi.org/ Avahi] is a free [[Wikipedia:Zero-configuration networking|Zero-configuration networking]] (zeroconf) implementation, including a system for multicast DNS/DNS-SD service discovery. It allows programs to publish and discover services and hosts running on a local network with no specific configuration. For example you can plug into a network and instantly find printers to print to, files to look at and people to talk to. It is licensed under the GNU Lesser General Public License (LGPL).<br />
<br />
== Installation ==<br />
<br />
[[Install]] the {{Pkg|avahi}} package.<br />
<br />
You can manage the Avahi daemon with {{ic|avahi-daemon.service}} [[systemd#Using units|using systemd]].<br />
<br />
{{Note|[[systemd-resolved]] has a built-in multicast DNS service, make sure to disable systemd-resolved's mDNS resolver and responder or [[disable]] {{ic|systemd-resolved.service}} entirely before using Avahi. For details, refer to {{man|5|resolved.conf}}.}}<br />
<br />
== Using Avahi ==<br />
<br />
=== Hostname resolution ===<br />
<br />
Avahi provides local hostname resolution using a "''hostname''.local" naming scheme. To enable it, install the {{Pkg|nss-mdns}} package and [[start]] {{ic|avahi-daemon.service}}.<br />
<br />
Then, edit the file {{ic|/etc/nsswitch.conf}} and change the {{ic|hosts}} line to include {{ic|1=mdns_minimal [NOTFOUND=return]}} before {{ic|resolve}} and {{ic|dns}}:<br />
<br />
hosts: ... '''mdns_minimal [NOTFOUND=return]''' resolve [!UNAVAIL=return] dns ...<br />
<br />
{{Note|If you experience slowdowns in resolving {{ic|.local}} hosts try to use {{ic|mdns4_minimal}} instead of {{ic|mdns_minimal}}.}}<br />
<br />
==== Configuring mDNS for custom TLD ====<br />
<br />
The {{ic|mdns_minimal}} module handles queries for the {{ic|.local}} TLD only. Note the {{ic|<nowiki>[NOTFOUND=return]</nowiki>}}, which specifies that if {{ic|mdns_minimal}} cannot find {{ic|*.local}}, it will not continue to search for it in {{ic|dns}}, {{ic|myhostname}}, etc.<br />
<br />
In case you want Avahi to support other TLDs, you should:<br />
<br />
* replace {{ic|1=mdns_minimal [NOTFOUND=return]}} with the full {{ic|mdns}} module. There also are IPv4-only and IPv6-only modules {{ic|mdns[46](_minimal)}}<br />
* customize {{ic|/etc/avahi/avahi-daemon.conf}} with the {{ic|domain-name}} of your choice<br />
* whitelist Avahi custom TLDs in {{ic|/etc/mdns.allow}}<br />
<br />
==== Tools ====<br />
<br />
Avahi includes several utilities which help you discover the services running on a network. For example, run<br />
<br />
$ avahi-browse --all --ignore-local --resolve --terminate<br />
<br />
to discover services in your network.<br />
<br />
The Avahi Zeroconf Browser ({{ic|avahi-discover}} – note that it needs avahi's optional dependencies {{Pkg|gtk3}}, {{Pkg|python-dbus}} and {{Pkg|python-gobject}}) shows the various services on your network. You can also browse SSH and VNC Servers using {{ic|bssh}} and {{ic|bvnc}} respectively.<br />
<br />
=== Firewall ===<br />
<br />
Be sure to open UDP port {{ic|5353}} if you're using a [[firewall]].<br />
<br />
=== Link-Local (Bonjour/Zeroconf) chat ===<br />
<br />
Avahi can be used for bonjour protocol support under linux. Check [[Wikipedia:Comparison of instant messaging clients]] or [[List of applications#Instant messaging clients]] for a list of clients supporting the bonjour protocol.<br />
<br />
=== Obtaining IPv4LL IP address ===<br />
<br />
{{Merge|dhcpcd|should be merged into the main page}}<br />
<br />
By default, if you are getting IP using DHCP, you are using the {{Pkg|dhcpcd}} package. It can attempt to obtain an IPv4LL address if it failed to get one via DHCP. By default this option is disabled. To enable it, comment noipv4ll string:<br />
<br />
{{hc|/etc/dhcpcd.conf|<br />
...<br />
#noipv4ll<br />
...}}<br />
<br />
Alternatively, run {{ic|avahi-autoipd}}:<br />
<br />
# avahi-autoipd -D<br />
<br />
== Adding services ==<br />
<br />
Avahi advertises the services whose {{ic|*.service}} files are found in {{ic|/etc/avahi/services}}. Files in this directory must be readable by the {{ic|avahi}} user/group.<br />
<br />
If you want to advertise a service for which there is no {{ic|*.service}} file, it is very easy to create your own.<br />
As an example, let's say you wanted to advertise a quote of the day (QOTD) service operating per RFC 865 on TCP port {{ic|17}} which you are running on your machine<br />
<br />
The first thing to do is to determine the {{ic|<type>}}. {{man|5|avahi.service}} indicates that the type should be "the DNS-SD service type for this service. e.g. '_http._tcp'". Since the [http://www.dns-sd.org/ServiceTypes.html DNS-SD register was merged into the IANA register in 2010], we look for the service name on the [http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml IANA register] or in {{ic|/etc/services}} file. The service name shown there is {{ic|qotd}}. Since we're running QOTD on tcp, we now know the service is {{ic|_qotd._tcp}} and the port (per IANA and RFC 865) is {{ic|17}}.<br />
<br />
Our service file is thus:<br />
<br />
{{hc|qotd.service|<nowiki><br />
<?xml version="1.0" standalone='no'?><!--*-nxml-*--><br />
<!DOCTYPE service-group SYSTEM "avahi-service.dtd"><br />
<br />
<service-group><br />
<br />
<name replace-wildcards="yes">%h</name><br />
<br />
<service><br />
<type>_qotd._tcp</type><br />
<port>17</port><br />
</service><br />
<br />
</service-group><br />
</nowiki>}}<br />
<br />
For more complicated scenarios, such as advertising services running on a different server, DNS sub-types and so on, consult {{man|5|avahi.service}}.<br />
<br />
=== SSH ===<br />
<br />
Avahi comes with an example service file to advertise a SSH server. To enable it:<br />
<br />
# cp /usr/share/doc/avahi/ssh.service /etc/avahi/services/<br />
<br />
=== File sharing ===<br />
<br />
==== NFS ====<br />
<br />
If you have an [[NFS]] share set up, you can use Avahi to be able to automount them in Zeroconf-enabled browsers (such as Konqueror on KDE and Finder on macOS) or file managers such as [[GNOME/Files]].<br />
<br />
Create a {{ic|.service}} file in {{ic|/etc/avahi/services}} with the following contents:<br />
<br />
{{hc|/etc/avahi/services/nfs_Zephyrus_Music.service|<nowiki><br />
<?xml version="1.0" standalone='no'?><br />
<!DOCTYPE service-group SYSTEM "avahi-service.dtd"><br />
<service-group><br />
<name replace-wildcards="yes">NFS Music Share on %h</name><br />
<service><br />
<type>_nfs._tcp</type><br />
<port>2049</port><br />
<txt-record>path=/data/shared/Music</txt-record><br />
</service><br />
</service-group><br />
</nowiki>}}<br />
<br />
The port is correct if you have ''insecure'' as an option in your {{ic|/etc/exports}}; otherwise, it needs to be changed (note that ''insecure'' is needed for macOS clients). The path is the path to your export, or a subdirectory of it. For some reason the automount functionality has been removed from Leopard, however [http://www.macosxhints.com/article.php?story=20071116042238744 a script is available]. This was based upon [http://ubuntuforums.org/showthread.php?p=4387032#post4387032 this post].<br />
<br />
==== Samba ====<br />
<br />
With the Avahi daemon running on both the server and client, the file manager on the client should automatically find the server.<br />
<br />
==== Vsftpd ====<br />
<br />
You can also auto-discover regular FTP servers, such as [[vsftpd]]. Install the {{Pkg|vsftpd}} package and change the settings of vsftpd according to your own personal preferences (see [http://ubuntuforums.org/showthread.php?t=218630 this thread on ubuntuforums.org] or {{man|5|vsftpd.conf}}).<br />
<br />
Create a {{ic|.service}} file in {{ic|/etc/avahi/services}} with the following contents:<br />
<br />
{{hc|/etc/avahi/services/ftp.service|<nowiki><br />
<?xml version="1.0" standalone='no'?><br />
<!DOCTYPE service-group SYSTEM "avahi-service.dtd"><br />
<service-group><br />
<name>FTP file sharing</name><br />
<service><br />
<type>_ftp._tcp</type><br />
<port>21</port><br />
</service><br />
</service-group><br />
</nowiki>}}<br />
<br />
The FTP server should now be advertised by Avahi. You should now be able to find the FTP server from a file manager on another computer in your network. You might need to enable [[#Hostname resolution]] on the client.<br />
<br />
=== AirPrint from Mobile Devices ===<br />
<br />
{{Merge | AirPort#Printing | AirPrint is a feature provided by the Apple AirPort Express and by some printers. The manual configuration technique (using JetDirect) can also apply here and may be easier.}}<br />
<br />
Avahi along with [[CUPS]] also provides the capability to print to just about any printer from airprint compatible mobile devices. In order to enable print capability from your device, simply create an Avahi service file for your printer in {{ic|/etc/avahi/services/}}. An example of a generic services file for an HP-Laserjet printer would be similar to the following with the {{ic|name}}, {{ic|rp}}, {{ic|ty}}, {{ic|adminurl}} and {{ic|note}} fields changed.<br />
<br />
{{hc|/etc/avahi/services/airprint.service|<nowiki><br />
<?xml version="1.0" standalone='no'?><!--*-nxml-*--><br />
<!DOCTYPE service-group SYSTEM "avahi-service.dtd"><br />
<service-group><br />
<name>yourPrnterName</name><br />
<service><br />
<type>_ipp._tcp</type><br />
<subtype>_universal._sub._ipp._tcp</subtype><br />
<port>631</port><br />
<txt-record>txtver=1</txt-record><br />
<txt-record>qtotal=1</txt-record><br />
<txt-record>rp=printers/yourPrnterName</txt-record><br />
<txt-record>ty=yourPrnterName</txt-record><br />
<txt-record>adminurl=http://198.168.7.15:631/printers/yourPrnterName</txt-record><br />
<txt-record>note=Office Laserjet 4100n</txt-record><br />
<txt-record>priority=0</txt-record><br />
<txt-record>product=(GPL Ghostscript)</txt-record><br />
<txt-record>printer-state=3</txt-record><br />
<txt-record>printer-type=0x801046</txt-record><br />
<txt-record>Transparent=T</txt-record><br />
<txt-record>Binary=T</txt-record><br />
<txt-record>Fax=F</txt-record><br />
<txt-record>Color=T</txt-record><br />
<txt-record>Duplex=T</txt-record><br />
<txt-record>Staple=F</txt-record><br />
<txt-record>Copies=T</txt-record><br />
<txt-record>Collate=F</txt-record><br />
<txt-record>Punch=F</txt-record><br />
<txt-record>Bind=F</txt-record><br />
<txt-record>Sort=F</txt-record><br />
<txt-record>Scan=F</txt-record><br />
<txt-record>pdl=application/octet-stream,application/pdf,application/postscript,image/jpeg,image/png,image/urf</txt-record><br />
<txt-record>URF=W8,SRGB24,CP1,RS600</txt-record><br />
</service><br />
</service-group><br />
</nowiki>}}<br />
<br />
Alternatively, https://raw.github.com/tjfontaine/airprint-generate/master/airprint-generate.py can be used to generate Avahi service files. It depends on {{Pkg|python2}} and {{Pkg|python2-pycups}}. The script can be run using:<br />
<br />
# python2 airprint-generate.py -d /etc/avahi/services<br />
<br />
{{Note|If your printer under http://localhost:631/printers is "Not Shared", this python script won't output any file to /etc/avahi/services; in that case, you'll need to "Modify Printer" under one of the CUPS drop-down menus to turn sharing on. If that doesn't work, check out the ArchWiki on [[CUPS printer sharing]].}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Hostname changes with appending incrementing numbers ===<br />
<br />
This is a [https://github.com/lathiat/avahi/issues/117 known bug] that is caused by a hostname race condition. One possible workaround is [https://github.com/lathiat/avahi/issues/117#issuecomment-302849130 disabling IPv6] to attempt to prevent the race condition. If multiple interfaces are present [https://github.com/lathiat/avahi/issues/117#issuecomment-401225716 use allow-interfaces] to limit Avahi to a single interface. Another possible workaround is to [https://github.com/lathiat/avahi/issues/117#issuecomment-442201162 disable the cache] to prevent Avahi from checking for host name conflicts altogether, but this prevents Avahi from performing lookups.<br />
<br />
=== avahi-discover returning "Failed to initialize: module 'gi' has no attribute 'require_version'" ===<br />
This error can be resolved by installing the package {{Pkg|python-gobject}}, as a critical GTK Python module is missing.<br />
<br />
== See also ==<br />
<br />
* [http://avahi.org/ Avahi] - Official project website<br />
* [[Wikipedia:Avahi (software)]]<br />
* [https://www.apple.com/itunes/download/ iTunes (includes Bonjour)] - Enable Zeroconf on Windows<br />
* http://www.zeroconf.org/</div>Qxu21