在WinXPsp3(DeepInLite版本)上安装了VMware Workstation7.0,使用bridged网络模式,安装ubuntu9.10,安装完成后guest可以正常上网,host与guest可以互相ping通,但是host与guest之间却无法进行正常的网络通信,表现为:在host上无法ssh到guest(已排除guest没有启动sshd服务,及防火墙配置等问题);在guest上无法访问host的apache网页服务。
经过各种抓包测试,发现问题在路由配置上,host主机的初始路由配置如下:
===========================================================================
Interface List
0x1 ……………………… MS TCP Loopback interface
0x2 …00 1d 92 ac 74 ca …… Realtek RTL8168/8111 PCI-E Gigabit Ethernet NIC
===========================================================================
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.0.1 192.168.0.178 10
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
192.168.0.0 255.255.255.0 192.168.0.178 192.168.0.178 10
192.168.0.178 255.255.255.255 127.0.0.1 127.0.0.1 10
192.168.0.255 255.255.255.255 192.168.0.178 192.168.0.178 10
224.0.0.0 240.0.0.0 192.168.0.178 192.168.0.178 10
255.255.255.255 255.255.255.255 192.168.0.178 192.168.0.178 1
Default Gateway: 192.168.0.1
===========================================================================
Persistent Routes:
None
使用如下命令
route -p add 192.168.0.0 mask 255.255.255.0 192.168.0.1
增加添加路由(-p参数保证重启后依然有效),结果如下:
===========================================================================
Interface List
0x1 ……………………… MS TCP Loopback interface
0x2 …00 1d 92 ac 74 ca …… Realtek RTL8168/8111 PCI-E Gigabit Ethernet NIC
===========================================================================
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.0.1 192.168.0.178 10
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
192.168.0.0 255.255.255.0 192.168.0.178 192.168.0.178 10
192.168.0.0 255.255.255.0 192.168.0.1 192.168.0.178 1
192.168.0.178 255.255.255.255 127.0.0.1 127.0.0.1 10
192.168.0.255 255.255.255.255 192.168.0.178 192.168.0.178 10
224.0.0.0 240.0.0.0 192.168.0.178 192.168.0.178 10
255.255.255.255 255.255.255.255 192.168.0.178 192.168.0.178 1
Default Gateway: 192.168.0.1
===========================================================================
Persistent Routes:
None
这样,在host上就可以正常ssh连接到guest了!