安装 resolvconf

apt install resolvconf

vi /etc/resolvconf/resolv.conf.d/head

在文件中增加
nameserver 8.8.8.8
nameserver 8.8.4.4

重启网络服务,使新 DNS 配置生效

systemctl restart networking

查看 dns 服务器

cat /etc/resolv.conf