Ubuntu修改DNS永久生效
1)禁用systemd-resolved服务
systemctl stop systemd-resolved
systemctl disable systemd-resolved
2)默认的/etc/resolv.conf是软链接,删除重建为普通文件。
rm -rf /etc/resolv.conf
3)vim /etc/resolv.conf
nameserver 10.1.1.1
nameserver 10.1.2.1
4)将/etc/resolv.conf文件加锁
chattr +i /etc/resolv.conf