1

I have Raspberry Pi 1 model B+ with Raspbian Wheezy. I bought a USB2-Ethernet adapter and decided to create hardware Tor routing. What I mean by hardware routing:

The Raspberry Pi will be in middle of a computer and a router connected to each other with Ethernet cables. USB2-Ethernet adapter spawned network interface eth1 and the normal ethernet port on the board is eth0. All traffic that comes from the eth1 (computer) should be routed through Tor. The routing should not affect the connections of the middle box. I want to be able to SSH into the middle box as well as the box behind the Tor.

To accomplish this I followed Adafruit's onion pi tutorial as well as Install software.

What I have done:

  1. Followed the instructions to setup RasPi as access point carefully, but replaced wlan0 with eth1. I didn't install hostapd but other things I did, including setting up dhcp-server, setting up eth1 for static ip and finally configuring NAT.

  2. Followed Onion pi instructions carefully.

Now the situation is as follows:

I have it set up but I cannot test it because I cannot SSH to the box behind the tor box. I planned to add some rule to middle-box's iptables so that connecting SSH to port 213 would instead route to port 22 of the box behind the tor box.

Issuing ifconfig, I get:

eth0: Inetaddr 192.168.0.104

eth1: Inetaddr 192.168.42.1

I tried adding the following rules to iptables

iptables -t nat -A PREROUTING -p tcp --dport 213 -j DNAT --to-destination 192.168.42.1:22


iptables -t nat -A POSTROUTING -p tp -d 192.168.42.1 --dport 213 -j SNAT --to-source 192.168.42.1

But now when I ssh pi@192.168.0.104 -p 213, it routes somehow to the middle box's port 22 and I login to it instead of the one behind it!

Am I doing this in a stupid way? Should I take something into consideration? Any suggestions and help needed urgently! I've been struggling with this the whole day, all examples online haven't worked for my situation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.