Family Encyclopedia >> Electronics

How to configure a Tor proxy with Raspberry Pi

<

div class=”entry-content” itemprop=”text”>

Are you worried about online privacy? Maybe you want to protect your personal information from online marketers and advertisers who would like to use your data without your permission or sell your information to a third party. Whatever your motivations, the Tor network is one of the most popular ways to avoid any form of online surveillance. Here you will learn how to set up a Tor proxy on Raspberry Pi and use it to automatically route your traffic through 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 request resources from a server, such as a file or a website.

When you set up a Tor proxy server, all of your traffic is redirected through the Tor network. Each packet of data you send through Tor is encrypted and decrypted multiple times and rerouted through multiple relays randomly selected from the thousands of relays that make up the Tor network. This way you can hide your location and activity from anyone who might be watching the network. This includes hiding the websites you visit, the messages you send, and any messages you post.

Many people access Tor through the free Tor Browser, but this requires you to configure the browser on each device on which you access the Internet. If you want to use the Tor network on all your devices or surf the web anonymously using your existing web browser, it's often easier to just set up a Tor proxy server, which you'll learn in this tutorial.

What you'll need

To complete this tutorial you will need:

  • Raspberry Pi running Raspberry Pi OS
  • Power cable compatible with your Raspberry Pi.
  • External keyboard and way to attach it to your Raspberry Pi
  • HDMI or micro HDMI cable, depending on your Raspberry Pi model
  • External monitor
  • Ethernet cable if not connecting via Wi-Fi

Getting started:configuring your Raspberry Pi

To get started, connect all peripherals to your Raspberry Pi.

Once your Raspberry Pi has started, click on the small network icon in the toolbar and connect to your Wi-Fi network if you are not using an Ethernet cable.

Before you begin, it's a good idea to check that you're using the latest version of Raspberry Pi OS. Open Terminal and type the following command:

sudo apt update &&sudo apt -y upgrade

If it installs one or more updates, restart your Raspberry Pi by running the following command:

sudo reboot

Install Tor on your Raspberry Pi

You can install Tor using a single Terminal command:

sudo apt install tor
How to configure a Tor proxy with Raspberry Pi

If Terminal returns an "active" message, you're ready to move on to the next step.

Configure your Tor proxy server

Configure your proxy server by making a few changes to the Tor configuration file. Before modifying this "torr" file, it is advisable to create a backup:

sudo cp /etc/tor/torrc /etc/tor/torrc.backup

Now that you have a backup, create a simple configuration that will expose the Tor Socks proxy service on port 9050 and accept local LAN connections.

To open the "torr" configuration file for editing, run the following command:

sudo nano /etc/tor/torrc

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:

hostname -I

Take this IP address and add the port number :9050 . For example, if the Raspberry Pi's IP address is 192.168.1.111, add the following to the Torr configuration file:

SocksPort 192.168.1.111:9050

Add the following to the Nano text editor, making sure to replace "SocksPort" with your own value:

SocksPort 192.168.1.100:9050SocksPolicy accept 192.168.1.0/24RunAsDaemon 1DataDirectory /var/lib/tor

Once the changes have been made, save the file by pressing the Ctrl button + O and Ctrl + X close.

To restart the Tor service with your new configuration, run the following command:

sudo systemctl restart [email protected]

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 major web browsers.

Note that you will typically connect to your Raspberry Pi using its IP address. You can retrieve this information at any time by running hostname -I in the Raspberry Pi terminal.

Mozilla Firefox

Let's start by configuring Firefox to use your Socks proxy server:

1. In the upper right corner of Firefox, select the three-line icon.

2. Select "Preferences".

How to configure a Tor proxy with Raspberry Pi

3. From the left menu, select "General".

4. Scroll down to "Network Settings" and click the accompanying "Settings..." button.

5. In the next "Connection Settings" window, check the "Manual proxy configuration" box.

How to configure a Tor proxy with Raspberry Pi

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" box is checked.

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 to your proxy server:

1. In the upper right corner of Chrome, select the three dots icon.

2. Select "Settings".

3. In the left menu, navigate to "Advanced -> System".

How to configure a Tor proxy with Raspberry Pi

4. Select "Open your computer's proxy settings".

The following steps vary depending on your operating system.

macOS

If you are a Mac user, Google Chrome should have already launched your Mac's "Network -> Proxies" menu. In this window:

  • Select "SOCKS Proxy".
How to configure a Tor proxy with Raspberry Pi
  • 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 restarts, it should already be using the Tor network.

windows

If you are using a Windows PC, Google Chrome should have launched the "Internet Options" window. In this window:

  • Select the "LAN Settings" button.
  • Check the following box:"Use a proxy server for your local network".
  • Click "Advanced".
  • In the "Socks" section, enter the IP address of your Raspberry Pi.
  • For "Port", enter "9050".
  • Click "Save -> Apply".

Relaunch Google Chrome. It should now communicate with your Tor proxy server.

Apple Safari

If you are using Apple's Safari browser, then:

1. From the Safari toolbar, select “Safari -> Preferences…”

2. Select the "Advanced" tab.

3. Search for "Proxies" and select the "Change settings..." button that comes with it.

4. From the left menu, 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 restart Safari!

Do you really use Tor?

If you followed the instructions in this article, you should now be using the Tor network – but it never hurts to check! In the web browser you have configured to use Tor, go to the Tor website.

How to configure a Tor proxy with Raspberry Pi

If you see the message above, then congratulations – you are successfully routing all your traffic through Tor!

You learned in this tutorial how to turn a Raspberry Pi into a Tor proxy server. If you find this too complicated, you can install the Tor Browser on your USB drive and take it wherever you go. Alternatively, you can make Tor faster with these tips.

ContentsWhat is a Tor proxy server?What you'll needGetting started:Set up your Raspberry PiInstall Tor on your Raspberry PiSet up your Tor proxy serverConnect to your Tor proxy from any web browserMozilla FirefoxGoogle Chrome (and others Chromium-based browsers)Apple SafariAre you really using Tor?