AdSense Mobile Ad

Sunday, April 12, 2009

Bridged networking in Sun xVM VirtualBox 2.2

If you're using Sun xVM VirtualBox as your desktop virtualization platform you'll surely be familiar with the default networking options applied when you create a Virtual Machine: the default configuration applied is NAT networking.

NAT networking is surely suitable to basic networking needs (such as surfing the web) but it early shows its limitation as soon as the user tries to use not only P2P programs or VOIP clients: it also shows its limitations using Windows file sharing. I personally experienced many troubles with Windows file sharing oreven being a CIFS client from a Windows guest to a Solaris host. Not mentioning the problems I had while trying to run some propietary piece of software such as HP Solution Centers to run my little home printer. No way.

If you're curious about NAT types and NAT limitations, you can look Wikipedia NAT entry and Sun xVM VirtualBox User Guide, too. If you just want to scratch the surface, think of a host behind router: the host is the host OS and the router is VirtualBox internal NAT engine. The host can see the network through the router and the machine is unreacheable from outside the network. Opening ports on the router so that certain services could be accessible is possible but it requires configurations. Even so, VirtualBox NAT engine introduces some further limitation. Summarizing: even if it's a default zerco-conf option, I would avoid using NAT because you could run into some problems difficult to diagnose.

Bridged networking (formerly known as host networking)
The solution to this problem was formerly known as host networking which have recently been dubbed bridged networking in the recent VirtualBox releases. In the earliest VirtualBox versions this configuration required some work and even if it was pretty easy to accomplish in most guests, such as Linux or Solaris, it was undoubtely a power user configuration. On Solaris, for example, project Crossbow greatly simplified dealing with such issues: not only with VirtualBox but in every use case in which you could benefit a virtual NIC.

Sun xVM VirtualBox 2.2 has just been released and bridged networking has been greatly simplified: you can now choose that option and your guest OS will be assigned a NIC which effectively is a new network interface in software. Your guest OS will not experience any limitations and you'll be able to freely run your software as if the guest OS were a real box connected to your network. This also means that the internal DHCP server you were using with NAT configurations cannot be used and the network adapter must be configured somehow. If you are using a residential gateway with an integrated DHCP server you'll probably have no problems booting your virtual machine, being assigned an IP number and being able to use your network immediately. If you have a more complex network configuration, just configure your NIC.

I just tried this networking option on Linux (including on a wireless NIC) and on Solaris Express Community Edition build 110 and it works like a charm. Every problem I had with Subversion or with the CIFS client has disappeared without the need of creating a TAP interface (on Linux) or a VNIC (on Solaris). Easier than ever!

Enjoy!

No comments: