What is avahi daemon in linux

avahi-daemon(8) — Linux man page

The Avahi mDNS/DNS-SD daemon implements Apple’s Zeroconf architecture (also known as «Rendezvous» or «Bonjour»). The daemon registers local IP addresses and static services using mDNS/DNS-SD and provides two IPC APIs for local programs to make use of the mDNS record cache the avahi-daemon maintains. First there is the so called «simple protocol» which is used exclusively by avahi-dnsconfd (a daemon which configures unicast DNS servers using server info published via mDNS) and nss-mdns (a libc NSS plugin, providing name resolution via mDNS). Finally there is the D-Bus interface which provides a rich object oriented interface to D-Bus enabled applications.

Upon startup avahi-daemon interprets its configuration file /etc/avahi/avahi-daemon.conf and reads XML fragments from /etc/avahi/services/*.service which may define static DNS-SD services. If you enable publish-resolv-conf-dns-servers in avahi-daemon.conf the file /etc/resolv.conf will be read, too.

Options

-f | —file= FILE Specify the configuration file to read. (default: /etc/avahi/avahi-daemon.conf) -D | —daemonize Daemonize after startup. Implies —syslog. -s | —syslog Log to syslog instead of STDERR. Implied by —daemonize. —debug Increase verbosity to debug level. —no-rlimits Don’t enforce resource limits as specified in the configuration file. (See setrlimit(2) for more information) —no-drop-root Don’t drop root priviliges after startup and don’t require daemon to be started as root. We recommend not to use this option. —no-chroot Don’t chroot(2) the daemon. This option is only available when compiled with chroot() support. —no-proc-title Don’t change the process name while running. Unless this option is specified avahi-daemon will reflect its current state and the selected host name in the process title. -k | —kill Kill an already running avahi-daemon. (equivalent to sending a SIGTERM) -r | —reload Tell an already running avahi-daemon to reread /etc/resolv.conf (in case you enabled publish-resolv-conf-dns-servers in avahi-daemon.conf) the files from /etc/avahi/services/. Please note that this will not reload the /etc/avahi/avahi-daemon.conf. (equivalent to sending a SIGHUP) -c | —check Return 0 as return code when avahi-daemon is already running. -h | —help Show help -v | —version Show version information

Files

/etc/avahi/avahi-daemon.conf: the default configuration file for avahi-daemon, avahi-daemon.conf(5) for more information.

/etc/avahi/hosts: additional static hostname mappings to publish in mDNS, see avahi.hosts(5) for more information.

/etc/avahi/services/*.service: static service definitions, see avahi.service(5) for more information.

Signals

SIGHUP: avahi-daemon will reload unicast DNS server data from /etc/resolv.conf and static service definitions from /etc/avahi/services/. (Same as —reload)

SIGUSR1: avahi-daemon will dump local and remote cached resource record data to syslog.

Читайте также:  Linux сколько весит система

Источник

Linux Avahi Daemon Tutorial With Examples

Avahi is an mDNS/DNS daemon, service which implements Apples’s Zeroconf mechanism. Zeroconf is also known as Rendezvous or Bonjour. Zeroconf have their main task to process.

  1. Automatic assignment of numeric network addresses
  2. Automatic distribution and resolution of hostnames,
  3. Automatic location of network services such as printing devices.

Installing Avahi

Avahi-daemon can be installed with yum and apt like below.

$ sudo apt install avahi-daemon

Installing Avahi

Starting Avahi

After installing avahi as we know avahi works as daemon generally. We will start the avahi daemon. Using init scripts following command can be issued. Keep in mind that avahi requires root privileges as we can see from the following screenshot it asks for the root password.

$ /etc/init.d/avahi-daemon start

Starting Avahi

Another way to start avahi-daemon is by using systemctl command like below. with the avahi service name avahi-daemon. The avahi service current status can be seen too

$ sudo systemctl start avahi-daemon

Starting Avahi

Stopping Avahi

Stopping avahi in the init system can be done with the following command. Stopping avahi service requires root privileges too.

Stopping Avahi

$ sudo systemctl stop avahi-daemon

Enable Avahi Daemon

Avahi daemon can be enabled to start automatically in the system start with the systemctl command like below.

$ sudo systemctl enable avahi-daemon

Enable Avahi Daemon

Disable Avahi Daemon

Avahi daemon can be disabled to start automatically in the system start with the following command.

$ sudo systemctl disable avahi-daemon

Disable Avahi Daemon

Configuration Files

Avahi configuration files reside in /etc/avahi . Avahi daemon configuration file is named avahi-daemon.conf . There is a different type of configuration abilities with this file.
Avahi server hostnames and IP addresses are stored in hosts file. Services are stored in services directory as XML file.

Configuration Files

Add Host

Adding host to the DNS service of avahi is like adding host Linux hosts file. Add the following line into the host file like in the screenshot and then restart avahi daemon.

Add Host

Add Service

Adding services is harder than adding hosts. There is an XML configuration file used to describe services and this file will be put into /etc/avahi/services/ . The following service configuration file defines FTP file which is served from tcp 21 port.

   FTP file sharing _ftp._tcp 21  

Источник

What is the avahi daemon?

I just learning about daemon, by that time I came know avahi daemon can you please explain detaily about avahi daemon and why linux has a avahi user ?

3 Answers 3

In short: avahi is a Linux implementation of a protocol also known as «Rendezvous» or «Bonjour»). Its goal is to let devices, conected to the local network, to broadcast their IP-address together with their function . Hence the printer can from time to time broadcasts : My IP is 192.168.23.45 and I can print any postscript document with ipp prottocol; a NAS can say: My IP is 192.168.23.88 and I can stream music, save your bacups, and serve as a fileserver. If it is not what you want to hear on your network you can stop / disable the avahi daemon with standard systemctl command. But if you run a cups-broadcast daemon, it will start the avahi itself.

Читайте также:  Домашняя операционная система линукс

Linux uses fictive users usualy for security reasons, not to give the attacker any chance to hack a process own by root. So you can see a postfix or mail , and postgres or mysql users. The daemon, owened by such unprivileged user, gives less chance for the attacker to get the superuser rights.

Definitely yes, the avahi daemon listens UDP port 5353. You can check it with the command netstat -lup or ss -lup as superuser.

Well, I do not want to start a flame. But in my local net it is for nothing, I set and thats why I know all IP and function of all devices in my network. For a large network, or for net without an smart admin, this protocol (and hence its daemons) can make the network configuration easier, but you pay for it with more noise on your net. After connecting the new net-printer (which gets its IP by dhcp) you can start to configure your printing subsystem by asking for all print capable new devices, without knowing ist IP.

@einpoklum The broadcasts (or multicasts) happen at intervals (like every 30 seconds), so avahi-daemon listens for local Rendezvous/Bonjour broadcasts and caches the list of systems it hears about, so applications using the Avahi libraries will get the list of Rendezvous/Bonjour devices essentially immediately. So when you e.g. open a «select network printer» dialog, you’ll get an essentially complete list immediately, instead of having to wait up to 30 seconds for the printers to pop in one by one.

Источник

What is avahi daemon in linux

An account of the Avahi (zeroconf, Apple Bonjour) framework provided by Debian. Based on the packages distributed with Debian 10 (buster) and Debian 11 (bullseye).

Introduction

  • publish services and hosts running on a local network, and
  • discover services and hosts running on a local network.

The local network is assumed to be trusted. A firewall should should permit multicast traffic on port 5353. Installation of Avahi is straightforward and generally maintenance-free afterwards.

Machines that have cups installed will already have avahi-daemon as a recommended package.

Avahi Utilities

Basically, avahi-daemon will quietly get on with its job of publishing and discovering network services and hosts and most users will require little more from it apart from hostname resolution.

Hostname Resolution

Hostname resolution via the system’s Name Server Switch (NSS) facility is performed by libnss-mdns, which is recommended by avahi-daemon. Otherwise do

As explained in /usr/share/doc/libnss-mdns/README.Debian, the package’s post-installation script alters a line in /etc/nsswitch.conf to read

hosts: files mdns4_minimal [NOTFOUND=return] dns

The mDNS domain .local is where hosts on the network reside and mdns4_minimal handles queries only for that domain. Hostname resolution takes place automatically with commands such as

ping .local ssh .local nmap .local

To resolve a hostname to an IPv4 address with avahi-resolve:

Читайте также:  Linux find ignore files

The reverse process is performed with

avahi-resolve -a 192.168.7.235

avahi-resolve obtains an IP address or hostname directly from the mDNS multicast from hosts. It does not use the NSS functionality of libnss-mdns.

Using avahi-browse

For a complete view of services and hosts on the network:

An entry from the output of one such command will be used to illustrate the common features of any entry.

= eth0 IPv4 Music Player @ desktop Music Player Daemon local hostname = [desktop.local] address = [192.168.7.20] port = [6600] txt = []

Music Player Daemon is the friendly service name. The service is running on port 6600 of the machine desktop.local with an IPv4 address 192.168.7.20. The text record (txt =) in this case is empty. If a service name is not available it will be replaced by the service type. All this information is published and will be available to a client wishing to access the service.

A list of all the service names known to avahi-daemon is given by

gives a list of matching service types, application protocol names. The service type _mpd._tcp matches the human-readable Music Player Daemon. This service can specifically be browsed for with

Display service types of services discovered on the network:

Debian Package Integration with Avahi

Some indication of the Debian packages that support service publication and discovery may be gleaned from libavahi-client3:

apt rdepends libavahi-client3

Disabling avahi-daemon

With root privileges, to disable temporarily:

systemctl disable avahi-daemon.service avahi-daemon.socket systemctl stop avahi-daemon.service avahi-daemon.socket
systemctl enable avahi-daemon.service avahi-daemon.socket systemctl start avahi-daemon.service avahi-daemon.socket

To disable permanently (will remain disabled after reboot):

systemctl disable avahi-daemon.service avahi-daemon.socket systemctl stop avahi-daemon.service avahi-daemon.socket systemctl mask avahi-daemon.service avahi-daemon.socket

Registering a New Service in Avahi

avahi-daemon will publish local services set up according to .service files placed in the directory /etc/avahi/services. This is independent of the services published from what the system is already aware of on the network.

An example is ssh. openssh-server does not advertise via mDNS but can be induced to by the .service file provided in /usr/share/doc/avahi-daemon/examples/.

Printing and Scanning Services

  • Printing services are published by a CUPS server and any moderd printer on the network. They are shown on discovery as having a service type of _ipp._tcp.
  • A scanning service is generally observed to be published by a modern MFD scanning device and shown on discovery as having a service type of _uscan._tcp. libsane1 and sane-airscan provides backends for scanner discovery via avahi-daemon and the escl protocol.

Источник

Оцените статью
Adblock
detector