Ubuntu 15.04直接修改/etc/resolv.conf,添加DNS重启后配置丢失。
正确方法:
-
#vim /etc/network/interfaces,文件最后添加“dns-nameservers 223.5.5.5”
重启systemctl restart networking.service,测试OK
-
#vim /etc/resolvconf/resolv.conf.d/base(文件默认为空)
nameserver 223.5.5.5
nameserver 223.6.6.6
#resolvconf -u (更新改动至resolv.conf)
#more /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTEN
nameserver 223.5.5.5
nameserver 223.6.6.6
不需要重启网卡/系统,测试OK,重启系统后OK。
更多Ubuntu相关信息见Ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2
本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-12/126867.htm