writted by woflman revised at 2007.7.9
开始学习的LINUX的表弟,在网上找了好长时间也没有把VMware 下Redhat 9 上网搞定,
现在我把最常用的方法写出来,以便新手节省一点查找时间。步骤如
1,启动虚拟机时把Ethernet 的network connection 选为NAT
2.在终端下,键入dhclient ,让VMware 的DHCP SEVER给redhat 9分配一下IP
# dhclient
Internet Systems Consortium DHCP Client V3.0.1
Copyright 2004 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/products/DHCP
Listening on LPF/eth0/00:0c:29:c2:fc:c5
Sending on LPF/eth0/00:0c:29:c2:fc:c5
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8
DHCPOFFER from 192.168.80.254
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPACK from 192.168.80.254
bound to 192.168.80.130 -- renewal in 826 seconds. ;就是这个192.168.80.130
3.如果你还想使用SSHD ,SMB .VSFTP等服务的话,最好把这个IP 固定下来。
在终端下#cd /etc/sysconfig/network-scripts/
#vi ifcfg-eth0 如果你有两个网卡的话,有可能也是ifcfg-eth1 ,请确认是哪个上外网的,
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.80.130
NETMASK=255.255.255.0
NETWORK=192.168.80.0
BROADCAST=192.168.80.255
GATEWAY=192.168.80.2
注意上面的BOOTPROTO=static
GATEWAY=192.168.80.2 这里有这个GATEWAY ,但在 #more /etc/hosts里不能再有这个GATEWAY ,这一点很重要,两都只能有一个
你的IPADDR可能不这个,不过VMware 下的NAT 的网关一般下都是
192.168.x.2请根据实际情况修改。
4。# ifdown eth0
#ifup eth0
或#service network restart
5.# ping -c 3
www.sina.com.cn
PING jupiter.sina.com.cn (218.30.66.101) 56(84) bytes of data.
64 bytes from 218.30.66.101: icmp_seq=0 ttl=128 time=47.7 ms
64 bytes from 218.30.66.101: icmp_seq=1 ttl=128 time=36.4 ms
64 bytes from 218.30.66.101: icmp_seq=2 ttl=128 time=44.0 ms
--- jupiter.sina.com.cn ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 11053ms
rtt min/avg/max/mdev = 36.453/42.766/47.791/4.723 ms, pipe 2
如果出现上面的画面,那恭喜你能上网了。