Need to setup 2nd NIC and route it's traffic thru Virtualbox guest OS
I followed a tutorial and have a setup that routes all Virtualbox traffic through TOR. I use Ubuntu 10.04 as both guest and host.
Now I'd like to connect an additional physical device with a second network card and route it's traffic through the guest OS so that it is anonymous as well.
I've done some searching and can't find anything (that I can understand as a novice) that would guide me through this. I've looked at many articles that talk about setting up Linux as a router, but none seem to fit my particular needs.
My bridge interface in /etc/network/interfaces looks like this:
# VirtualBox NAT bridge
iface vnet0 inet static
up iptables -t nat -I POSTROUTING -s 172.16.0.0/24 -j MASQUERADE
down iptables -t nat -D POSTROUTING -s 172.16.0.0/24 -j MASQUERADE
/etc/dnsmasq.conf includes this:
/etc/tor/torrc includes this:
Lastly, there is a new file middlebox.sh that looks like this:
# destinations you don't want routed through Tor
# Tor's TransPort
# your internal interface
iptables -t nat -F
for NET in $NON_TOR; do
iptables -t nat -A PREROUTING -i $INT_IF -d $NET -j RETURN
iptables -t nat -A PREROUTING -i $INT_IF -p udp --dport 53 -j REDIRECT --to-ports 53
iptables -t nat -A PREROUTING -i $INT_IF -p tcp --syn -j REDIRECT --to-ports $TRANS_PORT
Once TOR is restarted and middlebox.sh is run, it works perfectly.
Again this is NOT my work and I'm totally unqualified to modify it to route a second NIC through the VM without screwing it up royally.
Right now the HM shows it's connected to eth1 and the VM shows eth0.
I haven't yet physically installed the 2nd NIC, but presumably it will be eth2.
Binary Code is as easy as 1, 10, 11
AMD X26000+, Asus M3N78-EM, 6 GB DDR2 800MHZ RAM