Skip to content

Creating Multiple Instances of Tor, Giving Multiple IP Addresses

OS: Amazon Linux / Linux / CentOS / RedHat
Package: Tor (the Onion Router)

Tor is a anonymizing tool used around the world in various security scenarios. Even just for the regular Joe wanting to keep their browsing relatively anon, it’s a great tool. If the world was made up of everybody making it hard for people to spy on us, there would be a lot less spys, so the theory goes.

Depending on what you’re doing, you might want to tell Tor to launch a few different instances. This will provide you with a few different routes or onions (if I may) to even moreso anonymize your internet browsing.

This tutorial will be about doing this through command line (SSH).

First, we must make sure that Tor is installed. For installation instructions of Tor, please refer to this blog.

To check whether Tor is installed:

sudo /etc/init.d/tor status

Which should show you something like:

tor is running (pid: 2944)

Now stop Tor so that we can edit the config file:

sudo /etc/init.d/tor stop

which should show you:

Stopping tor: [ OK ]

Creating Multiple Tor Instances

To make Tor work, you first send your local requests to your localhost (almost always 127.0.0.1), which then re-routes the request through the defined SOCKSport (you’ll learn that in a second), which then goes through the Onion (jumps from IP to IP to anonymize your traffic) and then finally reaches your destination.

There have been some instructions out there to make multiple Tor configuration files that would then get started each themselves, but I haven’t been able to find any benefit to doing it this way, and every instruction I’ve come across severely lacks any extensive configuration details which worries me about security that should be involved in the configuration itself, not to mention the pain of having to start four – or as many as you make – unique instances in the first place. So..

First, we will edit the Tor configuration file, torrc:

sudo vi /etc/tor/torrc

In this file, look for:

SocksPort 9050

and add just below this, so it looks like:

SocksPort 9050
SocksPort 9060
SocksPort 9070
SocksPort 9080

note: you can choose whatever port you wish here except for the very next port. So, port 9051 don’t pick, but you can pick 9052, but then you couldn’t pick 9053 for the next because the very next port is required for the next part.

Then keep looking for:

ControlPort 9051

and add just below it, so it looks like:

ControlPort 9051
ControlPort 9061
ControlPort 9071
ControlPort 9081

Type :wq to exit vi. Then start Tor again:

sudo /etc/init.d/tor start

which should give you something that looks similar to this:

Start Tor Confirmation

From this, we can see that we have four Socks and four Control ports opened up for Tor.

Now, to test.

curl –proxy socks5h://localhost:9050 http://ipinfo.io/ip

This will return an IP. Now do this for all four of the different ports opened (9050, 9060, 9070, 9080) and you should see that each time that you do this, it returns a different IP address. Then do the first one again, and likely it will be the same as it was the first time.

Go ahead, play with this!

 

Additional Resources:

3 thoughts on “Creating Multiple Instances of Tor, Giving Multiple IP Addresses”

  1. Pingback: Installing Tor on Linux/UNIX/CentOS/Fedora/Amazon « Linux « Teition Solutions

  2. Is there a guarantee that no two of them will share an exit node with the same IP?

    I know that they will all use different circuits by default, but how do you know it won’t choose different circuits that use same exit?

    Thanks

    1. I’m not 100% sure, but I believe there’s a paid option that will give you that guarantee.

      I find it hard to believe that there would be more exit nodes than users, thus making me believe it is impossible to guarantee something like that unless you’re buying a premium service.

      Did you find anything?

Leave a Reply to Ned Cancel reply

Your email address will not be published. Required fields are marked *

three × five =