vmware中redhat5虚拟机无法连接网络问题的解决
环境:VMWare10,Radhat Enterprise 5.8,虚拟机网络采用网桥连接方式.
问题:虚拟机中的rehl5无法连接网络
无法访问网络:ping baidu.com
返回:ping: unknown host www.baidu.com
原因:无法动态获取IP:
[[email protected] ~]# ifconfig:eth0的IP显示的是IPv6
[[email protected] ~]# service network restart
返回:Dertermining IP information for eth0....failed
解决方法:
1、在/etc/sysconfig/network-scripts/ifcfg-eth0中添加以下script:
check_link_down(){
return 1;
}
以我虚拟机中的文件为例:
[[email protected] ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:0C:29:93:C0:95
ONBOOT=yes
check_link_down(){
return 1;
}
#保存退出
2、重启eth0:
[[email protected] ~]# ifdown eth0
[[email protected] ~]# ifup eth0
3、测试(现在就能正常联网了)
[[email protected] ~]# ping baidu.com
PING baidu.com (123.125.114.144) 56(84) bytes of data.
64 bytes from 123.125.114.144: icmp_seq=1 ttl=51 time=25.6 ms
64 bytes from 123.125.114.144: icmp_seq=2 ttl=51 time=27.6 ms
64 bytes from 123.125.114.144: icmp_seq=3 ttl=51 time=25.5 ms
--- baidu.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2005ms
rtt min/avg/max/mdev = 25.514/26.270/27.604/0.955 ms
[[email protected] ~]#
有点疑惑的是:之后删除先前添加的脚本也可以正常访问网络了...
参考文档:
Determining IP Information for eth0...faileda