如何将主机 Ubuntu 上的 VPN (tun0) 网络适配器映射到 VirtualBox 来宾 Windows?

Mas*_*mom 7 virtualbox networking

我有一个运行 Oracle VirtualBox 3.2.6 和 Windows XP 来宾的 Ubuntu 10.04。我使用了一个希望被来宾 VM 访问的 VPN,在 ifconfig 上它显示为:

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:5.192.10.99  P-t-P:5.192.10.99  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1362  Metric:1
          RX packets:14151 errors:0 dropped:0 overruns:0 frame:0
          TX packets:19860 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:4415271 (4.4 MB)  TX bytes:17949982 (17.9 MB)
Run Code Online (Sandbox Code Playgroud)

在 VM 上使用 NAT 或桥接适配器只会给我非 vpn 适配器。如何将 tun0 适配器映射到 VirtualBox?

Mas*_*mom 2

环境/etc/sysctl.conf

sysctl net.ipv4.ip_forward=1
Run Code Online (Sandbox Code Playgroud)

然后运行:

sudo sysctl -p
Run Code Online (Sandbox Code Playgroud)

(应该不是必要的,但是)之后我重新启动了。