17.10-DNS设置为systemd的127.0.0.53-如何永久更改?

分享于 

2分钟阅读

ubuntu

  繁體

问题

network-admin显示/etc/resolv.conf的内容为nameserver: 127.0.0.53

如果我更改为8.8.8.8或208.67.222.222,就一切正常,直到重新启动。

重新启动或恢复时,名称服务器被重置为127.0.0.53.

如何永久地将nameserver设置为有效的?

如果运行systemd-resolve --status,我得到


Link 3 (wlo1)


 Current Scopes: LLMNR/IPv4 LLMNR/IPv6


 LLMNR setting: yes


MulticastDNS setting: no


 DNSSEC setting: no


 DNSSEC supported: no




答案1

你可以安装软件包resolvconf,sudo apt install resolvconf 然后可以创建或修改文件/etc/resolvconf/resolv.conf.d/tail,如果放入nameserver 8.8.8.8,该行将添加到/run/resolvconf/resolv.conf的末尾,/etc/resolv.conf现在是一个指向这个文件的符号链接。


答案2

我使用Lubuntu & Kubuntu 18.04,

第一步:安装unbound,并将其设置为替换systemd-resolved。

sudo systemctl disable systemd-resolved 
sudo systemctl stop systemd-resolved 
sudo systemctl enable unbound-resolvconf 
sudo systemctl enable unbound 

重新启动

以root打开文件/etc/NetworkManager/NetworkManager.conf

sudo leafpad /etc/NetworkManager/NetworkManager.conf in Lubuntu 18.04 or in Kubuntu 18.04 SUDO_EDITOR=kate sudoedit /etc/NetworkManager/NetworkManager.conf 

[main]下放一行:

dns=unbound

再次重新启动


SYS  系统  SET  DNS  Systemd  Permanent