How to map a VPN (tun0) network adapter on host Ubuntu to a VirtualBox guest Windows?

I met the same problem, and googled around but found no answer. at last I found my solution:

  1. in windows, open the VPN connection using VPN GUI.
  2. in VM configuration, add a new Network: Internal network.
  3. restart VM.

then I can access the resource in VM.


Setting /etc/sysctl.conf:

sysctl net.ipv4.ip_forward=1

Then running:

sudo sysctl -p

(Should not be necessary but) I rebooted after that.