停掉自带的dns管理服务
systemctl stop systemd-resolved
systemctl disable systemd-resolved
删除dns配置文件
rm /etc/resolv.conf
重新写入dns解析
echo -e "nameserver 114.114.114.114" > /etc/resolv.conf
修改/etc/nsswitch.conf
这个文件不修改,无法连接外网
vi /etc/nsswitch.conf
修改 hosts 为
hosts: files dns mymachines
网友评论