Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

EDIT:

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.

share|improve this question
    
dumb i know, but you've made sure the virtual guest has no firewall in place ? –  Sirex Dec 2 '12 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 '12 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 '12 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 '12 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 '12 at 19:13

1 Answer 1

up vote 1 down vote accepted

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!

share|improve this answer
    
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 '13 at 21:54
    
Could we see an example on how you did it exactly ? I think I understand but cannot figure it out myself. –  Dolanor Aug 10 at 21:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.