The VM Networking choas: virtualbox and vmware, NAT and bridged

admin's picture

Virtual machine networking seems more complicated than it needs to be. What I want generally is to:

  • run a dev VM on my local machine and/or nearby server (same LAN segment)
  • access the VM via SSH, HTTP and Samba from my local machine
  • access the outside world from the VM
  • keep it secure

On VMware, that's nice and straightforward. The answer is NAT. NAT basically sets up your host machine as a DHCP server on its own subnet. Every guest VM gets allocated an address, and you can access that via any port, so long as the VM's firewall allows it.

On Virtualbox, the story is not so simple. NAT blocks all the ports of a VM, and while they can be exposed using port forwarding, that gives you access to a host port that's forward to a VM port, not access to the VM port itself. Host-only networking is closer, in that the host machine is given access to the VM ports, but the VM itself has no external access. I can't ping google anymore. Now it's possible to setup a dual adaptor config, where the VM gets external access from one adaptor on NAT and the host gets VM access through the second adaptor configured to host-only. It's not ideal and breaks the Virtualbox-VMware symmetry that we aim for with our VMs. The point of devopera VMs after all is to make life simple. The only option for Virutalbox is to use Bridged networking, which means the VM registers itself on the same network segment as the host. Just make sure your host's network is well firewalled.

The compromise then is to use two different networking connections, one for VMware and one for the surly Virtualbox. That's the reason you'll notice that all our VMs feature a Virtualbox config (.vbox file) that's setup to use Bridged networking, and a VMware config (.vmx file) that's setup for NAT.

If necessity is the mother of invention, then compromise is it's step father, but bear in mind that once you download one of our free development or staging VMs, you can make whatever changes to its internal and external network config you like. Ah, the joys of open source.

Recent Articles

published 3 years 1 month ago

Site

Follow Us

Twitter icon
Facebook icon
LinkedIn icon
SlideShare icon
YouTube icon
RSS icon