我在局域网上托管了一个本地网站(更新:我看到这个可能特定于某事VMware vCSA 6.7所以我添加了该信息)。我可以从我的 Mac 和 Windows 机器访问它,但出于某种原因,它无法在我的 Ubuntu 18.04 笔记本电脑上的 Web 浏览器中加载。我有一个用于 IT 研究的家庭实验室,因此 DNS 由两个 Windows Server VM 提供(如果重要的话,我使用 VMware vSphere)。此外,DHCP 在 Windows AD 服务器上运行。同样,Windows(未加入域和加入域)和Mac 客户端正在通过正确的 DNS 服务器设置获取 DHCP 租约,并且在其他机器上的查找工作如预期一样。
-c 4
这是我的 Ubuntu 18.04 笔记本电脑上PING 短名称和 PING FQDN(所以是 4x)和 HOST 命令的输出。值得注意的是:当我 ping “shortHostname”时,它解析了...但是当我 ping FQDN 时,它不是解决...不确定为什么:
sam@LenovoThnkPad:/$ ping MyTest-Site -c 4
PING MyTest-Site.MyLab.local (192.168.3.11) 56(84) bytes of data.
64 bytes from MyTest-Site.MyLab.local (192.168.3.11): icmp_seq=1 ttl=64 time=2.12 ms
64 bytes from MyTest-Site.MyLab.local (192.168.3.11): icmp_seq=2 ttl=64 time=2.40 ms
64 bytes from MyTest-Site.MyLab.local (192.168.3.11): icmp_seq=3 ttl=64 time=1.91 ms
64 bytes from MyTest-Site.MyLab.local (192.168.3.11): icmp_seq=4 ttl=64 time=2.28 ms
--- MyTest-Site.MyLab.local ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 1.913/2.181/2.403/0.190 ms
sam@LenovoThnkPad:/$ ping MyTest-Site.MyLab.local -c 4
ping: MyTest-Site.MyLab.local: Name or service not known
sam@LenovoThnkPad:/$ host MyTest-Site
MyTest-Site.MyLab.local has address 192.168.3.11
sam@LenovoThnkPad:/$ host MyTest-Site.MyLab.local
MyTest-Site.MyLab.local has address 192.168.3.11
cat /etc/nsswitch.conf
按要求 添加输出:
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: compat systemd
group: compat systemd
shadow: compat
gshadow: files
hosts: files mdns4_minimal [NOTFOUND=return] dns myhostname
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
答案1
我添加了我的 FQDN 条目/etc/hosts
并解决了该问题:
adminMe@IdeaPad-Ubuntu:/etc$ cat hosts
127.0.0.1 localhost
127.0.1.1 IdeaPad-Ubuntu
192.168.1.121 vCSA6-7.myLab.local
# 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