需要安装resolvconf包
# sudo apt install resolvconf
然后在/etc/network/interfaces 写入
dns-nameservers 114.114.114.114 8.8.8.8
注意: 多个dns以空格隔开
ubuntu 在/etc/network/interfaces设置了dns-nameservers x.x.x.x 无效
原文:https://www.cnblogs.com/sealin/p/13575671.html