我目前有两个CentOS 6.3虚拟机,都运行avahi-daemon,但其中一个名称无法访问.
问题机器:
error@underground ~ $ssh nagios.localssh: Could not resolve hostname nagios.local: name or service not kNown
工作机器:
error@underground ~ $ssh puppet.localerror@puppet.local's password:
然而我可以在网络上看到它:(地下是我正在工作的主机)
error@underground ~ $avahi-browse -at+ br0 IPv4 puppet SSH Remote Terminal local+ br0 IPv4 nagios SSH Remote Terminal local+ br0 IPv4 puppet [52:54:00:d0:31:c7] Workstation local+ br0 IPv4 nagios [52:54:00:93:ec:af] Workstation local+ br0 IPv4 underground [6c:62:6d:d1:df:ad] Workstation local+ virbr0 IPv4 underground [52:54:00:8e:60:30] Workstation local
根据反馈,getent主机的输出:
error@underground ~ $getent hosts nagios.localerror@underground ~ $getent hosts puppet.local192.168.12.146 puppet.local
在nagios.local上,无法访问的虚拟机,avahi-daemon(显然)安装并运行,我在防火墙上打了一个正确的洞:
pkts bytes target prot opt in out source destination 74 15950 ACCEPT udp -- * * 0.0.0.0/0 224.0.0.251 state NEW udp dpt:5353
nagios.local上的Syslog让我完全不知道可能会发生什么:
Jul 18 04:24:18 nagios avahi-daemon[1384]: Leaving mDNS multicast group on interface eth0.IPv4 with address 192.168.12.132.Jul 18 04:24:18 nagios avahi-daemon[1476]: Found user 'avahi' (UID 70) and group 'avahi' (GID 70).Jul 18 04:24:18 nagios avahi-daemon[1476]: Successfully dropped root privileges.Jul 18 04:24:18 nagios avahi-daemon[1476]: avahi-daemon 0.6.25 starting up.Jul 18 04:24:18 nagios avahi-daemon[1476]: WARNING: No NSS support for mDNS detected,consIDer installing nss-mdns!Jul 18 04:24:18 nagios avahi-daemon[1476]: Successfully called chroot().Jul 18 04:24:18 nagios avahi-daemon[1476]: Successfully dropped remaining capabilitIEs.Jul 18 04:24:18 nagios avahi-daemon[1476]: Loading service file /services/ssh.service.Jul 18 04:24:18 nagios avahi-daemon[1476]: Joining mDNS multicast group on interface eth0.IPv4 with address 192.168.12.132.Jul 18 04:24:18 nagios avahi-daemon[1476]: New relevant interface eth0.IPv4 for mDNS.Jul 18 04:24:18 nagios avahi-daemon[1476]: Network interface enumeration completed.Jul 18 04:24:18 nagios avahi-daemon[1476]: Registering new address record for 2001:db8:1600:80bf:5054:ff:fe93:ecaf on eth0.*.Jul 18 04:24:18 nagios avahi-daemon[1476]: Registering new address record for 192.168.12.132 on eth0.IPv4.Jul 18 04:24:18 nagios avahi-daemon[1476]: Registering HINFO record with values 'X86_64'/'liNUX'.Jul 18 04:24:19 nagios avahi-daemon[1476]: Server startup complete. Host name is nagios.local. Local service cookie is 3129794608.Jul 18 04:24:19 nagios avahi-daemon[1476]: Service "nagios" (/services/ssh.service) successfully established.
这两个安装之间的主要区别在于puppet.local是作为“桌面”安装安装的,而nagios.local是作为“最小”安装安装的,并且稍后安装了各种与avahi相关的软件包.
我无法弄清楚为什么我无法解析这台机器的名字.我错过了什么完全显而易见的事情?
更新:根据mgorven的建议,我再次检查了主机,发现它没有安装nss-mdns.所以我安装了它,现在问题完全颠倒了!从主持人看:
error@underground ~ $getent hosts puppet.localerror@underground ~ $getent hosts nagios.local192.168.12.132 nagios.local解决方法 我的猜测是NSS库没有配置为在查找主机名时咨询mDNS,因此当程序查找主机名时它失败(即使Avahi本身正在拿起名字).检查是否已安装
nss-mdns
软件包(它似乎仅在 EPEL中可用,而不是CentOS本身),并且/etc/nsswitch.conf中的主机行包含mdns4(或mdns4_minimal)数据库.它应该看起来像这样: hosts: files mdns4_minimal [NOTFOUND=return] dns
您可以使用getent hosts< hostname>来测试主机名查找.
总结以上是内存溢出为你收集整理的linux – 使用avahi连接到主机会出错:名称或服务未知全部内容,希望文章能够帮你解决linux – 使用avahi连接到主机会出错:名称或服务未知所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)