How to Run a Tor Bridge on Linux

By | 2016/01/16

When running a Tor bridge, your ip is not listed in the public Tor directory. This is a good option to help the Tor project!

Read more about Tor Bridges on the Tor project website here.

1. First, install Tor using the provided Tor repository. There are repos for Debian, Ubuntu, Fedora, and CentOS.

Once Tor is install, stop the service if it is running.

sudo systemctl stop tor 

2. Next, edit the file /etc/tor/torrc and use the following values to setup a bridge. The bandwidth settings are optional but recommended to restrict the amount of bandwidth available for Tor.

SocksPort 0
ORPort 9001
BridgeRelay 1
Exitpolicy reject *:*

RelayBandwidthRate 5 MBits
RelayBandwidthBurst 10 MBits
AccountingStart month 1 00:00
AccountingMax 1000 GB

The ORPort will have to be opened, so open whichever port specified. Example using ufw:

sudo ufw allow 9001

3. Next, start Tor

sudo systemctl start tor 

4. Done. I suggest tailing the Tor log to be sure there are no errors and that Tor is connecting ok.

sudo tail -f /var/log/tor/log

A successful log will look similar to the following:

Jan 16 14:53:20.000 [notice] Tor (git-605ae665009853bd) opening log file.
Jan 16 14:53:20.000 [notice] Parsing GEOIP IPv4 file /usr/share/tor/geoip.
Jan 16 14:53:20.000 [notice] Parsing GEOIP IPv6 file /usr/share/tor/geoip6.
Jan 16 14:53:21.000 [notice] Configured to measure statistics. Look for the *-stats files that will first be written to the data directory in 24 hours from now.
Jan 16 14:53:21.000 [notice] Your Tor server's identity key fingerprint is 'xxxx xxxxxxxxxxxxxxxxxxx'
Jan 16 14:53:21.000 [notice] Your Tor bridge's hashed identity key fingerprint is 'xxxxx xxxxxxxxxxxxxxxxx'
Jan 16 14:53:21.000 [notice] Bootstrapped 0%: Starting
Jan 16 14:53:22.000 [notice] Bootstrapped 80%: Connecting to the Tor network
Jan 16 14:53:23.000 [notice] Bootstrapped 85%: Finishing handshake with first hop
Jan 16 14:53:24.000 [notice] Bootstrapped 90%: Establishing a Tor circuit
Jan 16 14:53:24.000 [notice] Tor has successfully opened a circuit. Looks like client functionality is working.
Jan 16 14:53:24.000 [notice] Bootstrapped 100%: Done
Jan 16 14:53:24.000 [notice] Now checking whether ORPort xxxxxxxxxxx:9001 is reachable... (this may take up to 20 minutes -- look for log messages indicating success)
Jan 16 14:53:25.000 [notice] Self-testing indicates your ORPort is reachable from the outside. Excellent. Publishing server descriptor.
Jan 16 14:53:29.000 [notice] Performing bandwidth self-test...done.