I am trying to get an old version of Ubuntu (12.04) to connect to a VPN, as a guest in VirtualBox. I have to use that old version of Ubuntu to build some software, and want to avoid upgrading as it's a massive amount of effort to built it on current versions. The VPN requires a recent version of OpenVPN, and I have been unable to get the current version to work on Ubuntu 12.
Host: Windows 10 VPN: OpenVPN Connect on host
I have two network adapters in the virtual machine:
eth0
- Bridged adapter, gets a local LAN IP address via DHCP. I can access the VM over VNC on this interface, and access the internet.
eth1
- NAT adapter, gets an IP address if 10.0.3.15
. I don't know where this comes from, the VPN's DHCP hands out addresses in the 172.31.5.x range.
I have tried:
VBoxManage modifyvm <uuid or name here> --natdnshostresolver1 on
(Use Host VPN in Guest VM)
(Connecting Ubuntu VM to VPN)
(VirtualBox networking for both VPN and internet)
I also tried:
sudo route add -net 172.31.0.0 netmask 255.255.0.0 gw 10.0.3.1 eth1
(Setting up networking on Virtualbox Guest to access Host VPN)
(Now to connect to a VirtualBox guest OS through a VPN?)
Of course that won't work because the 10.0.3.1
address is not being handed out by the DHCP server, it's a private address that seems to be used as a default for interfaces with no assigned address. Maybe something that VirtualBox assigns?
There are a few other similar questions, but they all have answers that are basically the same as the above.
I also tried setting the adapter to bridged mode, with the TAP adapter created by OpenVPN Connect. The interface does not get an IP address from DHCP.
For reference the Windows side VPN gets
IP address 172.31.5.9
Netmask 255.255.255.0
No gateway or DNS servers
WINS severs 172.31.1.2
and 172.31.1.12