1

I want to use a specific ip from Tor without changing it, even if Tor restart/close.

I'm aware that by using Tor, either by using custom flags on Tor service/process, or by editing the config, one can achieve this, though I'm unaware of the exact details.

A simple example that i know of is to use torify like so:

torify curl http://icanhazip.com/

where the url report the ip from Tor (say, 46.165.xxx.xxx). It seems to not change (which is the wanted effect). But after some time, it does change the ip used...(even though Tor service wasn't restarted afaik)

I basically don't want Tor to change ip and want it to specifically use only one ip (either specified in the config, or as a flag)

How can i make Tor use a specific/specified ip without it changing on restart?

5
  • 1
    this should help communitydocs.accessnow.org/147-Tor_force_exit_nodes.html (I don't have experience with Tor so won't write an answer).
    – A.B
    Sep 25 '20 at 22:32
  • I think this works? :D why not post it as answers then! @A.B Sep 25 '20 at 22:40
  • 1
    If you want to thank me, write what you did to make it work as an answer to your question.
    – A.B
    Sep 25 '20 at 22:41
  • Alright :) @A.B Sep 25 '20 at 22:43
  • 1
    done! @A.B Thanks again for the tip! hope you don't mind that i credited you? :D Sep 25 '20 at 22:54
1

To specify the ip that Tor will use, append:

  ExitNodes IP

Into your torrc config file (which is generally in /etc/tor/torrc for Ubuntu/Debian variant, not sure for other OSes).

Where IP is the wanted ExitNodes ip, which can be either found by already knowing some of them (like by noting them down when using other Tor wrapper, like torify or what ip checking service report as your ip) or by looking at the official list of ExitNodes on Tor's website.

One can also optionaly refer to their local list of ExitNodes, which can be accessed by doing:

sudo grep -B3 "^s.*Exit" /var/lib/tor/cached-microdesc-consensus | grep "^r" | awk '{print $6 ":" $7}'

If one need to access other kind of nodes, just change the regex pattern Exit to other valid pattern, like Guard for Entry Nodes.

Make sure to restart Tor after modifying your config:

sudo /etc/init.d/tor restart

or

sudo systemctl tor restart

or even

pkill -sighup tor

Thanks to @A.B pointing out the bits of the documentation where this was mentioned and this post for the regex trick above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.