I am trying to setup a Tor Transparent Proxy and redirect all its traffic to eth1 which will act as gateway.
Network setup:
eth0 < public interface
tap0 192.168.56.1 < Tor interface
eth1 10.10.0.254 < Tor gateway interface
The idea behind it is to have tor working on tap0, then redirect all its traffic from tap0 to eth1. This is the bit I cannot get to work, I guess.
torrcs config
VirtualAddrNetworkIPv4 10.192.0.0/10
AutomapHostsSuffixes .onion,.exit
AutomapHostsOnResolve 1
TransPort 192.168.56.1:9040 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
DNSPort 192.168.56.1:5353
Log notice file /var/log/tor/notices.log
Log info file /var/log/tor/info.log
iptables rules
iptables -I FORWARD 1 -i tap0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -I FORWARD 1 -i eth1 -o tap0 -j ACCEPT
iptables -t nat -A PREROUTING -i tap0 -p udp --dport 53 -j REDIRECT --to-ports 5353
iptables -t nat -A PREROUTING -i tap0 -p tcp --syn -j REDIRECT --to-ports 9040
iptables -t nat -I POSTROUTING 1 -o tap0 -j MASQUERADE
Tor bootstraps fine, but I cannot get internet connection from neither tap0 nor eth1. I feel the issue may be with my iptables rules, but I am really not sure anymore.
torgw:~$ curl --interface tap0 ifconfig.me
curl: (7) Failed to connect to ifconfig.me port 80 after 3155 ms: Couldn't connect to server
torgw:~$ curl --interface eth1 ifconfig.me
curl: (7) Failed to connect to ifconfig.me port 80 after 3134 ms: Couldn't connect to server
torgw:~$
Any idea? Thanks