我有三个运行 Fedora 的系统,分别名为:dragon、wyvern 和 griffin。我看到了奇怪的 mdns 行为:
- 从 dragon,我可以 ping 和 ssh 到 dragon.local、wyvern.local 和 griffin.local
- 从 griffin ,我只能 ping griffin.local , wyvern.local 和 dragon.local 都给我一个 DNS 错误(“名称或服务未知”)
- 从 wyvern 来看,所有三个主机名(包括其本身)都给出“名称或服务未知”
所有三个框均报告正在运行的 avahi-daemon,如下所示:
● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
Loaded: loaded (/usr/lib/systemd/system/avahi-daemon.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2018-06-20 20:33:34 AEST; 10min ago
Main PID: 23500 (avahi-daemon)
Status: "avahi-daemon 0.7 starting up."
Tasks: 2 (limit: 4915)
Memory: 1.4M
CGroup: /system.slice/avahi-daemon.service
├─23500 avahi-daemon: running [dragon.local]
└─23502 avahi-daemon: chroot helper
Jun 20 20:33:34 dragon avahi-daemon[23500]: New relevant interface virbr0.IPv4 for mDNS.
Jun 20 20:33:34 dragon avahi-daemon[23500]: Joining mDNS multicast group on interface wlp2s0.IPv6 with address fe80::cc1b:70dd:7f3:8ec1.
Jun 20 20:33:34 dragon avahi-daemon[23500]: New relevant interface wlp2s0.IPv6 for mDNS.
Jun 20 20:33:34 dragon avahi-daemon[23500]: Joining mDNS multicast group on interface wlp2s0.IPv4 with address 192.168.1.101.
Jun 20 20:33:34 dragon avahi-daemon[23500]: New relevant interface wlp2s0.IPv4 for mDNS.
Jun 20 20:33:34 dragon avahi-daemon[23500]: Network interface enumeration completed.
Jun 20 20:33:34 dragon avahi-daemon[23500]: Registering new address record for 192.168.124.1 on virbr0.IPv4.
Jun 20 20:33:34 dragon avahi-daemon[23500]: Registering new address record for fe80::cc1b:70dd:7f3:8ec1 on wlp2s0.*.
Jun 20 20:33:34 dragon avahi-daemon[23500]: Registering new address record for 192.168.1.101 on wlp2s0.IPv4.
Jun 20 20:33:35 dragon avahi-daemon[23500]: Server startup complete. Host name is dragon.local. Local service cookie is 1419905038.
我已在三台机器上重新启动了 avahi-daemon,但未发现行为有任何变化。三台机器都具有相同的 (/etc/avahi/avahi-daemon.conf
如 diff 所报告的),并且我尚未从 Fedora 默认设置中对其进行编辑。它看起来像这样:
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# avahi is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with avahi; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
# See avahi-daemon.conf(5) for more information on this configuration
# file!
[server]
#host-name=foo
#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
[wide-area]
enable-wide-area=yes
[publish]
#disable-publishing=no
#disable-user-service-publishing=no
#add-service-cookie=no
#publish-addresses=yes
publish-hinfo=no
publish-workstation=no
#publish-domain=yes
#publish-dns-servers=192.168.50.1, 192.168.50.2
#publish-resolv-conf-dns-servers=yes
#publish-aaaa-on-ipv4=yes
#publish-a-on-ipv6=no
[reflector]
#enable-reflector=no
#reflect-ipv=no
[rlimits]
#rlimit-as=
#rlimit-core=0
#rlimit-data=8388608
#rlimit-fsize=0
#rlimit-nofile=768
#rlimit-stack=8388608
#rlimit-nproc=3
我怎样才能让这三台机器互相看到对方,而不是看到这些不同的工作组合?
答案1
我偶尔会遇到类似的 Avahi 行为,一般来说,在出现问题的主机上重新启动 nscd 和 avahi-daemon 就足以恢复 mDNS 名称解析。
service nscd restart
service avahi-daemon restart
另外,检查 mDNS 流量(端口 5353)是否被受影响主机上的防火墙阻止。