Setup a Tor (The Onion Router) proxy with Raspberry PI and Raspbian Buster Lite

Original Raspberry Pi 4 Model B, starting from only US $42.53 shipping included (limited stock, 20% less than other online sellers). Save more with new user coupons (see sidebar banner)

What Are Proxy Servers And Why Use Them

Following Wikipedia description, “a proxy server is a server (a computer system or an application) that acts as an intermediary for requests from clients seeking resources from other servers. A client connects to the proxy server, requesting some service, such as a file, connection, web page, or other resource available from a different server and the proxy server evaluates the request as a way to simplify and control its complexity“. A descriptive picture is also showed in the same page:

Wikipedia Proxy Concept

Proxy server are useful in many contexts:

  • in Office context: to control internet traffic by blocking some websites or some keywords, to manage contact with external internet from a single point or to optimize internet bandwidth usage by caching pages at proxy level
  • in Home context: for example to control family internet access to block dangerous websites for childrens
  • in Personal use context: for example to use an anonymous connection or to bypass network ISP blocks

What Is Tor Project

Also for this description Wikipedia comes to help us in Tor (anonimy network) Wikipedia page:

Tor is free and open-source software for enabling anonymous communication. The name is derived from an acronym for the original software project name “The Onion Router”. Tor directs Internet traffic through a free, worldwide, volunteer overlay network consisting of more than seven thousand relays to conceal a user’s location and usage from anyone conducting network surveillance or traffic analysis. Using Tor makes it more difficult to trace Internet activity to the user: this includes “visits to Web sites, online posts, instant messages, and other communication forms”. Tor’s intended use is to protect the personal privacy of its users, as well as their freedom and ability to conduct confidential communication by keeping their Internet activities from being monitored.

Tor Project is the nonprofit association which currently develops software to make easy the use of Tor Network.

What We Need

This is a very simple and cheap solution. So, hardware will be only:

  • a Raspberry Pi with its power supply (connected via WiFi)
  • a micro SD card

Step-By-Step Procedure

In this guide we are going to use default Raspbian Buster Lite as OS. Then we’ll install Tor from Raspbian repository and apply a very simple configuration to use it as Socks proxy.

I’ll configure Tor proxy to manage access for all clients on a private network to internet. You will need to modify this network depending on your needs and networking configurations.

Install OS And Tor

Start from a fresh Raspbian Buster Lite installation.

Make sure you OS is updated:

sudo apt-get update
sudo apt-get upgrade

Simply install Tor by using Raspbian repository:

sudo apt-get install tor

At installation end you will have 2 services running as tor: “tor.service” and “tor@default.service

The first one is a dummy service, which appears to user as active but in exited status. Infact, a simple check:

sudo systemctl status tor.service

will give the following result:

● tor.service - Anonymizing overlay network for TCP (multi-instance-master)
   Loaded: loaded (/lib/systemd/system/tor.service; enabled; vendor preset: enabled)
   Active: active (exited) since Tue 2019-10-01 20:25:18 BST; 35s ago
 Main PID: 5546 (code=exited, status=0/SUCCESS)
   Memory: 0B
   CGroup: /system.slice/tor.service

…which is normal. The real service to check if Tor is running is the second one:

sudo systemctl status tor@default.service

should give a more familiar result:

● tor@default.service - Anonymizing overlay network for TCP
Loaded: loaded (/lib/systemd/system/tor@default.service; enabled-runtime; vendor preset: enabled)
Active: active (running) since Tue 2019-10-01 20:25:30 BST; 1min 36s ago
Main PID: 5552 (tor)
Memory: 23.5M
CGroup: /system.slice/system-tor.slice/tor@default.service
└─5552 /usr/bin/tor --defaults-torrc /usr/share/tor/tor-service-defaults-torrc -f /etc/tor/torrc --RunAsDaemon 0

Configure Tor

Tor main configuration file is named torrc. Before editing, create a backup copy:

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

A very simple configuration will expose Tor Socks proxy service on tor default port (9050) and will accept connections only from local LAN ( It will run as daemon, so that we’ll not need to call it each time we’ll use it. Finally, it will store data in default directory (/var/lib/tor/).

Edit configuration file:

sudo nano /etc/tor/torrc

and make it including only the following lines (assuming that is your Raspberry PI ip address):

SocksPolicy accept
RunAsDaemon 1
DataDirectory /var/lib/tor

Close and save the file. Restart Tor service:

sudo systemctl restart tor@default.service

Configure Your Client To Use Proxy Server

Now you need to configure your client to use Socks proxy server for internet connections. You have to check this depending on your client browser. Surely Mozilla Firefox can use Socks proxy and can be configured in Options -> Network Settings -> Settings button. In following window, select “Manual Proxy Configuration”, insert Raspberry PI IP address in SOCKS Host field, insert 9050 in related port and make sure “SOCKS v5” flag is active. You should have a configuration like the following picture:

Firefox Proxy settings

Close and open again your browser. Now you are using your Tor network in your browser. You can verify it by browsing the url

Tor Proxy Check



Please follow and like us: