How To Anonymise Your Browsing With A Tor-Powered Raspberry Pi

How To Anonymise Your Browsing With A Tor-Powered Raspberry Pi

If you’ve been thinking about trying out Tor to anonymise all your web browsing, you could just download a browser and give that a spin, but it’s much more fun to make your own highly portable proxy that you can easily connect to on a whim. Enter the Raspberry Pi.

Tor is one of the easiest ways to browse the internet anonymously, though it does come at the cost of speed. In fact, it’s so absurdly slow that it’s pretty difficult to use for basic internet browsing. But that doesn’t mean it isn’t useful for other things, and since you likely don’t want to use it all the time, a quick way to switch between Tor and the regular internet is handy.

The Raspberry Pi can help here. First you need to turn a Raspberry Pi into an access point, much like a Wi-Fi hotspot, and then you install Tor on it so all the traffic that goes through that access point is anonymised.

When you want to use Tor, you just connect to the Raspberry Pi’s Wi-Fi network. When you don’t, you can use whatever network you use usually. The Tor Browser is always an option too, but you might not want to install software on all your devices. This is also nice to keep around the house if you’re the resident “tech person” because it makes it extremely simple to show someone what life would be like if they actually decided to use Tor for their browsing (it would be slow).

What You Need

You don’t need anything special to make a Tor-powered Pi proxy, but you will need to round up a few materials before you get started:

  • Raspberry Pi 3
  • Micro USB power supply
  • Ethernet cable
  • 8GB MicroSD card
  • Access to your home router
  • Mouse/keyboard/desktop computer for the initial set up process

You’ll want to go ahead and set up your SD card with Raspbian and set up SSH as well. You can use either the standard version of Raspbian or the Lite version, as you’ll only be using the command line for this guide. Follow our guide here to set up Raspbian (be sure to change your default password during this process) and this guide to enable SSH if you want to talk to your Raspberry Pi from any computer on your home network. Once you’ve gathered everything together, make sure your Raspberry Pi is connected directly to your router with an ethernet cable, then go ahead and plug it in.

Step One: Install the Necessary Software

The first thing we’ll need to do is make the Raspberry Pi 3’s Wi-Fi capable of acting like an access point. This turns it into a hotspot so you’ll be able to connect to it from your main computer just like you would any wireless network. We’ll be doing all this from the Raspberry Pi’s command line:

  1. Type in sudo apt-get update and press Enter.
  2. Type in sudo apt-get install iptables-persistent git
  3. Select Yes and press Enter the two times you’re prompted to.

Now that everything’s been downloaded and installed, it’s time to set it up.

Step Two: Turn Your Raspberry Pi Into An Access Point

How To Anonymise Your Browsing With A Tor-Powered Raspberry Pi

The process for turning a Raspberry Pi into an access point is a bit complicated, but thankfully GitHub user harryallerston created a script that automates the whole process.

  1. Type in git clone https://github.com/unixabg/RPI-Wireless-Hotspot.git and press Enter.
  2. Type in cd RPI-Wireless-Hotspot and press Enter.
  3. Type in sudo ./install and press Enter. This starts the installation process.
  4. Press Y to agree to the terms, Y to use preconfigured DNS server, N to using Unblock-Us servers, Y to using OpenDNS, then N for the Wi-Fi defaults.
  5. When prompted after the default question, enter a new password. This is the password to connect to your Pi-powered network.
  6. When prompted, enter a new SSID, this is the name of your network.
  7. Enter a channel number. 6 is fine, unless you know you need something else.
  8. Enter N for the rest of the questions.

Once it’s complete, your Raspberry Pi will reboot and should now work as an access point. You can test this out by heading to another computer or phone, selecting your Raspberry Pi from the Wi-Fi network list, and seeing if the internet works. If for some reason it does not, Adafruit has a guide for doing this all manually. Otherwise, continue on and install the Tor proxy software.

Step Five: Install TOR

How To Anonymise Your Browsing With A Tor-Powered Raspberry Pi

Tor has a pretty straight-forward set up process, but you’ll still need to tweak a few things to get it working.

  1. Type in sudo apt-get install tor and press Enter.
  2. Type in sudo nano /etc/tor/torrc and press Enter. Scroll all the way to the bottom of the document and enter the text below into the text file. When you’re done, press Ctrl+X to save and continue:

Log notice file /var/log/tor/notices.log
VirtualAddrNetwork 10.192.0.0/10
AutomapHostsSuffixes .onion,.exit
AutomapHostsOnResolve 1
TransPort 9040
TransListenAddress 192.168.42.1
DNSPort 53
DNSListenAddress 192.168.42.1

Next, you need to tell the Wi-Fi interface to send internet traffic through the Tor software. This happens with a few commands:

  1. Type in sudo iptables -F and press Enter.
  2. Type in sudo iptables -t nat -F and press Enter.
  3. Type in sudo iptables -t nat -A PREROUTING -i wlan0 -p tcp --dport 22 -j REDIRECT --to-ports 22 and Press Enter.
  4. Type in sudo iptables -t nat -A PREROUTING -i wlan0 -p udp --dport 53 -j REDIRECT --to-ports 53 and Press Enter.
  5. Type in sudo iptables -t nat -A PREROUTING -i wlan0 -p tcp --syn -j REDIRECT --to-ports 9040 and Press Enter.
  6. Type in sudo sh -c "iptables-save > /etc/iptables.ipv4.nat" and press Enter.

Now, it’s time to finally start Tor. Type in sudo service tor start and press Enter. Then, type in sudo service tor status to make sure it’s working properly. If you don’t see any error codes, it’s working. You can set it up to launch automatically at startup by typing in sudo update-rc.d tor enable then pressing Enter.

When that’s finished, go ahead and reboot one more time. Type in sudo reboot and press Enter. Your Raspberry Pi should now launch everything automatically on startup.

Step Five: Connect and Browse with Your New TOR Proxy

How To Anonymise Your Browsing With A Tor-Powered Raspberry Pi

Now, all you need to do is connect any device you want to browse anonymously on to your new Raspberry Pi Wi-Fi network. Both your regular home Wi-Fi and this one will exist, so select this as you would any Wi-Fi network. When you’re connected, head to https://check.torproject.org/ to verify that you’re on the Tor network. Enjoy your slow, but anonymous internet!


The Cheapest NBN 50 Plans

Here are the cheapest plans available for Australia’s most popular NBN speed tier.

At Lifehacker, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.

Comments