TechBuzzPro

How to Set Up Your Own Tor Relay

· 5 min read · Apps & Browsers

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Setting up your own Tor relay helps strengthen the Tor network, increasing its speed and resilience for users worldwide. This guide walks you through the process on a Linux server (Ubuntu/Debbian) with a static IP address. You'll need basic command-line familiarity and a machine that can stay online 24/7.

What You'll Need

  • A Linux server (Ubuntu 20.04+ or Debian 11+ recommended) with at least 1 GB RAM and 100 GB free disk space.
  • Root or sudo access to the server.
  • A static public IP address (or a domain name pointing to it).
  • Optional: a Tor relay operator's contact email address (for notifications).

Step-by-Step

  1. Update your system: Run sudo apt update && sudo apt upgrade -y to ensure all packages are current.
  2. Install Tor: Install the Tor package with sudo apt install tor -y. On Debian/Ubuntu, this installs the latest stable version from the official repositories.
  3. Configure the Tor relay: Edit the Tor configuration file with sudo nano /etc/tor/torrc. Add or uncomment the following lines:
    Nickname yourrelayname
    ORPort 443
    ExitRelay 0
    ContactInfo your@email.com
    
    Replace yourrelayname with a unique nickname (no spaces), and your@email.com with a valid contact address. The ExitRelay 0 line ensures your relay is a non-exit relay, which is safer for beginners.
  4. Set bandwidth limits (optional but recommended): To avoid saturating your connection, add these lines to the same file:
    RelayBandwidthRate 1 MB
    RelayBandwidthBurst 2 MB
    
    Adjust the values to match your available bandwidth. The first is the sustained limit, the second is the burst limit.
  5. Start and enable Tor: Run sudo systemctl restart tor to start the service, then sudo systemctl enable tor to make it start on boot.
  6. Check the logs: Verify that Tor started correctly by running sudo journalctl -u tor --since "5 minutes ago". Look for lines like "Self-testing indicates your ORPort is reachable from the outside." If you see errors, check the troubleshooting section below.
  7. Open the ORPort in your firewall: If you have a firewall enabled (like ufw), allow incoming connections on the ORPort you chose (e.g., 443): sudo ufw allow 443/tcp. If you're using a cloud provider, also open the port in their security group settings.
  8. Wait for the relay to be listed: Tor relays appear in the public directory after about 1-2 hours. You can check your relay's status by searching for your nickname on Tor Metrics.
  9. Monitor your relay: Install the nyx monitoring tool with sudo apt install nyx -y and run sudo nyx to see real-time stats like bandwidth usage and connections.

Common Mistakes

  • Using a dynamic IP: If your IP changes, the relay will go offline. Use a static IP or a dynamic DNS service.
  • Setting the ORPort to 80 or 443 without root: Ports below 1024 require root privileges. Tor runs as user debian-tor by default, so it can't bind to these ports unless you configure it to use a higher port or set User tor in the config (not recommended for security).
  • Forgetting to open the firewall: Even if Tor starts, external connections won't reach it if the port is blocked.
  • Using a nickname that's already taken: Choose a unique nickname to avoid conflicts.
  • Running an exit relay without understanding the risks: Exit relays handle traffic that can be misused; this guide covers non-exit relays only.

Tips

  • Start with a non-exit relay to learn the ropes. You can later change to an exit relay if you understand the legal and operational implications.
  • Set a ContactInfo address so Tor operators can reach you if issues arise.
  • Use a dedicated machine or VM—don't run other heavy services on the same server.
  • Monitor your relay's bandwidth usage to ensure it doesn't exceed your ISP's data caps.
  • Join the Tor Stack Exchange for community support.

Troubleshooting

  • Tor fails to start: Check the logs with sudo journalctl -u tor -e. Common issues include invalid config lines or missing permissions. Ensure the config file is readable by the Tor user.
  • ORPort unreachable: Run sudo ss -tulpn | grep 443 to see if Tor is listening. If not, check your firewall and cloud security groups. Use an external port checker like YouGetSignal to verify.
  • Relay not appearing in the directory: It can take up to a few hours. If it's been longer, check that your clock is synchronized (sudo timedatectl set-ntp true). Also ensure your ORPort is reachable from outside.
  • High bandwidth usage: If your relay is consuming too much bandwidth, lower the RelayBandwidthRate value and restart Tor.
  • Tor is being blocked by your ISP: Some ISPs block Tor traffic. You can try using a different ORPort (e.g., 9001) or using obfuscation bridges, but that's beyond the scope of this guide.

Frequently Asked Questions

Do I need to be a technical expert to run a relay?

Basic Linux command-line skills are sufficient. The steps above are straightforward, and the Tor community provides ample documentation.

Can I run a relay on Windows or macOS?

Yes, Tor relays can run on Windows and macOS, but the setup differs. This guide focuses on Linux, which is the most common and best-supported platform.

Will running a relay expose my identity?

Your relay's IP address is public in the directory, but your personal identity is not directly linked unless you use a domain name that reveals it. Using a contact email is optional but recommended.

How much bandwidth does a relay use?

It depends on your configured limits. A relay with a 1 MB/s rate uses about 8 GB per day, but you can set lower limits to reduce usage.

Can I run an exit relay?

Yes, but be aware that exit relays can be used for illegal activities, which may attract legal attention. It's strongly advised to start with a non-exit relay and understand the risks before considering an exit.

How do I know my relay is working?

After a couple of hours, search for your nickname on Tor Metrics. You can also use nyx to see live traffic.