Hosting a tor relay.
Contributing to the privacy and security of the internet is something I’m passionate about, and one of the ways I do this is by hosting a Tor relay. If you’re new to Tor, it’s a decentralized network designed to anonymize traffic, protecting users’ privacy and bypassing censorship. By running a relay, you help strengthen the network, making it harder for bad actors to track or censor internet traffic.
In this post, I’ll walk you through how I set up a Tor relay on a cloud server. Let’s dive in!
Why Host a Tor Relay?
Tor relies on volunteers to run relays, which are the building blocks of the network. More relays mean better speed, security, and overall resilience of the network. Hosting a relay:
- Supports free speech and access to information globally.
- Strengthens the privacy of all Tor users by distributing the load across more servers.
- Helps resist censorship by allowing more traffic to flow through the network.
What You’ll Need
Before we get started, here’s what you’ll need:
- A cloud server – I use Ubuntu on my cloud servers, but you can use any Linux-based system. Popular providers include DigitalOcean, Vultr, or Hetzner.
- Basic Linux command-line knowledge – You’ll need to be comfortable with using SSH and running commands.
- Root or sudo access – You’ll need admin privileges to install the necessary software.
Step 1: Setting Up Your Cloud Server
First, spin up a new cloud instance. I recommend choosing a server with at least 1GB of RAM for optimal performance, though Tor can run on lower specs. I’m using Ubuntu in this tutorial, but the steps are similar for other distributions.
- Update your server
sudo apt update
sudo apt upgrade -y - Set a hostname (optional but recommended)
sudo hostnamectl set-hostname tor-relay
Step 2: Install Tor
Now, let’s install Tor.
- Add the Tor Project repository
sudo apt install -y gnupg
echo "deb https://deb.torproject.org/torproject.org $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/tor.list
wget -qO - https://deb.torproject.org/torproject.org/pubkey.gpg | sudo apt-key add - - Install Tor and its dependencies
sudo apt update sudo apt install -y tor tor-arm
Step 3: Configure Your Tor Relay
Now that Tor is installed, it’s time to configure it as a relay.
- Edit the Tor configuration file
sudo nano /etc/tor/torrc
- Add the following lines to configure your relay
ORPort 9001
ExitRelay 0
Nickname YourRelayNickname
ContactInfo your-email@example.com
ORPort
defines the port for incoming connections.ExitRelay
is set to0
because we’re not running an exit relay (which handles traffic exiting the Tor network).Nickname
is the name of your relay.ContactInfo
lets the Tor community contact you in case of issues.
- Save and exit the file.
Step 4: Start and Enable Tor
- Start the Tor service
sudo systemctl start tor
- Enable Tor to start on boot
sudo systemctl enable tor
- Check that Tor is running
sudo systemctl status tor
If everything is working, you’ll see the service is active and running.
Step 5: Monitor Your Relay
To monitor your relay’s performance and status, I recommend using Nyx, an interactive command-line monitor for Tor.
- Install Nyx
sudo apt install nyx
- Run Nyx
nyx
Nyx provides detailed statistics about your relay, such as bandwidth usage, uptime, and connections.
Step 6: Optimize Your Relay
You can fine-tune your relay by adjusting the bandwidth limits in the torrc
file:
- Edit your
torrc
file againsudo nano /etc/tor/torrc
- Add or modify these lines
RelayBandwidthRate 100 KB
RelayBandwidthBurst 200 KB
# These values control the amount of bandwidth your relay will use. Set limits that make sense for your server and network.
Step 7: Verify Your Relay
After some time (usually 1-2 hours), your relay will appear in the Tor relay list. You can also check your relay’s status by searching for your relay’s nickname or IP address.
Conclusion
By hosting a Tor relay, you’re contributing to a network that supports privacy, freedom of expression, and access to uncensored information. It’s a simple yet powerful way to make a difference, especially for those in countries with restricted internet access.
If you want to learn more about how Tor works or how to customize your relay even further, feel free to leave a comment or check out the Tor Project’s documentation.
Leave a Reply