修改 /etc/systemd/resolved.conf 文件,在其中添加dns信息
DNS=2001:4860:4860::8888 2001:4860:4860::8844 DNS=8.8.8.8 114.114.114.114
然后退出保存。
然后以root身份在ubuntu终端中依次执行如下命令:
systemctl restart systemd-resolvedsystemctl enable systemd-resolvedmv /etc/resolv.conf /etc/resolv.conf.bakln -s /run/systemd/resolve/resolv.conf /etc/
再查看/etc/resolv.conf文件就可以看到新的dns信息已经写入其中了。