In CentOS or Red Hat Enterprise Linux (RHEL) 7, you can find your /etc/resolv.conf file, which holds all nameserver configurations for your server, to be overwritten by the NetworkManager.

If you check the content of /etc/resolv.conf, it may look like this.

$ cat /etc/resolv.conf
# Generated by NetworkManager
search mydomain.tld
nameserver 8.8.8.8

The NetworkManager will assume it has the rights to control /etc/resolv.conf, if it finds a DNS related configuration in your interface configuration file.

$ grep DNS /etc/sysconfig/network-scripts/ifcfg-*
DNS1="8.8.8.8"
IPV6_PEERDNS="yes"

To prevent Network Manager to overwrite your resolv.conf changes, remove the DNS1, DNS2, ... lines from /etc/sysconfig/network-scripts/ifcfg-*.

Now, you can manually change the /etc/resolv.conf file again, and you should be good to go. NetworkManager will no longer overwrite your DNS nameserver configurations.

参考文章:https://ma.ttias.be/centos-7-networkmanager-keeps-overwriting-etcresolv-conf/

CentOS 7 NetworkManager Keeps Overwriting /etc/resolv.conf的更多相关文章

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

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

  2. /etc/resolv.conf overwritten. Redhat/Centos

    Prevent /etc/resolv.conf from being blown away by RHEL/CentOS after customizing If you are using RHE ...

  3. 两个坑-Linux下Network-Manager有线未托管-DNS resolv.conf文件开机被清空

    Linux里面有两套管理网络连接的方案: 1./etc/network/interfaces(/etc/init.d/networking) 2.Network-Manager 两套方案是冲突的,不能 ...

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

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

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

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

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

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

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

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

  8. 修改/etc/resolv.conf又恢复到原来的状态?[转]

    新装一台机器环境为服务器主板,双网卡,系统为CentOS5.4 ,eth0为内网ip,eth1为公网ip.但是由于在本地测试,设置的内网ip,域名服务器同样使用的是上海本地的域名解析,没有问题,可以上 ...

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

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

随机推荐

  1. 什么是redis,redis能做什么,redis应用场景

    Redis是一个key-value存储系统.Redis的出现,很大程度补偿了memcached这类key/value存储的不足,在部分场合可以对关系数据库起到很好的补充作用.这篇文章小编为大家分享了在 ...

  2. Java 对二值化图片识别连通域

    用Java 对 已经 二值化了的图片 标记连通域 每块的连通域都标记不一样的数字 public static void main(String [] args) throws IOException ...

  3. Centos6.9安装Node.js+npm爬坑

    Node.js选择 1.下载 wget https://nodejs.org/dist/v8.4.0/node-v8.4.0-linux-x86.tar.gz 2.解压 tar zxvf node-v ...

  4. Netty 拆包粘包和服务启动流程分析

    Netty 拆包粘包和服务启动流程分析 通过本章学习,笔者希望你能掌握EventLoopGroup的工作流程,ServerBootstrap的启动流程,ChannelPipeline是如何操作管理Ch ...

  5. VM安装Ubuntu问题合集(无法联网、中文界面设置、中文输入法etc)

    经常使用VM安装Ubuntu,安装系统的步骤跟着系统提示一步步下来就行,但总是遇到一些问题,这里记录一下常遇到的问题,以及自己解决的办法: 1.无法联网: 状况:Ubuntu不能联网,联网地方一直在闪 ...

  6. xampp使用中mysql端口被占用问题的解决方案

    如果在安装XAMPP前本机已经安装了mysql,并且添加了Windows服务中 使用xampp时,两个Mysql在Windows服务中有冲突 这意味着你之前在电脑上使用过mysql,路径.端口都被占用 ...

  7. 疑难杂症——关于EntityFramework的SqlQuery方法的执行效率差异的探讨

    前言:最近项目上面遇到一个问题,在Code First模式里面使用EntityFramework的SqlQuery()方法查询非常慢,一条数据查询出来需要10秒以上的时间,可是将sql语句放在plsq ...

  8. centos如何安装python库?

    通过yum install安装,先解决yum不能安装python库的问题 yum install -y  epel-release  #先安装epel源,参考http://sharadchhetri. ...

  9. 提示让IE8以下版本的浏览器去更新浏览器

    需求: 强制让IE进行页面渲染时候,用最新的方式渲染,并提示让IE8以下的版本去更新浏览器并给一个连接地址 那,如何满足? <!DOCTYPE html> <html lang=&q ...

  10. H5 Canvas图像模糊解决办法

    1.最近在用h5的canvas画动画,发现图像特别模糊.后来终于找到罪魁祸首是<meta name="viewport" content="width=device ...