使用 wicd 在resolve.conf中設定DNS伺服器

使用 wicd 在resolve.conf中設定DNS伺服器

簡潔版本:使用 wicd 進行網路連線時,如何將「名稱伺服器」永久保存在resolve.conf 中?

長版:嘗試在 Ubuntu Server 中更新 apt-get 後收到以下錯誤訊息:

Err:1 http://security.ubuntu.com/ubuntu zesty-security InRelease
W: Failed to fetch http://ca.archive.ubuntu.com/ubuntu/dists/zesty/InRelease  Could not resolve 'ca.archive.ubuntu.com'

看起來像是 DNS 錯誤,所以我檢查了 /etc/resolve.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
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.

nameserver 127.0.0.53

我手動編輯了該文件並添加了:

nameserver 8.8.8.8
nameserver 8.8.4.4

到最後。運行“apt-get update”,一切都很順利。

當然,問題是resolve.conf 經常被破壞,所以我嘗試使用WICD 手動設定DNS 伺服器。我進入 wicd-curses,選擇我使用的無線網絡,並設定以下選項:

[X] Use Static DNS           [ ] Use global DNS servers
DNS domain: google.com
Search domain: 
DNS server 1: 8.8.8.8
DNS server 2: 8.8.4.4
DNS server 3:

並重新啟動我的電腦。打開resolve.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
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.

nameserver 127.0.0.53
search google.com

無論如何嘗試了 apt-get update,但它失敗了,並出現與之前相同的錯誤。

接下來我嘗試打開 /etc/wicd/dhclient.conf.template 並附加以下內容:

prepend domain-name-servers 8.8.8.8 8.8.4.4;

但這對resolve.conf沒有影響。

我不會經常搞亂網路(或至少在這個層面上);我在設定 DNS 伺服器時是否犯了一些根本性錯誤或缺陷?

答案1

您的問題是resolvconf(8)假設systemd-resolved正在運行並將nameserver 127.0.0.53條目寫入/etc/resolv.conf.您可能想檢查其中/etc/resolvconf.conf包含什麼。另請參見man 8 resolvconfman 5 resolvconf.conf。如果systemd-resolved.service正在運行,您可能還想停用它。

(或者,也許退一步,重新考慮您是否真的對 Ubuntu 處理開箱即用的網路設定的方式不滿意。)

答案2

在 wicd Ubuntu 網路管理員中,請尋找並取消選取自動取得 DNS 伺服器的選項,並將其手動設定為8.8.8.8&8.8.4.4

網路管理員正在從上游 ISP 取得 DNS 位址並更新它。

當您使用網路管理員的 GUI 工具時,您可以從 GUI 更新 DNS 首選項選項。

尋找程式和圖像https://askubuntu.com/questions/87468/how-to-specify-dns-ip-in-wicd

相關內容