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. CSS3 background-size图片自适应

    http://www.html5cn.com.cn/css3/2013-04-21/267.html background-size属性和background-origin属性.background- ...

  2. Servlet&&Jsp 概述

    主题 Servlet的作用 构建动态网页 Servlet代码初探 Servlet与其他技术的对比 Jsp的作用 Servlet的作用 Servlet是在web服务器或应用服务器上用来动态生成html的 ...

  3. 【Java框架型项目从入门到装逼】第九节 - 数据库建表和CRUD操作

    1.新建学生表 这节课我们来把和数据库以及jdbc相关的内容完成,首先,进行数据库建表.数据库呢,我们采用MySQL数据库,我们可以通过navcat之类的管理工具来轻松建表. 首先,我们得建一个数据库 ...

  4. Python-Blog2-编写Web app 骨架

    撸代码之前让我们先来看几个概念: 什么是协程(Coroutine)? 假设现在有两个子程序,子程序A和子程序B: def A(): print('1') print('2') print('3') d ...

  5. cpuimage 开源之

    前年学习opengl做的一个小东西. 原本计划将gpuimage 的算法一个一个转写成cpu版本 c,c++ 版本. gpuimage 项目参考: https://github.com/BradLar ...

  6. win7 mysql 数据库轻松实现数据库定时备份

    本地备份: 第一步: 安装一个mysql. 第二步: 在命令行中配置mysql 打开环境变量将mysql 安装路径配置到path中 第三部: cmd 中输入:mysqldump -uroot -p12 ...

  7. python_如何拆分含有多种分隔符的字符串?

    案例: 把某个字符串依据分隔符拆分,该字符包含不同的多种分隔符,如下 s = '12;;7.osjd;.jshdjdknx+' 其中 ; . + 是分隔符 有哪些解决方案? 方法1:通过str.spl ...

  8. linkin大话面向对象--方法详解

    1,方法的参数传递机制:值传递. 首先弄懂2个概念:形参和实参. 形参(形式参数):相当于函数(Java中也把函数称之为方法)中的局部变量,在函数被调用时创建,并以传入的实参作为起始值,函数调用结束时 ...

  9. JavaSE基础篇—MySQL基础知识点

    MySQL MySQL是一种关系数据库管理系统,是一种开源软件.可搭配PHP和Apache可以有更好的性能,也可以工作在众多的平台上.Orcale是一个数据库创建多个用户,MySQL是一个用户创建多个 ...

  10. 自动化安装DHCP配置脚本

    DHCP配置脚本: #!/bin/sh NET=192.168.6.0 MASK=255.255.255.0 RANGE="192.168.6.50 192.168.6.100" ...