How to build your own Tor node or relay

Millions of users trust in Tor to protect their online privacy and access websites without exposing their identity. The security that Tor provides is crucial for bloggers and journalists in countries where having opinions that oppose the government, can lead to prosecution. If you would like to set up your own Tor node or relay, keep on reading as we will go through the steps needed.

The benefits of hosting your own Tor relay

Tor is supported by a network of volunteer that offer their computers and internet bandwidth to run Tor. While Tor provides the software and takes care of the maintenance of the list of relays available the heart of Tor is its group of volunteers. When you have and manage your own relay or node, you can enjoy multiple benefits. First of all, you will get the chance to help others to enjoy online freedom and will support other users who like you, want to enhance their anonymity. If you have an organization, you will be able to offer your staff a tool that will protect their privacy on the internet. Plus, if you have an old server laying around and you don’t know what to do with it, making it part of your Tor setting can be the best option.

Although Tor relies on volunteers and by managing your own node you can contribute greatly to the cause of online freedom and privacy, it is important to consider the risks as well. Unfortunately, some users take advantage of the anonymity that Tor offers to engage in criminal activities. While speed is not one of the highlights of Tor, that won’t stop those who want to use the anonymity network for illegitimate purposes. Volunteers who run Tor nodes may be contacted by their ISP if suspicious activity is detected, but it is possible to find templates on TorServers.net, which will help you to respond to the queries. In addition, the Tor Project advises volunteers to get in touch with their ISP and law enforcement to notify their ISP and local authorities about the fact that they are running a Tor node. By letting them know in advance that you are managing a Tor relay, you can be prepared and reduce the impact of any possible issues in the future.

Setting up a Tor relay

If you want to go ahead and set up your own Tor relay, there are just a few preliminary steps that you need to complete. The setting up process itself is not too complicated, although the customization may require some time and technical skills. Before getting started, you need to find out some details about your internet connection and about the server that you are going to use. You will have to make a list with information about your actual internet bandwidth. Your ISP may advertise certain numbers, but in order to get real results, it is advisable to go to Speedtest.net to check your download and upload speeds.

The best time to carry out a test is during peak hours (9 to 9, office hours) to get an accurate idea of how much bandwidth you can actually use during busy traffic loads. You also need to keep in mind if your ISP places a limit on the amount of data that can be transferred every month. If that is the case, it is important that you know the limit and that you take it into consideration. In addition, you need to know what is your public IP address and keep in mind if you are using a proxy server, NAT, firewall or router in your network. It is also worth keeping in mind if there are any applications (such as instant messaging, email clients, etc) with transmissions that should be concealed and if so, check what ports are used and if it is possible to configure them to use different ones.

Once you have gone through the information mentioned above, you will need to choose the hardware and operating system it runs. It is advisable to have at least 64-bit architecture, although the most important aspect is not the server but the speed of the internet connection. You need at least 250KBps for download and download that can be assigned for the Tor relay, but if you have more, the results will be even better. When it comes to Operating System, Debian (or Ubuntu) would be the best choice since there is a Tor package in the Debian repository, which makes the installation very simple. It is possible to run a Tor relay on practically any operating system, but Linux, NetBSD, Windows Server and FreeBSD are ideal for this purpose.

Steps

  1. Now let’s go through the actual process of setting up your own Tor relay. The first thing you need to do is to open a terminal and type the following: sudo apt-get install tor
  2. You will be asked to provide your password before continuing. Apt will check your current setup and you may see a message letting you know that some additional disk space will be used. Press “Y” and Enter to proceed.
  3. Next, you will see a message saying “Starting tor daemon…done” or “Setting up tor…” when the installation process is nearly finished. If you don’t get the message, you can type sudo tail -f /var/log/messages in your command prompt to find out what caused the failure. You can fix the issues listed in the log and try to install Tor again.
  4. The next steps are a bit more technical than the previous ones. You will find the main configuration file (torrc) in /etc/tor or simply /etc/ on a Debian based relay. If you are using a different Linux distribution, the installation will be from the source and /usr/local/etc/tor would be the default path to the torrc file.
  5. Next, you need to open the file in a text editor to edit it in order to get teh relay working. To make the changes, you will use vi by typing sudo vi /etc/tor/torrc. Keep in mind that any line in this file that starts with a # will not be taken into consideration by the program as they are only comments or disabled commands. Tor has clarified at the start of the file that “Lines that begin with ##” are only intended as explanations, while “Lines that begin with just #” are commands that are disabled.
  6. Now you need to go to the bottom of the file and enter the below lines:ORPort 443
    Exitpolicy reject *:*
    Nickname ieditedtheconfig
    ContactInfo human@…
  7. You will come across similar lines in the torrc file but since they start with a #, you can still add new lines at the bottom of the file.
  8. You will need to add more lines in order to limit bandwidth usage and facilitate hibernation when the transfer limit is reached. The goal is to provide good speed for Tor, without neglecting the performance of your client computer. There should be a balance so that both benefit from the bandwidth available. It is also important to limit the amount of traffic that passes through the Tor node to avoid that it takes all your data transfer limit. This can be done by setting up a limit and getting Tor to hibernate once that limit is reached.
  9. The next step is to add the below lines at the end of the file and then save the changes:
  10. ccountingStart day 0:00
    AccountingMax 512 MBytes
    RelayBandwidthRate 5120 KBytes
    RelayBandwidthBurst 10240 KBytes

Once this is done, you just need to save that file. The vi command to save the changes and leave the program is :wq. Then you need to restart Tor using sudo service tor restart. Once Tor has restarted, your Tor exit node will be ready to operate. Before that, you may see a warning about using hibernation on the server in the log file and/or in the terminal, but you can ignore it.

Monitoring your Tor relay

Checking your Tor relay is important to ensure its adequate performance. You can keep an eye on it using the anonymizing relay monitor, known as ARM. This terminal or command line program allows you to monitor Tor through a local terminal or an SSH remote connection to the server. You can install it by opening a terminal and typing the following command: sudo apt-get install tor-arm and once the installation is completed, you can launch it using sudo arm. Apart form that, after the setup, your relay should be running and you won’t need to do much else.

A recently created relay won’t have a high number of users since it will still be new in the directory. It will take a few days for it to start routing client data, but then it should increase and getting to the limits that you established. Once 68 days have passed, the relay will be considered as a possible entry point for other clients. After that, it will work according to its configuration and it can be used by Tor users who need to protect their online traffic an remain anonymous online.