在执行 yum install gcc 时 发现下载失败

ping www.baidu.com

ping 不通

ping 百度的IP:220.181.111.188却能ping 通

由此证明是DNS的问题

百度后查到设置DNS 需要运行命令:vi /etc/resolv.conf

添加:

nameserver 192.168.0.1

nameserver 192.168.0.1

然而运行vi /etc/resolv.conf后提示:

# Generated by NetworkManager
search An

# No nameservers found; try putting DNS servers into your
# ifcfg
files in /etc/sysconfig/network-scripts like so:
#
#
DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com
bar.foo.com

于是运行 vi /etc/sysconfig/network-scripts/ifcfg-eth0

添加

DNS1=192.168.0.1
 DNS2=192.168.0.1
 DOMAIN=lab.foo.com
bar.foo.com

运行service network restart

发现还是ping 不通

运行 vi /etc/resolv.conf
发现添加的nameserver 丢失

网络搜索后找到解决方案:

1、#Remove network Manager from startup service

chkconfig NetworkManager off

2、#Add Default Net Manager

chkconfig network on

3、Stop NetworkManager first

service NetworkManager stop

4、#and then start Default Manager

service network start

5、#restart network

service network restart

重新配置DNS配置文件 重启网络

ping www.baidu.com

成功

本文参考http://wenku.baidu.com/link?url=HdeBL7k6lihJId-zQwmIHw5mKswm4d7lS8P-YRHb7IgBpKYlRMXNVO5sFxgDS7BgwRN9v2iX5a5C9NbgMqQ0DTJPSH1CIb47_VqzxRdUhcW

Linux DNS 设置失败的更多相关文章

  1. linux下dns设置详解

    DNS就是Domain Name System,它能够把形如www.21php.com这样的域名转换为211.152.50.35这样的IP地址;没有DNS,浏览21php.com这个网站时,就必须用2 ...

  2. linux下设置ip地址 gw网关,dns的方法

    本文介绍下,在linux中设置IP地址.网关.dns的方法,有需要的朋友作个参考吧.   设置linux网络的方法有两种:第一种:使用命令修改(直接即时生效) 复制代码代码示例: ip and net ...

  3. LINUX的DNS设置【转】

    网卡DNS设置 用windos系统大家都知道,本地连接里面有一个DNS设置. 那么这个选项对应Linux系统的话就是在网卡配置文件,通过编辑vi  /etc/sysconfig/network-scr ...

  4. linux 虚拟机设置好固定ip 修改了 dns 网络需要设置成桥接模式

    linux  虚拟机设置好固定ip 修改了 dns  网络需要设置成桥接模式  可以修复网络连接(浏览器返回 server not  found)

  5. Linux如何设置dns

    首先打开dns设置文档 空的dns文档如图所示 键入图片中的文本保存即可设置了自己的dns 保存后推出即可.

  6. 在linux中设置静态ip地址

    在linux中设置静态ip地址1.在终端中输入:vi /etc/sysconfig/network-scripts/ifcfg-eth0 2.开始编辑,填写ip地址.子网掩码.网关.DNS等[root ...

  7. 第一种SUSE Linux IP设置方法

    第一种SUSE Linux IP设置方法ifconfig eth0 192.168.1.22 netmask 255.255.255.0 uproute add default gw 192.168. ...

  8. Linux SendMail发送邮件失败诊断案例(三)

    一Linux服务器突然发送不出邮件,检查了很多地方都没有发现异常,检查/var/log/maillog发现如下具体信息: Apr 12 00:36:04 mylinux sendmail[4685]: ...

  9. Python编写的Linux网络设置脚本,Debian Wheezy上测试通过

    hon编写的Linux网络设置脚本,Debian Wheezy上测试通过       阿里百川梦想创业大赛,500万创投寻找最赞的APP 技术细节参见Linux网络设置高级指南 注意事项参见程序注释 ...

随机推荐

  1. windows7下硬盘安装ubuntu14.04

    windows7 ubuntu1404双系统 准备软件 安装步骤 step 1 step 2 step 3 step 4 windows7 + ubuntu14.04双系统 准备软件 1)grub4d ...

  2. air写文件 SecurityError: fileWriteResource 时报错的解决方法

    用 File.applicationDerectoryPath.resolv("text.txt")会报SecuriyError错误! 解决: var _Path:File = F ...

  3. 启动和启动和停止MySQL服务停止MySQL服务

    1.  启动MySQL服务 启动MySQL服务的命令为: /etc/init.d/mysqld start 命令执行后如图7-5所示,表示启动MySQL服务成功.   (点击查看大图)图7-5  启动 ...

  4. error “base class has incomplete type”

    error "base class has incomplete type" 如果base.h是你的基类,那么在子类derive中,写成如下形式: class base; clas ...

  5. Hibernate: Truly Understanding the Second-Level and Query Caches--reference

    I've written multiple articles here at Javalobby on the Hibernate O/R mapping tool, and they are usu ...

  6. Android,使用Intent或Bundle传递参数,跳转页面。

    (1)使用Intent跳转页面: 第一个activity:MainActivity.java中: Intent myIntent = new Intent(); myIntent.putExtra(& ...

  7. NekoHTML and Dom4j

    http://pro.ctlok.com/2010/07/java-read-html-dom4j-nekohtml.html package com.ctlok.pro; import java.i ...

  8. Linux清空内存缓存

    > /proc/sys/vm/drop_caches

  9. matrix computing optimization schemes

    * stackoverflow: how does BLAS get such extern performance * Howto optimizate GEMM http://wiki.cs.ut ...

  10. 虚拟机CentOS联网相关配置

    CentOS 用ifconfig命令,只有lo,没有eth0的解决方案 如果ifconfig -a 也没发现eth0则拷贝lo自己造一个,CentOS7 命令为 ip addr 1.配置虚拟机如下图: ...