How can I make VirtualBox guests share the host's VPN connection?
For VirtualBox with windows host and linux(mint) guest, go to the Network UI tab and set for "Adapter" => "Attached to : NAT" and "Adapter type : Paravirtualized network". After that start your VM and you should be able to use VPN network.
This will not work in a Bridged Networking setup. From the VirtualBox documentation:
Bridged networking
This is for more advanced networking needs such as network simulations and running servers in a guest. When enabled, VirtualBox connects to one of your installed network cards and exchanges network packets directly, circumventing your host operating system's network stack.
Since your virtual machines are using eth0
directly, they are unaware of the tun0
interface to the tunnel running over it. You will need to use a different virtual networking configuration.
You have (among others) these options:
Network Address Translation (NAT) is by far the simplest solution. VirtualBox will NAT the VMs across whatever internet connection is available to the host. This is fully transparent to the VMs. However this precludes connections from the host to the VMs or connections between the VMs.
Use Host-only Networking to create a proper subnet containing the VMs and the host. This will require no changes in the interface configuration you now have in the VMs, but you will need to set up the host to be the gateway and router, and make it NAT the VMs to the outside (whether across its
eth0
ortun0
).Combine the above: give each VM two interfaces, one gatewaying to the outside world (across VirtualBox's NAT) and the other attached to the Host-Only LAN.
Try VirtualBox's experimental NAT Networking configuration. Update 2019: this feature has since matured: attach to the host's NAT and choose the Paravirtualized network (virtio-net) adapter type.
After looking for this solution everywhere, I finally found a working solution that doesn't require a lot of configuration changes and is really simple. Use the default NAT network and type this in the terminal:
VBoxManage modifyvm "VM name" --natdnsproxy1 on
source: https://www.virtualbox.org/ticket/13993