-
Bridging networks in VM
I am using BT5 in VirtualBox on my Win7 laptop, and would like to bridge/forward my wifi to my ethernet port (so my 2nd device works as if it is plugged directly into the router) and perform some tests using tcpdump, tc, etc. I need this to work within a VM rather than livebooting as I will be utilizing some Win7 features simultaneously.
Code:
Setup:
[Win7 Laptop]
| |
[BT5 VM]
| |
[eth0]--[eth1]
| |
[WiFi] [Ethernet Port]
| |
[Internet] [Device 2]
Within my VM, I've tried using "brctl" to form a bridge (br0), but I lose internet connectivity every time I add eth0 to br0. I've also tried using iptables to forward eth0 to eth1 however I do not know that I am doing this correctly. This is what I have tried so far (separately):
Code:
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
ifconfig br0 up
Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
Neither example works. I am fairly new to linux but I am always trying to learn new things, how computers & networking works, etc, but I have never had the opportunity to go to school for this so I'm sure I'm missing something somewhere. Any help would be greatly appreciated!
BT5R3 GNOME32
VirtualBox Adapter 1: Bridged Adapter (wifi card)
VirtualBox Adapter 2: Bridged Adapter (ethernet port)