winbind / wins:名称解析暂时失败/无法按主机名ping

时间:2020-04-04 12:32:11

标签: linux ubuntu hostname

我有一个用于运行容器的Ubuntu服务器(Ubuntu 19.10)。我正在尝试使用其主机名访问(即ping)服务器。我可以使用IP到达它。我花了一段时间,但我发现我需要安装winbindlibnss-winbind才能解析Ubuntu服务器。我根据在网上和man中找到的指南配置了所有内容,但仍然无法在Windows机器上解析Ubuntu Server的主机名。从Ubuntu解析Windows机器主机名也是如此。

andy@cship:~$ sudo apt list winbind libnss-winbind
Listing... Done
libnss-winbind/eoan-updates,eoan-security,now 2:4.10.7+dfsg-0ubuntu2.4 amd64 [installed]
winbind/eoan-updates,eoan-security,now 2:4.10.7+dfsg-0ubuntu2.4 amd64 [installed]

我根据手册页配置了主机文件。

andy@cship:~$ cat /etc/hosts
# The following lines are desirable for IPv4 capable hosts
127.0.0.1       localhost

# 127.0.1.1 is often used for the FQDN of the machine
127.0.1.1       cship.local cship

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

/ etc / hostname设置为cship

andy@cship:~$ cat /etc/hostname
cship

主机名正确返回cship作为主机名

andy@cship:~$ hostname
cship

我可以使用主机名cship来ping通自己(即在同一台计算机上本地)

andy@cship:~$ ping cship
PING cship.local (127.0.1.1) 56(84) bytes of data.
64 bytes from cship.local (127.0.1.1): icmp_seq=1 ttl=64 time=0.105 ms
^C
--- cship.local ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.105/0.105/0.105/0.000 ms

我已经安装了winbindlibnss-winbind,winbind正在运行

andy@cship:~$ sudo systemctl status winbind
● winbind.service - Samba Winbind Daemon
   Loaded: loaded (/lib/systemd/system/winbind.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2020-04-04 12:01:04 UTC; 16min ago
     Docs: man:winbindd(8)
           man:samba(7)
           man:smb.conf(5)
 Main PID: 764 (winbindd)
   Status: "winbindd: ready to serve connections..."
    Tasks: 2 (limit: 4619)
   Memory: 17.3M
   CGroup: /system.slice/winbind.service
           ├─764 /usr/sbin/winbindd --foreground --no-process-group
           └─794 winbindd: domain child [CSHIP]

Apr 04 12:01:03 cship systemd[1]: Starting Samba Winbind Daemon...
Apr 04 12:01:04 cship systemd[1]: Started Samba Winbind Daemon.

我为/etc/nsswitch.conv添加了胜利

andy@cship:~$ grep wins /etc/nsswitch.conf
hosts:          files wins dns

wins添加到`/etc/nsswitch.conv后,尝试解析本地网络中另一台机器的主机名时失败。

andy@cship:~$ ping google.com
PING google.com (172.217.168.14) 56(84) bytes of data.
64 bytes from zrh11s03-in-f14.1e100.net (172.217.168.14): icmp_seq=1 ttl=55 time=78.6 ms
^C
--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 78.608/78.608/78.608/0.000 ms
andy@cship:~$ ping destop-abcd
ping: destop-abcd: Temporary failure in name resolution

而且我仍然无法从其他Windows主机ping计算机。

0 个答案:

没有答案