Grepular

Tor Circuits with Two Hops on Ubuntu

Written 14 years ago by Mike Cardwell

Tor creates circuits which contain three hops. Tor is quite slow. You can modify Tor to use only two hops quite easily. You could potentially use single hop circuits, but Tor relays reject such connections by default so you’ll probably end up with worse performance. I will describe the steps I took to install the latest alpha version of Tor with two hops on an Ubuntu “Lucid” box below. You should read up on whether or not two circuit hops are appropriate for your usage requirements as there is a reduction in anonymity when you use them. For a lot of cases, two hops is fine though.

First of all you need to download the source code. Add the following lines to /etc/apt/sources.list

deb-src http://deb.torproject.org/torproject.org lucid main
deb-src http://deb.torproject.org/torproject.org experimental-lucid main

Then, as root. Run the following commands:

mkdir /usr/local/src/tor
cd /usr/local/src/tor
apt-get update
apt-get source tor

If you do an “ls”, you should now see a number of files and a directory called something along the lines of “tor-0.2.2.15-alpha”. Change into that directory and edit “src/or/or.h” with your text editor of choice. Find the line which looks like this:

#define DEFAULT_ROUTE_LEN 3

And change it to:

#define DEFAULT_ROUTE_LEN 2

Now you’ve modified the source code, and you need to build the .deb package. To do this you should “apt-get install devscripts” and then run the command “debuild” whilst in the “/usr/local/src/tor-0.2.2.15-alpha” directory (depending on the version). If you get any dependency failures (you probably will), install the relevant packages using apt-get and then run “debuild” again. When it has finished compiling you will find three files which look something like this in the parent directory:

tor_0.2.2.15-alpha-1~lucid+1_amd64.deb
tor-dbg_0.2.2.15-alpha-1~lucid+1_amd64.deb
tor-geoipdb_0.2.2.15-alpha-1~lucid+1_all.deb

tor-dbg can be ignored. Install the other two packages by running the command:

dpkg -i tor_*.deb tor-geoipdb_*.deb

You now have a two hop version of Tor installed. The best way to confirm this is to “apt-get install vidalia” and then look at the currently opened circuit list using the GUI.

Want to leave a tip?BitcoinMoneroZcashPaypalYou can follow this Blog using RSS. To read more, visit my blog index.