Linux 资源收集

Avahi

Avahi是一个局域网零配置网络(Zeroconf):无需人工配置IP地址、DNS等,通过mDNS(多播DNS)、DNS-SD(DNS服务发现)协议,可以实现开箱即用。Avahi主要由三部分组成:常驻服务avahi-daemonlibavahi-client客户端供第三方集成、avahi-utils–CLI工具。

Ubuntu系统的安装命令:

sudo apt update && sudo apt install avahi-daemon avahi-utils -y

配置主机名称,即对外发布的本机的名称。编辑文件/etc/avahi/avahi-daemon.conf,修改字段host-name

[server]
host-name=ub2404-px4
#domain-name=local
#browse-domains=0pointer.de, zeroconf.org
use-ipv4=yes
use-ipv6=yes
#allow-interfaces=eth0
#deny-interfaces=eth1
#check-response-ttl=no
#use-iff-running=no
#enable-dbus=yes
#disallow-other-stacks=no
#allow-point-to-point=no
#cache-entries-max=4096
#clients-max=4096
#objects-per-client-max=1024
#entries-per-entry-group-max=32
ratelimit-interval-usec=1000000
ratelimit-burst=1000

其余字段保持原有即可,默认一般意思为启用,如果要禁用某功能,则取消注释并修改该字段,如字段allow-interfaces保持被注释状态为允许所有网卡。其中domain-name不可修改。

启动Avahi服务:

# 使能服务
sudo systemctl enable avahi-daemon

# 重启服务
sudo systemctl restart avahi-daemon

完成设置主机名,并重启服务之后,对外的名称为ub2404-px4.local,其他安装了Avahi的电脑,可以通过命令ping ub2404-px4.local获取本机的IP地址。

参考资料:




Enjoy Reading This Article?

Here are some more articles you might like to read next: