方法一:修改DNS
/etc/resolve.conf编辑很快就会被覆盖,因为其第一行写着:
# This file is managed by man:systemd-resolved(8). Do not edit.
故修改/etc/systemd/resolved.conf
[Resolve]
DNS=8.8.8.8 114.114.114.114
当然,错误的时钟也会给网络带来问题:
sudo ntpdate edu.ntp.org.cn # ntp同步时钟
方法二、 使用unbound
sudo systemctl stop systemd-resolved
sudo systemctl disable systemd-resolved
sudo apt install unbound
sudo rm -rf /etc/resolv.conf
打开网络管理器配置文件
sudo vim /etc/NetworkManager/NetworkManager.conf
在[main]下添加
dns=unbound
保存后重启。