08 Feb 2012

VirtualBox: slow network from Windows host to linux guest

I develop my Rails apps in Ubuntu. I run Ubuntu as a Virtual Box VM using Windows 7 as a host. For a long time I’ve had the problem that when accessing my rails apps from Windows, say to http://192.168.1.25:3000 the response was extremely slow.

Changing the network settings in VirtualBox had no effect (bridged, host only, NAT… no luck). It turns out that the problem wasn’t on Windows nor Ubuntu network configuration.

In order to fix the problem you have to change the following parameter in the Webrick config file:

~/.rvm/rubies/lib/ruby-1.9.3-p0/ruby/webrick/config.rb

    # :DoNotReverseLookUp => nil,
    :DoNotReverseLookUp => true,

Now it works as expected.

That said, this slowness has come handy a couple of times when I wanted to test how my apps behave when the network is slow.