Working with a VirtualBox VM and a VPN

At both my current and previous job, we've used VM's as development platforms. The biggest issue surrounding these has always been getting VPN access into the VM and the host environment while preserving the connection between the VM and host, especially when the VPN client is only availble for the host OS (Windows).

The solution to this problem when using VirtualBox is to setup two network adapters.

1. NAT Adapter

The NAT adapter allows the VM to share the host OS's network connection, including any VPN's it's connected to. The downside of NAT networking is that you can't directly access the VM from the host box using the assigned IP.

2. Host-Only Adapter

That previous problem can be solved by creating a second host-only adapter. This second adapter creates a separate network with the VM and host as members. This gives you an IP address for the VM you can access from the host for testing services on the VM or mounting a Samba/NFS/SFTP share to the host.