I have Windows 7 64bit Professional. On this I have installed a VirtualBox with Ubuntu Server 12.04. OpenVPN is installed on both.

I need to allow internet on Ubuntu and I also need to connect to a VPN. The Windows [Host Machine] is also connected through openVPN.

Windows has a network adapter with internet connection and receives IP through DHCP. The adapter TAP is created by openVPN.

How I can configure Ubuntu to allow internet (in and out) and you can still be connected to the VPN?

*The server openVPN is out of the network

  • Do you need Ubuntu to route over the VPN as well, or do you want that to instead route right out to the Internet instead of going over the VPN? – Thomas Ward May 26 '15 at 1:56
  • I need that Ubuntu has internet and also can connect to the VPN using VirtualBox adapters installed in Windows. – Ale May 26 '15 at 2:15
  • internet or ethernet ? – solsTiCe May 26 '15 at 2:26
  • @solsTiCe internet, the virtual machine has no problem with the ethernet. – Ale May 26 '15 at 2:37

If you use the default NAT configuration for your guest (Ubuntu) in vbox, it will use the OpenVPN connection of your host without any configuration in the guest.

However, if you use "Bridged network" for your guest in vbox, you will need to configure OpenVPN in your guest also.

  • Assuming they want data to go out via OpenVPN - if they want something different such as one to the Internet direct and one to OpenVPN it won't work. (but the NAT one will work as you state here) – Thomas Ward May 26 '15 at 2:08
  • Ok, thanks, I will try with the recommendation. – Ale May 26 '15 at 2:22
  • Follow-up: Per their comment above, they want both VPN routed and Direct-To-Network setups, which makes it even harder for them to achieve. – Thomas Ward May 26 '15 at 2:22

I need that Ubuntu has internet and also can connect to the VPN using VirtualBox adapters installed in Windows. – Ale (from comments above)

Welcome to the networking hell of VPNs and Virtual Machines. You have two things you want to achieve: You want Ubuntu to be able to go out to the internet, but to also be able to use the VPN. You have a big problem: You cannot achieve both at the same time. The nature of VPN networking is that all data gets routed through the VPN. With the VPN existing on the Windows host, that means anything going over the Windows connection via the Virtual NAT adapter will be subject to that routing as well.

You'll have to investigate the policies of the network that your Windows system is on (EXCLUDING the VPN part) to follow this recommendation, and check the compatibility of your network equipment with 'Bridged' mode in VBox, but the sorta-simplest option is to add a second virtual network adapter and hook it up to "Bridged adapter" and have that set to the network card you want to be 'acted' as (or in laymans terms, the network card which is what your host system communicates with the LAN over, so either wireless or ethernet depending on the networking method). That way, you have a non-VPN'd 'connection' via whatever the standard network is that your computer is connected to, separate from the NAT'd (VPN'd) connection.

The tricky part is this: You have to know VirtualBox enough to be able to manually disable one network connection and enable the other on the VM's hardware controls to switch between them. One would be NAT out over the Windows computer and would go over the VPN when the Windows computer is connected to the VPN. The other would be Bridged Network out onto the network that your Windows computer is connected to directly without going over the VPN. However, you have to do a lot more manual work to achieve this.

  • you can access internet with the VPN, right ? may be you mean a local LAN ? – solsTiCe May 26 '15 at 2:24
  • @solsTiCe I don't know if we can or not, the specifics of their netowrking requirements/topology are ambiguous. Their comment is such that "I need that Ubuntu has internet" and "can conect to the VPN using VBox adapters installed in Windows". It's still ambiguous what they want to actually achieve either way, and there's several ways to attack the issue at hand. Ideally they need to provide much more details about the restrictions on the network and such, permissions on the VPN (can it pass through to the INet directly or not), etc. before we can truly answer them. – Thomas Ward May 26 '15 at 2:27
  • @ThomasW. I hope to be clearer. Ubuntu is installed in a vbox, this vbox this in Windows 7. Both operating systems have openVPN, and the two operating systems connect to a remote server openVPN. Windows is not a problem, my question is, how can I make Ubuntu to connect to the VPN using adapters vbox, and also have internet? – Ale May 26 '15 at 2:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.