码迷,mamicode.com
首页 > 系统相关 > 详细

Ubuntu Server 中resolv.conf重启时被覆盖的问题

时间:2015-10-03 13:10:26      阅读:327      评论:0      收藏:0      [点我收藏+]

标签:

/etc/resolv.conf中设置dns之后每次重启Ubuntu Server时该文件会被覆盖,针对这种情况找了一些个解决方法

防止/etc/resolv.conf被覆盖的方法

方法一

1.需要创建一个文件/etc/resolvconf/resolv.conf.d/tail

sudo vi /etc/resolvconf/resolv.conf.d/tail

2.在该文件中写入自己需要的dns服务器,格式与/etc/resolv.conf相同

nameserver 8.8.8.8  

3.重启下resolvconf程序

sudo /etc/init.d/resolvconf restart 

再去看看/etc/resolv.conf文件,可以看到自己添加的dns服务器已经加到该文件中

方法二

在/etc/network/interfaces中

###interfaces中#######
auto eth0    
iface eth0 inet static    
address 192.168.3.250    
netmask 255.255.255.0                  #子网掩码    
gateway 192.168.3.1                      #网关    
dns-nameservers 8.8.8.8 8.8.4.4    #设置dns服务器  

 

 

Ubuntu Server 中resolv.conf重启时被覆盖的问题

标签:

原文地址:http://www.cnblogs.com/longshiyVip/p/4853262.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!