1.输入该命令按回车键
vi /etc/systemd/resolved.conf
2.按i进入插入模式,修改为例如
DNS=8.8.8.8 223.5.5.5
然后按ESC键输入wq按回车键保存退出vi编辑
3.输入该命令按回车键
systemctl restart systemd-resolved
4.输入该命令按回车键
systemctl enable systemd-resolved
5.输入该命令按回车键
mv /etc/resolv.conf /etc/resolv.conf.bak
6.输入该命令按回车键
ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
7.输入该命令按回车键查看设置情况,重启服务验证
cat /etc/resolv.conf