I'm using Vagrant to deploy a large virtual network environment for testing out some applications and network activity. I'm using host-only networking so I can define all the IP addresses in my Vagrantfile, but one of the applications I'm required to use for testing is an external appliance that cannot run as a virtual machine.

So, I'm wondering if it's possible to route traffic incoming to the host machine destined for the host-only LAN. I know this goes against the idea of host-only networking, but I cannot use bridged networking in this case because Vagrant isn't able to set static IP addresses on bridged guest interfaces.

I've tried the following:

  1. Added route on appliance telling it to use external IP address of VirtualBox host as the gateway for any traffic destined for the host-only LAN.
  2. Turned on IP forwarding on VirtualBox host
  3. Added route on VirtualBox host to forward any traffic destined for the host-only LAN to the vboxnet0 interface.
  4. Tried pinging one of the VirtualBox guests on the host-only LAN from the external appliance -- no success.

Any ideas if this is at all possible?


It might be worth noting that I can ping the IP address of the host-only interface on the VirtualBox host (interface vboxnet0) from the external appliance.

  • dumb i know, but you've made sure the virtual guest has no firewall in place ?
    – Sirex
    Dec 2, 2012 at 18:47
  • Step 3 looks wrong to me. You want to set the default gateway to be the vboxnet0 interface, not just the stuff for the host-only lan.
    – Sirex
    Dec 2, 2012 at 18:48
  • @Sirex - yes sir, I have made sure the virtual gues has its firewall turned off. I can ping the virtual guest from the host, but not from the external appliance. As for step 3, if I set the VirtualBox host's default gateway to be the host-only LAN, then it will not be able to get out to any other network...
    – Bryan
    Dec 2, 2012 at 18:49
  • @Sirex - your second comment just opened my eyes to something... I needed to add a route to the virtual guest in order for it to be able to route response packets to the external LAN my appliance is on. Once I did that, I was able to communicate. :-)
    – Bryan
    Dec 2, 2012 at 18:53
  • Even with a default gateway on the guest of the host-only adaptor on the host it should be able to, because ip-forwarding is enabled on the host. Whatever works though :-)
    – Sirex
    Dec 2, 2012 at 19:13

1 Answer 1


Turns out I forgot a step... I needed to add a route to the virtual guest telling it how to get to the external LAN my appliance is sitting on via the IP address of the vboxnet0 interface on the VirtualBox host. Once I did this, I was able to communicate with it externally.

thanks @Sirex for commenting on my question enough to make me think about it more!

  • Feel free to accept your own answer. (Question found after Community bumped it to the front page. That is a bot who does that a few times per day for unsolved questions).
    – Hennes
    Sep 10, 2013 at 21:54
  • 1
    Could we see an example on how you did it exactly ? I think I understand but cannot figure it out myself.
    – Dolanor
    Aug 10, 2014 at 21:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .