2010-12-16

How to fix NAT service of VMWare Server 2.0.x on Windows 7

For some weird reason NAT service of VMWare on Windows 7 does not allow VMs to access the Internet (or other computers beyond the host). It is also strange that you can ping any host and do DNS lookups, but establishing a connection is not possible.

I have got a VM running CentOS 5 and its IP configuration has been statically set, so I conclude, the whole thing should have been able to work smoothly.

[root@dev01 ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:AD:F2:ED
inet addr:10.100.8.10 Bcast:10.100.8.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fead:f2ed/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1561 errors:0 dropped:0 overruns:0 frame:0
TX packets:1128 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:162826 (159.0 KiB) TX bytes:207166 (202.3 KiB)
Interrupt:59 Base address:0x2024

[root@dev01 ~]# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.100.8.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.100.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
0.0.0.0 10.100.8.254 0.0.0.0 UG 0 0 0 eth0


And here comes the problem. The host machine is attached to a local network, which has an HTTP proxy server (192.168.1.1). What really strange to me is that I can ping the proxy, but opening a connection to it fails.

[root@dev01 ~]# ping -c 3 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=128 time=3.36 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=128 time=1.55 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=128 time=7.54 ms

[root@dev01 ~]# nc -vw 3 192.168.1.1 3128
nc: connect to 192.168.1.1 port 3128 (tcp) timed out: Operation now in progress


After googling an hour to make it work I finally found out that it is a known issue that NAT is broken if VMWare is running on Windows 7: http://communities.vmware.com/thread/206553

I followed the suggestion which is mentioned somewhere at the end of that thread, but it did not really help.

After that I had a random thought, what if I had VMnet8 bridged through my wireless network adapter, and let Windows 7 to do the NAT stuff? I have never ever seen the properties of VMnet* adapters on a Windows XP or an Ubuntu host, because they used to always work out of the box.

(1) Disable auto bridging using VMWare's Virtual Network Editor.


(2) Enable bridging through my WIFI card.



(3) After clicking OK an another window appeared and W7 told me that it had just set a new IP address to that interface through which other computers (VMs) would be connected to the Internet.


Bad news for me, because VMnet8 has been already assigned to a subnet, and all the VMs of mine are using it, so this means reconfiguring it again.


I do not clearly understand why Windows wants to use a fixed IP subnet for this purpose and why I am not allowed to pick one by myself. Never mind, it can be changed at the expense of a little registry hack.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SharedAccess\Parameters]
"ScopeAddress"="10.100.8.254"
"ScopeAddressBackup"="10.100.8.254"


After restarting VMWare NAT service it works! :)

No comments: