Centos6.3测试机在内网使用wget 下载发现报错:"Resolving www.xxxx-xxxx.com... failed: Temporary failure in name resolution."

但是此链接是在Windows中刚刚成功下载的链接,排除是链接故障方面的原因。检查Centos 本机,发现内网网络没有问题,ping 外网报错:

[root@localhost ~]# ping www.baidu.com    
ping: unknown host www.baidu.com

接下来就修改 /etc/resolv.conf 这个配置文件,结果修改之后无论重启服务和重启电脑,/etc/resolv.conf 这个文件的内容是不变的,而且此问题权限也是644(变更过权限失败了),没法搞了,网上查询了一下,发现Centos 6.3 DNS地址需要在网卡配置文件中加入,而无需修改 /etc/resolv.conf 配置文件,修改IP配置文件之后根据你的设置生成到 /etc/resolv.conf中。

网卡配置文件:

DEVICE=eth0    
BOOTPROTO=none    
ONBOOT=yes    
TYPE=Ethernet    
IPADDR=192.168.11.173    
GATEWAY=192.168.11.1    
NETMASK=255.255.255.0    
DNS1=202.106.46.151      
DNS2=202.106.0.20

此处DNS 根据实际情况设置。

查看/etc/resolv.conf:

[root@localhost ~]# cat /etc/resolv.conf    
# Generated by NetworkManager    
nameserver 202.106.46.151      
nameserver 202.106.0.20

此处DNS与上面DNS地址是一样的。

重启网卡服务:

[root@localhost ~]# service network restart    
Shutting down interface eth0:  Device state: 3 (disconnected)    
[  OK  ]    
Shutting down loopback interface:  [  OK  ]    
Bringing up loopback interface:  [  OK  ]    
Bringing up interface eth0:  Active connection state: activated    
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/4    
[  OK  ]

使用Ping命令测试网络连通性:

[root@localhost ~]# ping www.sina.com.cn    
PING polaris.sina.com.cn (202.108.33.60) 56(84) bytes of data.    
64 bytes from 202.108.33.60: icmp_seq=7 ttl=246 time=5.24 ms    
64 bytes from 202.108.33.60: icmp_seq=8 ttl=246 time=32.8 ms    
64 bytes from 202.108.33.60: icmp_seq=9 ttl=246 time=4.92 ms    
^C