桥接网络中检查是否能够上网
在虚拟机中进行yum现在网络资源的时候,发现出现如下错误:
[root@RHEL5 ~]# ping ww.baidu.com
ping: unknown host ww.baidu.com
1、 检查网关地址
[root@RHEL5 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
HWADDR="08:00:27:3C:E8:7E"
NM_CONTROLLED="no"
ONBOOT="yes"
IPADDR=192.168.1.17
GATEWAY=192.168.1.1
注意其中的网关的单词拼写,必须是GATEWAY
2、检查域名解析文件
[root@RHEL5 ~]# cat /etc/resolv.conf
# Generated by NetworkManager
# 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
nameserver 61.139.2.69
nameserver 8.8.8.8
直接使用公网的域名解析即可
3、重启网络
[root@RHEL5 ~]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0:
4、 再次连接即可
[root@RHEL5 ~]# ping www.baidu.com
PING www.a.shifen.com (111.13.100.91) 56(84) bytes of data.
64 bytes from 111.13.100.91: icmp_seq=1 ttl=52 time=19.4 ms
64 bytes from 111.13.100.91: icmp_seq=2 ttl=52 time=19.0 ms
64 bytes from 111.13.100.91: icmp_seq=3 ttl=52 time=19.0 ms
64 bytes from 111.13.100.91: icmp_seq=4 ttl=52 time=19.6 ms