Run multiple tor instances
Suppose we want to create three tor instances, with each having its specific ip.
Create three torrc files, say /etc/tor/torrc.1 to .3.
In each file, edit the lines:
|
1 2 3 4 |
SocksPort 9050 ControlPort 9051 DataDirectory /var/lib/tor |
to use different resources for each torrc file, e.g. for for torrc.1:
|
1 2 3 4 |
SocksPort 9150 ControlPort 9151 DataDirectory /var/lib/tor1 |
for torrc.2,
|
1 2 3 4 |
SocksPort 9250 ControlPort 9251 DataDirectory /var/lib/tor2 |
and so on.
DataDirectory can also be relative to the current directory where tor is launched, e.g.:
|
1 2 |
DataDirectory d1 |
Then start tor like this:
|
1 2 3 |
tor -f /etc/tor/torrc.1 tor -f /etc/tor/torrc.2 |
This will create three different Socks5 servers on the three ports. Each one will open a different circuit.
We can export the variable TORSOCKS_CONF_FILE to point to the corresponding torn file:
E.g. $> export TORSOCKS_CONF_FILE="/etc/tor/torrc.1"
Next you can torify / torsocks any application from that particular shell by using the torrc.1 proxy.
Try: $> torify bash $> curl some.com/myip
http://stackoverflow.com/questions/14321214/how-to-run-multiple-tor-processes-at-once-with-different-exit-ips











