Are you worried about online privacy? Perhaps you’re concerned with protecting your personal information from online marketers and advertisers who may want to use your data without your permission or sell your information to a third party. Regardless of your motivations, the Tor network is one of the most popular ways to avoid all forms of online surveillance. You will learn here how to set up a Tor proxy on Raspberry Pi and use it to automatically route your traffic via Tor every time you connect to your home network.
What is a Tor proxy server?
A proxy server acts as an intermediary for clients that are requesting resources from a server, such as a file or website.
When you set up a Tor proxy server, all of your traffic gets redirected via the Tor network. Every packet of data that you send via Tor is encrypted and decrypted multiple times and redirected through several relays that are randomly selected from the thousands of relays that make up the Tor network. This way, you can conceal your location and activity from anyone who may be watching the network. This includes concealing the websites you visit, the messages you send, and any posts you make.
Many people access Tor via the free Tor browser, but this requires you to set up the browser on every single device where you access the Internet. If you want to use the Tor network across all your devices or surf the Web anonymously using your existing web browser, then it’s often easier to simply set up a Tor proxy server, which is what you will learn in this tutorial.
What you’ll need
To complete this tutorial, you’ll need:
- Raspberry Pi that’s running Raspberry Pi OS
- Power cable that’s compatible with your Raspberry Pi.
- External keyboard and a way to attach it to your Raspberry Pi
- HDMI or micro HDMI cable, depending on your model of Raspberry Pi
- External monitor
- Ethernet cable if not connecting over Wi-Fi
Getting started: set up your Raspberry Pi
To start, connect all the peripherals to your Raspberry Pi.
Once your Raspberry Pi has booted, click the little network icon in the toolbar and connect to your Wi-Fi network if you’re not using an Ethernet cable.
Before you begin, it’s a good idea to check that you’re running the latest version of Raspberry Pi OS. Open the Terminal and type the following command:
If it does install one or more updates, then reboot your Raspberry Pi by running the following command:
Install Tor on your Raspberry Pi
You can install Tor using a single Terminal command:
You’ll now have two new services running on your Raspberry Pi: tor.service and email@example.com.
The “tor” service is merely a dummy service that only appears active. To check that the real tor@default service is running, use the following Terminal command:
If the Terminal returns an “active” message, you’re ready to move on to the next step.
Configure your Tor proxy server
Set up your proxy server by making some changes to Tor’s configuration file. Before editing this “torr” file, it’s a good idea to create a backup:
Now that you have a backup, create a simple configuration that’ll expose the Tor Socks proxy service on port 9050 and accept connections from the local LAN.
To open the “torr” configuration file for editing, run the following command:
This file will now launch in the Nano text editor. First, specify the “SocksPort,” which is the IP address of your Raspberry Pi. You can retrieve this information by running the following Terminal command:
Take this IP address and add the port number
:9050. For example, if the Raspberry Pi’s IP address is 192.168.1.111, then add the following to the Torr configuration file:
Add the following to the Nano text editor, making sure to replace “SocksPort” with your own value:
Once you’ve made the changes, save the file by pressing the Ctrl + O and Ctrl + X to close.
To restart the Tor service with your new configuration, run the following command:
Connect to your Tor proxy from any web browser
In this final section, you’ll learn how to connect to your Raspberry Pi server, using all the major web browsers.
Note that you’ll typically connect to your Raspberry Pi using its IP address. You can retrieve this information at any point by running
hostname -I in the Raspberry Pi Terminal.
Let’s start by configuring Firefox to use your Socks proxy server:
1. In Firefox’s upper-right corner, select the three-line icon.
2. Select “Preferences.”
3. In the menu on the left, select “General.”
4. Scroll to “Network Settings” and give its accompanying “Settings…” button a click.
5. In the subsequent “Connection Settings” window, select the “Manual proxy configuration” checkbox.
6. In the “SOCKS Host” field, enter the IP address of your Raspberry Pi.
7. In “Port,” enter “9050.”
8. Make sure the “SOCKS v5” checkbox is selected.
9. Click OK.
Close and relaunch Firefox – it should now be using the Tor network!
Google Chrome (and other Chromium-based browsers)
Are you using Chrome? To point Google Chrome in the direction of your proxy server:
1. In Chrome’s upper-right corner, select the three-dot icon.
2. Select “Settings.”
3. In the menu on the left, navigate to “Advanced -> System.”
4. Select “Open your computer’s proxy settings.”
The next steps will vary, depending on your operating system.
If you’re a Mac user, then Google Chrome should have already launched your Mac’s “Network -> Proxies” menu. In this window:
- Select “SOCKS Proxy.”
- In “SOCKS Proxy Server,” enter the IP address of your Raspberry Pi.
- In the accompanying text box, enter the port number “9050.”
- Save your changes by clicking “OK -> Apply.”
Close and then relaunch Chrome. When it relaunches, it should already be using the Tor network.
If you’re on a Windows PC, then Google Chrome should have launched the “Internet Options” window. In this window:
- Select the “LAN settings” button.
- Select the following checkbox: “Use a proxy server for your LAN.”
- Click “Advanced.”
- In the “Socks” section, enter your Raspberry Pi’s IP address.
- For “Port,” enter “9050.”
- Click “Save -> Apply.”
Relaunch Google Chrome. It should now be communicating with your Tor proxy server.
If you’re using Apple’s Safari browser, then:
1. In the Safari toolbar, select “Safari -> Preferences … ”
2. Select the “Advanced” tab.
3. Find “Proxies” and select its accompanying “Change Settings … ” button.
4. In the menu on the left, select “SOCKS Proxy.”
5. In “SOCKS Proxy Server,” enter the IP address of your Raspberry Pi.
6. In the accompanying text field, enter the port number “9050.”
7. Save your changes by clicking “OK -> Apply.”
Don’t forget to relaunch Safari!
Are you really using Tor?
If you’ve followed the instructions in this article, then you should now be using the Tor network – but it never hurts to check! In the web browser that you’ve configured to use Tor, head over to the Tor website.
If you see the above message, then congratulations – you’re successfully routing all of your traffic via Tor!
You have learned in this tutorial how to transform a Raspberry Pi into a Tor proxy server. If you find this too complicated, you can install Tor browser on your USB drive and bring it wherever you go. Alternatively you can make Tor faster with these tips.
Our latest tutorials delivered straight to your inbox.