avahi-daemon_带有示例Linux Avahi Daemon教程

avahi-daemon

avahi-daemon

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.

Avahi是mDNS / DNS守护程序,该服务实现了Apple的Zeroconf机制。 Zeroconf也称为Rendezvous或Bonjour。 Zeroconf有其主要任务要处理。

  1. Automatic assignment of numeric network addresses

    自动分配数字网络地址
  2. Automatic distribution and resolution of hostnames,

    自动分配和解析主机名,
  3. Automatic location of network services such as printing devices.

    网络服务(例如打印设备)的自动位置。

安装Avahi (Installing Avahi)

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

Avahi-daemon可以与yum和apt一起安装,如下所示。

$ sudo apt install avahi-daemon
Installing Avahi
Installing Avahi
安装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.

在我们知道安装avahi之后,avahi通常可以用作守护程序。 我们将启动avahi守护程序。 使用初始化脚本,可以发出以下命令。 请记住,avahi需要root特权,正如我们从下面的屏幕快照中看到的那样,它要求输入root密码。

$ /etc/init.d/avahi-daemon start
Starting Avahi
Starting Avahi
启动阿瓦希

OR

要么

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

启动avahi-daemon的另一种方法是使用如下所示的systemctl命令。 使用avahi服务名称avahi-daemon。 avahi服务的当前状态也可以看到

$ sudo systemctl start avahi-daemon
Starting Avahi
Starting Avahi
启动阿瓦希

停止阿瓦希(Stopping Avahi)

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

可以使用以下命令在初始化系统中停止avahi。 停止avahi服务也需要root特权。

$ /etc/init.d/avahi-daemon stop
Stopping Avahi
Stopping Avahi
停止阿瓦希

OR

要么

$ sudo systemctl stop avahi-daemon

启用Avahi守护程序 (Enable Avahi Daemon)

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

可以使用以下systemctl命令在系统启动时启用Avahi守护程序自动启动。

$ sudo systemctl enable avahi-daemon
Enable Avahi Daemon
Enable Avahi Daemon
启用Avahi守护程序

禁用Avahi守护程序(Disable Avahi Daemon)

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

可以禁用Avahi守护程序以在系统中使用以下命令自动启动。

$ sudo systemctl disable avahi-daemon
Disable Avahi Daemon
Disable Avahi Daemon
禁用Avahi守护程序

配置文件(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.

Avahi配置文件位于/etc/avahi 。 Avahi守护程序配置文件名为avahi-daemon.conf 。 此文件有不同类型的配置功能。 Avahi服务器的主机名和IP地址存储在hosts文件中。 服务以XML文件的形式存储在services目录中。

LEARN MORE  Linux Su Command Tutorial With Examples
通过示例了解更多Linux Su命令教程
Configuration Files
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.

将主机添加到avahi的DNS服务就像添加主机Linux主机文件一样。 如屏幕截图所示,将以下行添加到host文件中,然后重新启动avahi守护程序。

192.168.122.45  ubu2
Add Host
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.

添加服务比添加主机难。 有一个用于描述服务的XML配置文件,该文件将放入/etc/avahi/services/ 。 以下服务配置文件定义了从tcp 21端口提供的FTP文件。

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
  <name>FTP file sharing</name>
  <service>
    <type>_ftp._tcp</type>
    <port>21</port>
  </service>
</service-group>
Add Service
Add Service
添加服务

翻译自: https://www.poftut.com/linux-avahi-daemon-tutorial-examples/

avahi-daemon

  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值