I would like to connect Ubuntu VM running in VirtualBox to VPN. I use vpnc to connect to VPN. I only managed to connect to VPN if I set VM NIC to bridged mode. However bridged mode only works if I connect host via cable to internet. What I need, is to have host connected via WiFi. When host is connected to WiFi, and guest NIC is in bridged mode, guest VM have no connection to internet (no VPN involved). I read that it may be not possible at all to use bridged mode with WiFi.

Because of this I set VM NIC to NAT. But in this case, VPN connection is not working properly. vpnc is starting properly (saying VPNC started in background), but I cannot access hosts that are in VPN network (e.g. ping reports 100% packet loss).

So I have two questions. Answering either of them would resolve the problem:

  1. Is it possible/How to use bridged mode with WiFi?
  2. Is it possible/How to connect to VPN behind NAT?

Some more info:

  • Host is Windows 7 Enterprise
  • Guest is Lubuntu 16.10
  • VirtualBox version is 5.1.28, guest addons are installed.

You should run the following command in HOST machine, then reboot your guest. Use the NAT configuration itself. If the host is connected to VPN, the guest will now use it instead of the /etc/resolv.conf in guest.

VBoxManage modifyvm "VM name" --natdnshostresolver1 on

More details here : https://www.virtualbox.org/ticket/10864

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.