VM Gateway

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
Post Reply
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

VM Gateway

Post by 01000101 »

As this is the forum to talk about implementing new functions, I'm a bit stuck on both the design AND implementation. I have been writing ethernet drivers that can be tested in QEMU, VMware VS2, and VirtualBox-OSE. I now want to make a gateway for the host OS so that when the user of the host tries to access the internet it has to pass through the VM first. This would allow me to use the VM (with a custom OS) to filter packets for easy testing.

My current setups use a ethernet bridge (br0 for VirtualBox) or a tap/tun (tun0) device (in QEMU). I can't figure out how to connect the host to "one side' and have the "other side" connected to the real gateway (router). Any ideas?
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: VM Gateway

Post by Kevin »

I would try to do just the same as with real hardware. The VM gets two NICs, say tap0 for local connections and tap1 for the real network. In the host you would put tap1 and eth0 into the same bridge, so the VM is connected to the internet. The default route needs to be changed from eth0 to tap0, so all IP packets of the host go to the VM first.

I won't guarantee that this actually works though. ;)
Developer of tyndur - community OS of Lowlevel (German)
Post Reply