Google the phrase ‘VirtualBox set up’ or similar and you’ll find plenty of guides that will instruct you on the install of a Virtual Machine (VM) with the network adapter set to either NAT or Bridged. While these options work fine, as a web developer you are quick to realise their limitations. So what does a web developer need from their VM networking set up? Simple:
- To simply and consistently connect to the guest VM from the host, and
- To connect to the Internet, remote servers and web applications from the guest VM with the same ease as the host.
Once a VM has been installed, the first goal can be expanded into some real world use cases:
- To immediately be able to SSH into the guest machine from a terminal to configure the environment.
- To connect to another port on the guest VM via an SSH tunnel, i.e. to administer MySQL from a GUI client.
- To request web sites running in the VM through the host’s web browser on the HTTP and HTTPS ports.
- To be able to connect to any other port which maybe required. For example, my VMs run Zend Server so I need to connect over HTTPS on port 10082.
- To be able to connect to the guest VM regardless of my location or the network I’m connected to.
- To set this up once and not have to worry about a guest VM having different IP addresses every now and again.
As for the second goal, the following use cases should be met:
- To immediately be able to connect to the Internet and perform system updates and software installs from the guest VM.
- To be able to piggy back on a host’s private VPN connection.
- To have exactly the same ACL rules as the host when connecting to remote servers or services.
So which network adapter satisfies all of the above use cases? NAT or bridged?