
我無法對問題 1128536 新增評論(如何對 /etc/resolv.conf Ubuntu 18.10 進行持久更改)
在筆記型電腦上使用 Ubuntu 20.04.3 ;最新更新是 10 月 19 日,在 10 月 10 日最後一次更新之後,我突然在解析 DNS 時遇到了問題。在更新之前我的 /etc/resolv.conf 讀到:
> nameserver 127.0.0.53
在我的網路管理員設定中,我已經輸入了 DHCP 自動和 DNS 手動,其中包含 ISP 的 2 個 DNS 伺服器 IP 位址:1xx.2xx.xxx.21 1xx.2xx.xxx.22
指令的結果 $ ls -al /etc/resolv.conf
lrwxrwxrwx 1 root root 32 okt 13 14:10 /etc/resolv.conf -> /run/systemd/resolve/resolv.conf
所以為了確保我做到了
$ sudo rm -f /etc/resolv.conf
$ sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
卻發現它沒有改變任何東西:重新啟動systemd-resolve服務後新的/etc/resolv.conf的內容仍然讀取
nameserver ::1
我透過重複手動儲存 /etc/resolv.conf 檔案並覆蓋 systemd-resolve 服務寫入的檔案(作為解決方法)來成功完成系統更新,直到更新成功終止。確保人們不會懷疑我的閱讀能力:我確實理解文件頂部的警告,指出該文件會定期被覆蓋。
我可以透過定期覆蓋檔案 /run/systemd/resolve/resolv.conf 來維持“可用連接”,內容如下
nameserver 1xx.2xx.xxx.21
nameserver 1xx.2xx.xxx.22
直到我重新啟動 systemd-resolve 服務並且該檔案被 systemd=resolve 覆蓋並恢復為
nameserver ::1
我還檢查了 /run/systemd/resolve/stub-resolv.conf 文件,其中包含以下內容
nameserver 127.0.0.53
options edns0 trust-ad
輸出resolvctl狀態
Global
LLMNR setting: no
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
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 4 (ipv6leakintrf0)
Current Scopes:
DNS DefaultRoute setting: yes
LLMNR setting: yes
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
Current DNS Server: ::1
DNS Servers: ::1
DNS Domain: ~.
Link 3 (wlp2s0)
Current Scopes: none
DefaultRoute setting: no
LLMNR setting: yes
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
Link 2 (enp6s0)
Current Scopes: none
DefaultRoute setting: no
LMNR setting: yes
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
我的問題是:
@heynnema:如何使 systemd-resolve 產生有效的 /run/systemd/resolve/resolv.conf,因為它肯定會忽略在 netmanager 設定中輸入的配置