VMWare on Ubuntu Linux with bridged network to XP

23 August 2007

XP on Linux

I run Ubuntu on my main machine, but needed Windows for a project for one of my clients. I installed the free VMWare Server from the Ubuntu commercial repository and installed Windows XP Pro on a virtual machine.

VMWare networking modes

There are three different networking modes in VMWare to give the virtual machine network access:

Host-only
A private network between the host and VM. The VM can’t be accessed by other machines on the network.
NAT
The VM shares the IP address of the host.
Bridged
The VM has its own IP address and can be accessed by the host and other machines on the network as if it was a separate box.

I wanted to keep my virtual Windows box as isolated as possible for security reasons – Windows boxes get compromised so easily. I used bridged networking to give the virtual machine its own IP address and blocked outgoing Internet access for that machine on my router firewall.

Networking problems with Samba/SMB

I wanted to share files between the Linux host and the Windows virtual machine. I used Samba on Linux to share some directories then tried to connect to them from the Windows VM. It couldn’t connect and just timed out without a helpful error message.

After messing with Samba for a while and reading the VMWare Samba docs I was no further forward. I tried using IE on Windows to connect to the web server on my Linux box. No dice. It timed out as well.

It’s the network card settings

I read some discussion in the VMWare forums about similar problems using bridged networking, but working fine with NAT.

This led to the answer on Launchpad – the problem was the network card. Apparently some network cards optimise by discarding packets they have already seen. Because the networking is effectively between two machines on the same network card, some of the data was getting lost.

The solution is to disable these settings on the Ethernet card using:

ethtool -K eth0 sg off rx off tx off

or

ethtool -K eth0 sg off rx off tx off tso off

depending on the settings supported by your network card.

I ran this command and it worked immediately. Note that when you reboot you will need to issue this command again. You could add it to /etc/rc.local or similar to have it issued automatically.

Filed under: Linux,VMWare — Scott @ 1:18 pm

10 Comments »

  1. I’m having the same problem only the other way. I have a XP that has a vmware ubuntu on it. do know how to do this in XP?

    Comment by Goggi — 16 June 2008 @ 10:50 am

  2. Hi Goggi.

    I’ve never used VMWare on Windows, but searching around it seems you want to disable “checksum offloading”.

    There might be a tickbox in the network advanced config, or you might need a registry hack like in this article:
    http://searchwincomputing.techtarget.com/tip/0,289483,sid68_gci1229235,00.html

    Comment by Scott — 16 June 2008 @ 2:37 pm

  3. Found a the problem in DHCP in the connection. Thanks for the help.

    Comment by Goggi — 26 June 2008 @ 5:27 pm

  4. Great,

    ethtool -K eth0 sg off rx off tx off

    Works Great, I was able to use VMWare on Nvidia Network Card

    Thankx a lot for a great tip !

    Comment by Avonek — 2 July 2008 @ 5:54 pm

  5. This worked great! Thank you. I was poor network performance to my VMs from client PCs. And my ping rates would go every which way up and down on the vms, but the actual network card on the server would get a 1ms ping each and every time when pinging the host os. Running this command on my PowerEdge 2900 did the job! Thanks!

    Comment by Stuart Urbahns — 30 August 2008 @ 9:44 pm

  6. Check the state of the physical link to the physical switch. if the port thinks the real cable is disconnected then the Bridge (virtual) does not turn on.

    Comment by Gordon — 20 February 2009 @ 7:54 am

  7. Wow thanks! I wasn’t able to install .NET 3.5 SP1 without this setting – it kept trying to reconnect.

    I love you! :D

    Comment by Nilzor — 28 March 2009 @ 11:09 am

  8. Hello,

    I am still having a problem with my VM.
    I am having 2 Win2K3 VMs running on VMWare on XP (VMWare used is either Server console or workstation or VMWare player)
    Once the first Win2K3 boots up and gets connected to the bridged network, if I boot the next one, inside the OS the network comes up, but all the ping packets show 100% loss to any IP in the network. I have static IP for the VMs.

    I am using a wireless pci card “Belkin Wireless G Desktop Card”.
    Please help!!

    Thanks

    Comment by Krishna — 27 May 2009 @ 3:23 am

  9. Many thanks: XP client, bridged mode Debian lenny on Intel chipset and this fixed uber slow network performance instantly.

    Now its no worse than a native XP machine (i.e. horrible, but there you go!)

    Comment by Leo Smith — 17 June 2009 @ 2:22 pm

  10. Thanks mate! had a similar problem with a CentOS VM on a CentOS host being able to ping the outside world but if you tried to access the web from the VM (or the webserver on the VM from beyond the host) it just timed out. Spent several days trying to fix this before finding your page, the ethtool command worked perfectly and fixed the problem for me :)

    Comment by Ewan — 6 January 2012 @ 12:20 pm

RSS feed for comments on this post.

Leave a comment