zoukankan      html  css  js  c++  java
  • Centos重新启动网络配置文件,/etc/resolv.conf被覆盖或清空问题解决

      Centos在执行命令 yum update时报错如下:

    Could not get metalink https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=x86_64 error was
    14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.fedoraproject.org'"
     * base: mirrors.tuna.tsinghua.edu.cn
     * epel: mirrors.tuna.tsinghua.edu.cn
     * extras: mirrors.btte.net
     * updates: mirrors.tuna.tsinghua.edu.cn

    在网上查了下,原来是DNS服务器错误,于是修改了/etc/resolv.conf文件,添加了两个nameserver:

    nameserver 8.8.8.8

    nameserver 8.8.4.4

    再重启网络,执行命令service network restart完成重启

    但还是报错,于是看了下/etc/resolv.conf文件,发现添加的nameserver没了

    原因:在文件/etc/sysconfig/network-scripts/ifcfg-eth0 中没有设置DNS server信息。
    所以重新启动网络服务自动使用/etc/sysconfig/network-scripts/ifcfg-eth0 中的设置重新设置/etc/resolv.conf,导致修改/etc/resolv.conf无效,错误重写。

    解决方案:在/etc/sysconfig/network-scripts/ifcfg-eth0 文件中添加DNS server信息,添加配置如下:

        #google域名服务器
        DNS1=8.8.8.8
        DNS2=8.8.4.4

    再重启网络,执行yum update,问题解决。

  • 相关阅读:
    maria-developers 开发者邮件
    Parallel Programming--perfbook
    面向对象设计模式中类与类关系
    binlog 轻松的找到没有及时提交的事物(infobin工具
    deeplearningbook-chinese
    Introduction to the Optimizer --cbo
    dell T420热插拔安装过程
    MySQL是如何利用索引的
    BTrace housemd TProfiler
    杨建荣的学习笔记
  • 原文地址:https://www.cnblogs.com/pqchao/p/6428947.html
Copyright © 2011-2022 走看看