How to Host a Tor Relay Successfully?

6 minute read

Posted by: Dave

June 11, 2015

Hello everyone. My name is Dave, and today I will be teaching you on how to successfully host your own Tor relay on a Ubuntu 14.04 x64 VPS. The general method should be the same across most major Linux distros as well.

I have noticed a distinct lack of simple and clear tutorials on how to do this, so I am hoping that this will be the first mainstream one available.

The first thing you are going to want to do is run “sudo apt-get update && sudo apt-get upgrade” and accept all of the updates to the packages. This just makes sure we have the most up to date software for your systems security.

After this is completed, you are going to want to edit the /etc/apt/sources.list with your favourite editor, and add the following lines.

deb http://deb.torproject.org/torproject.org trusty main deb-src http://deb.torproject.org/torproject.org trusty main</textarea></div>

After you have added those two lines into the sources list, copy, paste, and run the following two lines separately as two different commands. It’s very important that you copy and paste each line correctly.

gpg –keyserver keys.gnupg.net –recv 886DDD89 gpg –export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -</textarea></div>

Once you have ran those two commands, run one more apt-get update && apt-get upgrade command, and then finally, we are ready to install the latest stable version of Tor!

sudo apt-get update &amp;&amp; sudo apt-get upgrade apt-get install tor deb.torproject.org-keyring</textarea></div>

Tor is now installed, and we are ready to get down and dirty with configuring and starting your Tor node. Make sure that Tor is not running before we begin to make any changes to the torrc file, or the changes will not take place. To do this, make sure you run the following command.

sudo service tor stop</textarea></div>

Once that is done, we can use our favourite editor to edit the magic file known as “torrc”, located in the /etc/tor/ folder on our VPS. This file contains all of the options to run Tor as a hidden service, as a bridge, and for today’s tutorial, a Tor relay.

We want to scroll down in this file until we see the information stating that the section is just for Tor relays. It will look something like this.

It is also worth noting that I will be going down the list of configuration options out of order, since some of the options are not really needed for this tutorial.

The picture is just the first few settings in the options for our Tor relay, but don’t get overwhelmed. It’s really simple when you take your time and read through it.

The first setting we will be dealing with is the “ORPort”. This is the port that will accept connections from clients so they can use the Tor network. It is a required option, and the default selection of 9001 is the optimal way to run it. Remove the octothorpe(that is the # sign) from the front of it to make it active. The rest of the options under it can be ignored, as they are used for specific configurations.

The second setting we will be dealing with is the “Nickname” setting. This is only a name for the relay you are making for you to keep track of it, and for other people to know who runs it. It can be anything you want.

The next two settings we will be relating to your bandwidth. These are very important to set correctly, otherwise you may end up in trouble with your hosting provider. Be sure you know your limits before setting up a Tor relay in the first place.

RelayBandwidthRate is the base line of how much bandwidth you want to allow people to use off of your relay. RelayBandwidthBurst is how much bandwidth you want to allow in one quick burst to and from a client. This does not cap the bandwidth you use outside of the Tor applications on your VPS. The default settings for both of these are usually fine. You can adjust them up or down as you need or want though.

AccountingMax is the total amount of data you want to be sent in a given period of time. This could be 10 gigabytes of data in a 24 hour period, for example. AccountingStart is when that period of time starts for your relay. In the example below, I will set it so that only 10 gigabytes of data can be sent in a 24 hour period. Again, this can be set up or down to your wants or needs.

The next setting is your contact information. This can be as simple as an email address, or as advanced as your PGP key, but using an email address is absolutely recommended to get you on the Tor mailing list. Usually, people put there email address, followed by their BitCoin address just in case someone wants to donate BitCoins to that relay, as shown in the example below.

The final option is an important option. It is the decision as to if you want to be an exit node or not. Being an exit node is important to the Tor network, as it is where encrypted Tor traffic gets into the internet. For more information, click here.

You don’t hurt the Tor network by not being an exit node at all, so it is no worry if you want do not want to be. Just uncomment the last ExitPolicy option I did in the picture. If you do want to be an exit node, leave all of them commented just like they are.

Once you make sure everything is to your liking, start up Tor again with the command below, viola! You are running your own Tor relay, heloing users around the world have safer and more anonymous internet!

sudo service tor start</textarea></div>

A few things to keep in mind that are not really listed in any help file before we end the tutorial. One, is that your relay may not be listed for a few hours on sites like Globe or Atlas. It takes a bit. Don’t go restarting your VPS or anything.

The second thing is that your bandwidth is going to be really screwy for awhile. It will jump up, it will go down to nothing, it will even out, and even sometimes go COMPLETELY INSANE like it did for me the first time I ran a Tor node. It’s entirely natural, and I recommend you take a look at this article for more reading on what to expect.

Another thing is that there is a community established that is ready to help you if you have any trouble at all. Stackexchange is a website dedicated to people who are having problems with a wide array of subjects, and Tor is one of them! It can be accessed at this link, 24 hours a day, 7 days a week, 365 days a year.

The last thing I can think of is that logs are your friend. If there is anything going wrong with your relay, it will be located in the log files at /var/log/tor. Read them, find out where the problem is, and fix it. If you need some help, use the Stackexchange link above
Well, this about covers the tutorial on how to host your own Tor relay. If you have any questions, feel free to ask them in the comments below.

Thank you all so much, and thank you for your interest in helping the Tor community.

This tutorial is by Dave, who can be reached at tor@8chan.co

Updated: 2015-06-11

Updated: