How to Make Your Browsing Anonymous With a Tor-Based Raspberry Pi Hotspot
If you’ve been thinking about trying Tor to anonymize all your web browsing, you can just download a browser and try it out, but it’s much more fun to create your own highly portable proxy that you can easily connect to on a whim. … Log into your Raspberry Pi.
Tor is one of the easiest ways to browse the web anonymously , although it is expensive. In fact, it is so slow that it is quite difficult to use it for basic internet browsing. But that doesn’t mean it’s useless for other purposes, and since you probably don’t want to use it all the time, you’ll be comfortable with a quick way to switch between Tor and the regular Internet.
This is where the Raspberry Pi can help. First, you need to turn your Raspberry Pi into a hotspot, very similar to a Wi-Fi hotspot, and then you install Tor on it so that all traffic going through that hotspot is anonymous.
If you want to use Tor, you simply connect to the Raspberry Pi’s Wi-Fi network. If you don’t, you can use whatever network you normally use. The Tor browser is always available too, but you might not want to install the software on all of your devices. It’s also a good idea to keep it at home if you’re a permanent “techie” because it makes it very easy to show someone what life would be like if they actually decided to use Tor to view them (it would be slow).
What you need
You don’t need anything special to make a Tor-based Pi proxy, but you will need to collect a few materials before you start:
- Raspberry Pi 3
- Micro USB power supply
- network cable
- 8GB microSD card
- Home router access
- Mouse / keyboard / desktop computer for initial setup
You will want to go ahead and set up your SD card with Raspbian and also set up SSH. You can use either the standard Raspbian version or the Lite version, as you will only be using the command line in this tutorial. Follow our guide here to set up Raspbian (be sure to change the 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.
Putting everything together, make sure your Raspberry Pi is connected directly to your router using an Ethernet cable, then plug it in.
Step one: install the required software
The first thing we need to do is make the Raspberry Pi 3 Wi-Fi act as an access point. This turns it into an access point, so you can connect to it from your main computer just like any wireless network. We will do all this from the Raspberry Pi command line:
sudo apt-get updateand press Enter.
sudo apt-get install iptables-persistent git
Yesand press Enter twice when prompted.
Now that everything is downloaded and installed, it’s time to set it up.
Step two: turn your Raspberry Pi into an access point
The process of turning a Raspberry Pi into an access point is a bit tricky, but luckily GitHub user harryallerston has created a script that automates the entire process.
git clone https://github.com/unixabg/RPI-Wireless-Hotspot.gitand press Enter.
cd RPI-Wireless-Hotspotand press Enter.
sudo ./installand press Enter. This will start the installation process.
Yto agree to the terms,
Yto use the pre-configured DNS server,
Nto use the Unblock-Us servers,
Yto use OpenDNS, then
Nto use the default Wi-Fi settings.
- When prompted after the default question, enter your new password. This is the password for connecting to your Pi powered network.
- When prompted, enter a new SSID, this is the name of your network.
- Enter the channel number.
6fine if you don’t know you need something else.
Nfor the rest of the questions.
After completing it, your Raspberry Pi will reboot and should now act as an access point. You can check this by going to another computer or phone, selecting your Raspberry Pi from the list of Wi-Fi networks, and checking if the internet is working. If for some reason this is not the case, Adafruit has a guide on how to do it all by hand. Otherwise, go ahead and install the Tor proxy software.
Step three: install TOR
Tor has a pretty straightforward setup process, but you still need to configure a few things to get it working.
sudo apt-get install torand press Enter.
sudo nano /etc/tor/torrcand press Enter. Scroll to the bottom of the document and enter the text below in the text file. When you’re done press Ctrl + X to save and continue:
Log Notification File /var/log/tor/notices.logVirtualAddrNetwork 10.192.0.0/10AutomapHostsSuffixes .onion, .exitAutomapHostsOnResolve 1TransPort 9040TransListenAddress 192.168.42.1DNSPort 53DNSListenAddress 192.168.42.1
Next, you need to tell the Wi-Fi interface to send internet traffic through the Tor software. It does this with a few commands:
sudo iptables -Fand press Enter.
sudo iptables -t nat -Fand press Enter.
sudo iptables -t nat -A PREROUTING -i wlan0 -p tcp --dport 22 -j REDIRECT --to-ports 22and press Enter.
sudo iptables -t nat -A PREROUTING -i wlan0 -p udp --dport 53 -j REDIRECT --to-ports 53and press Enter.
sudo iptables -t nat -A PREROUTING -i wlan0 -p tcp --syn -j REDIRECT --to-ports 9040and press Enter.
sudo sh -c iptables-save > /etc/iptables/rules.v4and press Enter.
It’s time to finally get Tor up and running. Type
sudo service tor start and press Enter. Then enter
sudo service tor status to make sure it is working properly. If you don’t see any error codes, then everything is working. You can configure it to start automatically at startup by typing
sudo update-rc.d tor enable pressing Enter.
When it’s finished, reboot again. Type
sudo reboot and hit Enter. Your Raspberry Pi should now start everything up automatically on startup.
Step four: connect and browse with the new TOR proxy
Now all you have to do is connect any device you want to browse on anonymously to your new Raspberry Pi Wi-Fi network. Both your regular home Wi-Fi and this one will exist, so choose it like any Wi-Fi network. When you are connected, go to https://check.torproject.org/ to make sure you are on the Tor network. Enjoy the slow but anonymous internet!