I recently created a TOR relay on a raspberry pi at home. It sits quietly next to my router supporting free speech and privacy and costing me nothing daily.
Here’s how I did it.
I bought a kit kinda like this that has a charger, case, some heat syncs, an SD card, and some other stuff that is needed to do much with the pi.
I don’t recommend following this step!
It is easiest to do this if you have a usb keyboard/mouse and monitor with HDMI cable. I tried before with a headless setup, and while there are instructions for that, sometimes troubleshooting is easier if you can see the pi’s homescreen.
The “Deciding to run a relay” section on the Tor Relay Guide is a great resource to understand what you are doing and why.
Plug it in to let it boot up if you’re not sure. If it doesn’t boot up, you’ll probably need to write an OS to your SD card.
Here are instructions on installing the OS, which you can make CLI only/headless later if you want.
If you would perfer a minimal installation, the first part of this Headless tutorial will show you how to install the minimal OS if you’re interested in that route. The rest of these instructions can also be followed using SSH on the cli.
This is important for port forwarding, or how your going to get the TOR traffic through your router and to the raspberry pi. Here are instructions on setting up a static IP on the raspberry pi’s OK.
Make sure you are reserving the IP for your raspberry pi on your router. I had an issue with this. This will be different on different routers, so you should just google ‘reserve static ip’ for your particular router model.
Also make sure to test your internet connection after this step by opening a webpage, running
ping google.com, or something else.
This will again be different for different routers, so google ‘port forwarding’ for your router model.
You could just follow the official Tor documentation, but these scripts set up several other things for you like updating your system, ensuring automatic updates, and configuring the ports. Make sure you read through the
bootstrap.sh after you clone that repo so that you exactly know what you are executing on your pi.
Make sure you follow the instructiosn about limiting the bandwidth, or the relay may take up all your bandwidth and make your network slow. The default settings already limit the bandwidth, but you may want to follow the instructions on the scripts page to customize it for your connection.
Note: the address you add to the torrc file is published, so I used a Firefox relay address instead of my main address.
tail /var/log/tor/notices.log, you should see
Self-testing indicates your ORPort is reachable from the outside. Excellent. Publishing server descriptor.
If you see another message, the service may still be coming up. If you see a notice that it can’t reach the ports, then there is probably an issue with your port forwarding.
You can use Tor Nyx to monitor Tor. In order for it to work, you’ll need to add this to your
And you’ll need to add your logged in user to the debian-tor group:
sudo usermod -a -G debian-tor your_default_user
getent group debian-tor to make sure the user is showing up in the groups. You will need to restart tor and possibly log in and out of the user.
In about 3 hours, your relay should be listed in the registry. In the Relay Search, you can search by ip or nickname of your node.
Set up SSH on the raspberry pi so you can access it using
ssh pi@<static ip address> from a terminal on your computer
When I was done, I also went into the raspberry pi settings and switched it to boot up to CLI instead of desktop, since I will be running it without a monitor from now on.rap
And that’s it. I hope you try it out! Happy Torring!