您的位置:首页 > 运维架构 > Linux

windows下的vmware安装linux上网问题-已测试通过

2009-11-06 15:38 666 查看
一.真实主机配置与设置
前提条件:公司是通过IP、MAC地址映射的方式来访问网络的。
网关:192.168.10.1
以下两组IP,MAC可以访问外网
1.
IP:192.168.10.232
MAC: 00-0B-2F-1A-51-95
2.
IP:192.168.10.175
MAC:00-28-27-AB-56-28

配置:
Windows XP ,一张网卡
网卡设置:
C:/Documents and Settings/Administrator> ipconfig -all
Ethernet adapter 本地连接:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Realtek RTL8169/8110 Family Gigabit
Ethernet NIC
Physical Address. . . . . . . . . : 00-0B-2F-1A-51-95
Dhcp Enabled. . . . . . . . . . . : No
IP Address. . . . . . . . . . . . : 192.168.10.232
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.10.1
DNS Servers . . . . . . . . . . . : 202.96.128.166
202.96.134.133

此时windows可以访问外网。


二、vmware的配置和设置
配置:
安装了redhat9操作系统
设置:
Vmware菜单 VMàSettingsàHardwareàEthernet在右边的Network conection选择
Bridged:Connected directly to the physical network
Vmware的其他设置最好不要修改。
修改linux的配置文件:
1.
/etc/sysconfig/network :
NETWORKING=yes

HOSTNAME=localhost.localdomain

2.
/etc/sysconfig/network-scripts/ifcfg-eth0 :
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
BROADCAST=192.168.10.255
IPADDR=192.168.10.175
GATEWAY=192.168.10.1
NETMASK=255.255.255.0
#NETWORK=192.168.10.1
#MACADDR=00:0B:2F:1A:51:95

MACADDR=00:28:27:ab:56:28

3.
/etc/resolv.conf :
nameserver 202.96.128.166
nameserver 202.96.134.133

上面文件配置好后重启linux。

这时候执行命令:
#route
如果没有default网关,那么用以下命令添加:
#route add default gw x.x.x.x
#ping 192.168.10.1

三、测试一下
[root@localhost root]# ping 192.168.10.1
PING 192.168.10.1 (192.168.10.1) 56(84) bytes of data.
64 bytes from 192.168.10.1: icmp_seq=1 ttl=64 time=9.28 ms
64 bytes from 192.168.10.1: icmp_seq=2 ttl=64 time=1.40 ms
64 bytes from 192.168.10.1: icmp_seq=3 ttl=64 time=1.74 ms
64 bytes from 192.168.10.1: icmp_seq=4 ttl=64 time=0.980 ms
64 bytes from 192.168.10.1: icmp_seq=5 ttl=64 time=1.42 ms

--- 192.168.10.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4041ms
rtt min/avg/max/mdev = 0.980/2.967/9.284/3.168 ms
[root@localhost root]# ping 124.42.50.10
PING 124.42.50.10 (124.42.50.10) 56(84) bytes of data.
64 bytes from 124.42.50.10: icmp_seq=1 ttl=49 time=173 ms
64 bytes from 124.42.50.10: icmp_seq=2 ttl=49 time=304 ms
64 bytes from 124.42.50.10: icmp_seq=3 ttl=49 time=380 ms




如果ping不通这先执行
#ifconfig eth0 x.x.x.x up
然后再ping
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: