Ubuntu 18.04 桌面从 16.04 升级而来。我遇到了一个无法解决的奇怪问题。
升级后,我继续像往常一样进行网络配置(接口、解析等),直到我注意到切换到 netplan。现在我正努力改正它,但我一定搞砸了。
重启或“systemctl restart systemd-networkd”后,一切正常。nslookup 适用于 WAN 和 LAN。但过了一会儿,LAN 查找停止工作,据我所知,什么都没有改变。
diskstation(192.168.0.42)是我的 NAS,它是本地 DNS。
重启后:
nslookup diskstation.lan
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: diskstation.lan
Address: 192.168.0.42
过了一会儿(我什么也没做):
nslookup diskstation.lan
Server: 127.0.0.53
Address: 127.0.0.53#53
** server can't find diskstation.lan: NXDOMAIN
但这有效:
nslookup diskstation.lan 192.168.0.42
Server: 192.168.0.42
Address: 192.168.0.42#53
Name: diskstation.lan
Address: 192.168.0.42
我的 netplan 文件 01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
enp33s0:
dhcp4: no
addresses:
- 192.168.0.46/24
gateway4: 192.168.0.1
nameservers:
search: [lan]
addresses: [192.168.0.42, 8.8.8.8, 8.8.4.4]
解决状态:
systemd-resolve --status
Global
DNS Domain: lan
DNSSEC NTA: 10.in-addr.arpa
16.172.in-addr.arpa
168.192.in-addr.arpa
17.172.in-addr.arpa
18.172.in-addr.arpa
19.172.in-addr.arpa
20.172.in-addr.arpa
21.172.in-addr.arpa
22.172.in-addr.arpa
23.172.in-addr.arpa
24.172.in-addr.arpa
25.172.in-addr.arpa
26.172.in-addr.arpa
27.172.in-addr.arpa
28.172.in-addr.arpa
29.172.in-addr.arpa
30.172.in-addr.arpa
31.172.in-addr.arpa
corp
d.f.ip6.arpa
home
internal
intranet
lan
local
private
test
Link 3 (docker0)
Current Scopes: none
LLMNR setting: yes
MulticastDNS setting: no
DNSSEC setting: no
DNSSEC supported: no
Link 2 (enp33s0)
Current Scopes: DNS
LLMNR setting: yes
MulticastDNS setting: no
DNSSEC setting: no
DNSSEC supported: no
DNS Servers: 192.168.0.42
8.8.8.8
8.8.4.4
DNS Domain: lan
奇怪的是,当它停止工作时,什么都没有改变。我做了一个,find / -mmin -60
没有任何变化。状态输出(例如来自 resolve)也没有改变。
ifconfig
enp33s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.46 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::329c:23ff:fe00:5fd8 prefixlen 64 scopeid 0x20<link>
ether 30:9c:23:00:5f:d8 txqueuelen 1000 (Ethernet)
RX packets 2925377 bytes 3969527143 (3.9 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1245146 bytes 143284968 (143.2 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 218578 bytes 19744358 (19.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 218578 bytes 19744358 (19.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
这里是:
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-====================================-=======================-=======================-=============================================================================
un dnsmasq <none> <none> (no description available)
ii dnsmasq-base 2.79-1 amd64 Small caching DNS proxy and DHCP/TFTP server
un dnsmasq-base-lua <none> <none> (no description available)
答案1
您在配置中列出了私有名称服务器和公共名称服务器,而这些服务器对 DNS 的看法并不相同。由于您有一个有状态的本地解析器(已解析),如果您的第一个 DNS 服务器由于某种原因暂时不可用(只是意味着它没有及时响应),解析将回退到列表中的下一个服务器,这是一个不知道您的本地名称的公共名称服务器。
为了避免这种情况,您应该在配置中仅使用私有名称服务器,而不使用公共后备。