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的更多相关文章

  1. CentOS 7 NetworkManager Keeps Overwriting /etc/resolv.conf

    In CentOS or Red Hat Enterprise Linux (RHEL) 7, you can find your /etc/resolv.conf file, which holds ...

  2. 解决重启centos后resolv.conf总被清空的问题

    解决重启centos后resolv.conf总被清空的问题 最近在机器上装了虚拟机virtualbox,然后安装了centos6.4,安装了免费主机控制面板virtualmin,在本地机器上搭建测试网 ...

  3. Centos重新启动网络配置文件,/etc/resolv.conf被覆盖或清空问题解决

    Centos在执行命令 yum update时报错如下: Could not get metalink https://mirrors.fedoraproject.org/metalink?repo= ...

  4. CentOS 修改/etc/resolv.conf 重启network后又恢复到原来的状态?

    问题描述:CentOS 修改/etc/resolv.conf 执行service network restart后,/etc/resolv.conf又恢复到原来的状态 解决方法:/etc/resolv ...

  5. CentOS yum有时出现“Could not retrieve mirrorlist ”的解决办法——resolv.conf的配置

    国内服务器在运行命令yum -y install wget的时候,出现: Could not retrieve mirrorlist http://mirrorlist.centos.org/?rel ...

  6. CentOS yum时出现“Could not retrieve mirrorlist ”的解决的方法——resolv.conf的配置

    原因:没有配置resolv.conf 解决方法: 到/etc文件夹下配置resolv.conf增加nameserver IP,如: nameserver 8.8.8.8 nameserver 8.8. ...

  7. vsftp在REDHAT,CENTOS 5中登录慢的解决办法

    vsftp在REDHAT,CENTOS 5中登录慢的解决办法 vsftp在REDHAT,CENTOS 5中不仅登录慢,至少花30秒左右,而且上传文件的速度也受影响, 经过摸索,根本原因在DNS解析上花 ...

  8. 如何保证修改resolv.conf后重启不恢复?

    如何保证修改resolv.conf后重启不恢复? 修改/etc/resolv.conf,重启网卡后,/etc/resolv.conf恢复到原来的状态. CentOS.redhat下面直接修改/etc/ ...

  9. Redhat/CentOS 制作本地yum源

    一.制作本地yum源的场景有: (1) 操作系统ISO文件是通过光驱读取的 (2) 操作系统ISO文件是通过USB设备挂载的 (3) 操作系统ISO文件是被上传到本地文件夹的形式 二. 这3种配置方式 ...

随机推荐

  1. mod_cluster启用https协议的步骤

    1.生成SSL证书与私钥 Generate Private Key on the Server Running Apache + mod_ssl First, generate a private k ...

  2. android 缓存Bitmap 使用内存缓存

    private LruCache<String, Bitmap> mMemoryCache; /** * 判断内存大小 设置位图的缓存空间 */ private void judgeMem ...

  3. windows 7 下找不到 Chart控件问题

    1.网上下载 Microsoft Chart Control, version 6.0 插件 2.注册.由于windows 7 的权限问题注册会失败,因为注册控件需要管理员的权限,在开始菜单的附件下面 ...

  4. BEGIN_TEMPLATE_MESSAGE_MAP

    最近转做服务端开发,或多或少有点坑爹的感觉.目前正在恶补Linux C/C++编程,主要还是集中在Linux系统API的学习.不过也好,以后更新的内容不仅仅只有Windows了. 今天说一点简单的东西 ...

  5. 纯CSS3实现轮播切换效果

    使用纯css3实现与轮播器一样的功能. HTML代码: <div class="slide-container"> <input type="radio ...

  6. 第二个Sprint冲刺事后诸葛亮报告

    用户反馈:计时的填空题难度过大,计时选择题的画面太亮. 用户数量:4 团队改进建议:bug有点多 工作: 主界面 试卷题,是整合以前的内容的 选择题:也是整合以前功能的 初级的 计时题 1.每个成员第 ...

  7. bigworld源码分析(1)—— 研究bigworld的意义和目标

    对于网络游戏服务器开发熟悉的人,基本都知道bigworld引擎,此引擎包括客户端部分和服务器部分,已经有很多知名的网络游戏通过bigworld来构建游戏.我主要关注bigworld的服务器部分,它是一 ...

  8. sqlite 删除表中重复数据(亲测可用)

    例子:表名  Paper .通过字段PaperID查找重复数据. 1 --查询某表中重复的数据       select * from Paper group by PaperID having co ...

  9. js 获取浏览器可视窗口大小,滚动条高度

    // 获取窗口宽度 if (window.innerWidth) winWidth = window.innerWidth; else if ((document.body) && ( ...

  10. TCP链接时主动close时可能的rst报文

    阿里核心系统团队博客http://csrd.aliapp.com/?p=1055记录了主动关闭TCP socket时,可能不发fin包,而是发rst的问题. 其原因是主动关闭socket时,若接收bu ...