Learn to cross happiness and sorrow on the long river of ups and downs life.
0%
Avahi-Daemon Service
Posted onEdited onInlinux
,
servicesSymbols count in article: 11kReading time ≈10 mins.
Avahi is a free zero-configuration networking (zeroconf) implementation, including a system formulticast DNS/DNS-SDservice discovery.
Backgroud
Avahi is a system which enables programs to publish and discover services and hosts running on alocal network. For example, a user can plug their computer into a network and have Avahi automatically advertise thenetwork services running on the machine which could enable access to files and printers.
ZeroConf or UPnPs
Why UPnPs, because UPnP is an organization, not a specific protocol. It’s like saying: We are implementing RFC XXXX, rather than saying: We are implementing IETF.
ZeroConf is a precisely defined, three-in-one protocol, namely: Address Selection, Name Resolution and Service Discovery, to reduce the difficulty of network configuration
For example, Apple’s Bonjour service is an implementation of ZeroConf. If Bonjour for Windows service is installed on Windows, you can easily find and use printers that support ZeroConf on the network.
The purpose of ZeroConf is to improve the availability and reliability of the product without the need to provide complex documentation, reduce support costs, and improve customer satisfaction.
In contrast, UPnP is an open device-related protocol set. For each new device, a new working group is set up in the UPnP Forum to discuss how such devices work. The problem is that while there are many devices that claim to support UPnP, these are just nominal claims. For example, Windows does not use UPnP to discover, configure, and use printers that exist on the network.
Why not replace UPnP with ZeroConf?
There is a misunderstanding here:
There is no question of choice here: there is no reason to not support UPnP when supporting ZeroConf, which is technically entirely feasible. At the level of local address selection, ZeroConf and UPnP are exactly the same.
As mentioned earlier, ZeroConf is the protocol and UPnP is the organization.
If someone says: We are adapting UPnP, it is estimated to have two meanings: we are adapting to a specific UPnP protocol, or he means that those unfortunate network configuration problems have been left to the engineers to solve.
Conclusion
In terms of address selection, ZeroConf is not different from UPnP.
ZeroConf provides domain name resolution services, but UPnP does not (obvious difference).
At the level of service discovery, the two have their own implementations, but they do not conflict. ZeroConf is mDNS-SD and UPnP is SSDP.
If you are building a new product, rather than working on an existing UPnP protocol model, it doesn’t make sense to use UPnP. UPnP is only for a specific implementation of some problems in a very narrow direction.
Install
1
:~$ sudo apt-get install avahi-daemon
Configure Avahi
The path of configure file was /etc/avahi/avahi-daemon.conf.
_MacOSXDupSuppress._tcp:MacOS X Duplicate Machine Suppression _ksysguard._tcp:KDE System Guard _omni-bookmark._tcp:OmniWeb Bookmark Sharing _acrobatSRV._tcp:Adobe Acrobat _adobe-vc._tcp:Adobe Version Cue _home-sharing._tcp:Apple Home Sharing _amzn-wplay._tcp:Amazon Fire TV _qdiscover._tcp:QNAP NAS
# Other _pgpkey-hkp._tcp:GnuPG/PGP HKP Key Server _ldap._tcp:LDAP Directory Server _tp._tcp:Thousand Parsec Server _tps._tcp:Thousand Parsec Server (Secure) _tp-http._tcp:Thousand Parsec Server (HTTP Tunnel) _tp-https._tcp:Thousand Parsec Server (Secure HTTP Tunnel) _shifter._tcp:Window Shifter _xpra._tcp:Xpra Session Server _libvirt._tcp:Virtual Machine Manager _device-info._tcp:Device Info
avahi-daemon static host name file
man avahi.hosts
/etc/avahi/hosts
1 2 3 4 5 6 7 8 9 10 11 12
# This file is part of avahi. # # This file contains static ip address <-> host name mappings. These # can be useful to publish services on behalf of a non-avahi enabled # device. Please bear in mind that host names are expected to be # fully qualified domain names, i.e. ending in .local!
# See avahi.hosts(5) for more information on this configuration file!
:~$ avahi-browse -all + eth0 IPv4 transmission Web Site local + eth0 IPv4 pi Web Site local + eth0 IPv4 pi SSH Remote Terminal local + eth0 IPv4 R7800 SSH Remote Terminal local + eth0 IPv4 pi Secure Web Site local :~$ avahi-browse -r _https._tcp + eth0 IPv4 pi Secure Web Site local = eth0 IPv4 pi Secure Web Site local hostname = [pi.net] address = [192.168.100.100] port = [50443] txt = ["org.freedesktop.Avahi.cookie=1839282170"] :~$
2. other tools
avahi-publish
avahi-publish-address
avahi-publish-service
avahi-resolve
avahi-resolve-address
avahi-resolve-host-name
avahi-set-host-name
avahi-discover (GUI Tool)
1 2 3 4 5 6 7 8
:~$ sudo apt-get install avahi-discover :~$ avahi-discover Browsing domain 'local' on -1.-1 ... ... Found service 'pi' of type'_https._tcp'in domain 'local' on 2.0. Found service 'transmission' of type'_http._tcp'in domain 'local' on 2.0. Found service 'pi' of type'_http._tcp'in domain 'local' on 2.0. Found service 'pi' of type'_ssh._tcp'in domain 'local' on 2.0.