mig*_*ile 9 networking dns 16.10
我新安装了 Ubuntu 16.10 并 rsync 将我以前的主目录从 kubuntu 16.04 备份到我的新安装。事情运行良好,但尽管经过多次试验和错误,我还是无法解析本地地址。
所有网络似乎都在完美运行。Internet 浏览、外部地址的 DNS 查找、ssh 等都很棒。在本地,我可以通过 ssh 使用他们的地址访问机器,但不能访问他们的名字。这一切在 nautilus/samba 中都可以正常工作,这意味着 WINS 可以正常工作。看来,唯一的问题是本地网络 DNS。我已经安装并运行了 avahi-daemon,因为它是随 Ubuntu 一起提供的。
我已经包含了一些故障排除,使用 <<>> 来缩短冗余或正确工作的部分。
$ nmcli g
STATE CONNECTIVITY WIFI-HW WIFI WWAN-HW WWAN
connected full enabled enabled enabled enabled
$ ping tendril8 << or tendril8.local >>
ping: tendril8: Name or service not known
$ ping gateway
PING gateway (192.168.1.1) 56(84) bytes of data.
64 bytes from gateway (192.168.1.1): icmp_seq=1 ttl=64 time=4.16 ms
$ ping askubuntu.com
PING askubuntu.com (151.101.129.69) 56(84) bytes of data.
64 bytes from 151.101.129.69 (151.101.129.69): icmp_seq=1 ttl=49 time=43.0 ms
$ nslookup askubuntu.com
Server: 127.0.1.1
Address: 127.0.0.1#53
<< followed by several IP addresses >>
$ nslookup tendril8 << or tendril8.local >>
Server: 127.0.1.1
Address: 127.0.0.1#53
** server can't find tendril8: NXDOMAIN
$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
$ ls -la /etc/resolv.conf
lrwxrwxrwx 1 root root 29 Oct 15 19:30 /etc/resolv.conf -> ../run/resolvconf/resolv.conf
$ 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
group: compat
shadow: compat
gshadow: files
hosts: files resolve [!UNAVAIL=return] mdns4_minimal dns [NOTFOUND=return]
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
Run Code Online (Sandbox Code Playgroud)
注意:在 Ubuntu 在 16.10 中切换到 systemd.resolved 之前,我花了大量时间研究“旧”解决方案。他们没有为我工作,我不认为这与以前的 Ubuntu 配置类似的问题是重复的问题。
ric*_*hbl 18
如果我正确理解您的问题,您将无法解析本地主机名。
对此,我在全新安装 16.10 时遇到了同样的问题,结果证明这是一个与 libnss 相关的已知问题(https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1624071) -在systemd中解决。
我的解决方案是查看您的 /etc/nsswitch.conf 文件并特别注意 NSS 如何解析您的主机:
hosts: files resolve [!UNAVAIL=return] mdns4_minimal [NOTFOUND=return] dns myhostname
Run Code Online (Sandbox Code Playgroud)
这种逻辑似乎在进入 mDNS 之前就无法解析主机名。
将 hosts 行编辑回 16.10 之前的版本修复了这个明显的逻辑错误:
hosts: files mdns4_minimal [NOTFOUND=return] dns myhostname
Run Code Online (Sandbox Code Playgroud)
包含的错误报告链接表明 systemd 软件包的未来版本可能最终会解决此问题。
富有的
自动编辑的替代解决方案/etc/nsswitch.conf是删除[编辑:并重新安装] libnss-resolve:
sudo apt purge libnss-resolve
sudo apt install libnss-resolve
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14213 次 |
| 最近记录: |