What i want to do is:

  • have an internal network for guest systems / be able to make connections between guests inside network
  • have internet connection for guests (to download updates)
  • be able to connect to guests with ssh(linux guests)/rdp(windows guests)

My Setup is: Ubuntu oneiric host system using Virtualbox for Virtualizing some guests (linux & windows).

I setup two network adapters for each guest:

  • NAT
  • Host-only-networking vboxnet0

I'm trying to setup a openvpn server on the host system to allow connections to the host-only network vmnet0. Giving a public ip address to the guests is not an option for me, as i do not want to have this guests be public accessible and also i do not have enough ip addresses to provide to the guests.

I installed openvpn server and tried both bridging into the vboxnet0, which simply had no connectivity at all, as also using routed ip tunnel:

dev tun

with the last config i'm able to connect to the vpn server and get an internal ip address. I'm able to ping the server at but can not ping to the guest ( If i make the ping from the main server, i can ping to both addresses.

I'm not experienced with iptables, so i did not setup any rules for this, which MAY be the problem. I have tried enabling ipforwarding on the host system (sysctl -w net.ipv4.ip_forward=1), but it did not have any effect.

So my questions are:

  1. Should the openvpn setup work out of the box, or is it needed to setup some forward rules in iptables?
  2. If yes, how would the rules look like?
  3. And simply: what should i do to make it work?
  • Can you append the output of netstat -nr from your host machine? – Michael Mar 15 '12 at 19:49

Firstly, is there a reason that VirtualBox's port forwarding on NAT interfaces isn't sufficient? You could setup various ports on the host to forward to SSH and RDP ports on the VMs.

I suspect that VirtualBox doesn't allow external access to the host only network. You could try running another VM to act as the VPN server. It would also have both a NAT and host-only NICs, with a port forward on the NAT interface to accept incoming VPN traffic.

| improve this answer | |
  • This is actually exactly the config, that i ended up with! Having an extra vm with two network cards (one for NAT and one for the host-only-network) works like a charm! – Jeff May 14 '12 at 15:45

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.