4
1
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:
- 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.
- Turned on IP forwarding on VirtualBox host
- Added route on VirtualBox host to forward any traffic destined for the host-only LAN to the vboxnet0 interface.
- 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.
dumb i know, but you've made sure the virtual guest has no firewall in place ? – Sirex – 2012-12-02T18:47:08.360
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 – 2012-12-02T18:48:30.857
@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 – 2012-12-02T18:49:03.150
@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 – 2012-12-02T18:53:19.973
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 – 2012-12-02T19:13:25.160