en
Tor Middle Relay Setup Guide
Middle relays handle the second hop in Tor's three-hop circuit design, forwarding encrypted traffic between guard relays and exit relays. Middle relays are the safest type of Tor relay to operate because neither origin nor destination traffic is visible, and middle relay IPs do not appear in destination server logs. Any operator who wants to contribute to the Tor network without the legal complexity of exit relay operation should consider running a middle relay. This guide covers complete middle relay setup and operation.
Need this done for your project?
We implement, you ship. Async, documented, done in days.
Installing Tor and Basic Configuration
Install Tor from the official Tor Project repository for the most up-to-date version. On Debian/Ubuntu: add the Tor Project's apt repository (deb.torproject.org), import the signing key, and install tor and tor-geoipdb. Create /etc/tor/torrc with: Nickname YourRelayNickname (letters and numbers only, max 19 chars), ContactInfo youremail@example.com (visible in the relay descriptor), ORPort 443 (or 9001), RelayBandwidthRate 20 MBytes, RelayBandwidthBurst 40 MBytes, ExitRelay 0, ExitPolicy reject *:*, LogLevel notice, Log notice file /var/log/tor/notices.log. Start: systemctl enable tor && systemctl start tor. Verify operation: cat /var/log/tor/notices.log | grep 'Bootstrapped 100'.
Bandwidth Configuration and Network Contribution
RelayBandwidthRate determines how much bandwidth you contribute to the Tor network. Set to a sustainable level that does not interfere with other server functions. For a dedicated relay server, set to 80-90% of available throughput. For servers with other functions, set conservatively and monitor impact. The estimate for monthly bandwidth usage: RelayBandwidthRate in MB/s times 86400 seconds/day times 30 days times 2 (bidirectional) = monthly GB. A 10 MB/s relay uses approximately 50 TB/month. Verify your hosting provider's bandwidth policy supports this volume. RelayBandwidthBurst allows temporary bursts above RelayBandwidthRate - set to 150% of RelayBandwidthRate for responsive circuit performance.
Monitoring Your Relay's Performance
Track your relay's performance through multiple channels. Use Nyx (pip install nyx) for a terminal dashboard showing real-time bandwidth, circuit counts, and log output. Check your relay's status in the consensus at metrics.torproject.org by searching for your relay fingerprint or nickname. The Tor Relay Search shows your relay's flags, bandwidth weight, country, and uptime history. Monitor with Prometheus node_exporter for system metrics (CPU, RAM, disk, network) and alert on Tor service failures. Your relay begins appearing in the consensus within 3-4 hours of initial startup. Bandwidth measurements from the bandwidth authorities take 48-72 hours to reflect in consensus weight.
Automating Updates and Maintenance
Keep Tor updated for security patches. On Debian/Ubuntu, unattended-upgrades with Tor's repository in the auto-upgrade list maintains automatic security updates: configure 52-unattended-upgrades with deb.torproject.org in Origins-Patterns. Add 'ExecStartPost=/usr/bin/tor --verify-config' to the systemd tor service to verify configuration validity before start. Set up log rotation: /etc/logrotate.d/tor with rotate 4 weekly compress. For planned maintenance: review the relay's current circuits before shutdown (Nyx shows active circuit count) and wait for low-traffic periods. After restart, the relay rebuilds its circuit load within 30-60 minutes.
Community and Registration
Register your relay with the Tor community. Add a ContactInfo email in torrc so the Tor Project can notify you about operational issues or relay policy changes. Subscribe to tor-relays@lists.torproject.org for operator announcements. Register for the Tor relay operator program at community.torproject.org/relay to access additional resources and operator community forums. Consider joining relay operator groups in your region or timezone. The Tor Project publishes relay advocacy materials you can use to explain your operation to ISPs or data center providers who ask about Tor traffic. Document your legal jurisdiction and relay type in your ContactInfo - this helps the Tor Project track relay diversity and helps users understand the relay's legal environment.
Related Services
Why Anubiz Host
100% async — no calls, no meetings
Delivered in days, not weeks
Full documentation included
Production-grade from day one
Security-first approach
Post-delivery support included
Ready to get started?
Skip the research. Tell us what you need, and we'll scope it, implement it, and hand it back — fully documented and production-ready.