首页 > 其他 > 详细

/etc/resolv.conf overwritten. Redhat/Centos

时间:2014-02-17 03:29:14      阅读:469      评论:0      收藏:0      [点我收藏+]

Prevent /etc/resolv.conf from being blown away by RHEL/CentOS after customizing

If you are using RHEL 6.X it may be a surprise that editing the /etc/resolv.conf will result in your changes being deleted by the OS.

This is because there is a process called NetworkManager that automatically creates /etc/resolv.conf from the settings in /etc/sysconfig/network-scripts/ifcfg-interfacename

To disable this behavior, turn off Network Manager as follows:

/etc/init.d/NetworkManager stop
/sbin/chkconfig NetworkManager off

Also in /etc/sysconfig/network-scripts/ifcfg-eth0 adjust NM_CONTROLLED to “no”.

NM_CONTROLLED="no"
DNS1=8.8.8.8
DNS2=8.8.4.4
DOMAIN=mydomain.com

Be sure to have the latest yum update as well for some issues around this.

Now you can edit your /etc/resolv.conf with custom settings like below without it being blow away:

search mydomain.com
options timeout:1
nameserver 8.8.8.8
nameserver 8.8.4.4

This entry was posted Tuesday, June 25th, 2013 at 5:29 am and is filed under Linux. Follow responses:RSS 2.0

/etc/resolv.conf overwritten. Redhat/Centos

原文:http://www.cnblogs.com/dracula/p/3551511.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!