89

Lets say I want to get Netflix to work via Tor. Currently I keep pressing "new identity" until my traffic is exiting from a country supported by Netflix. I use Tor bridges to access the network.

Is there a way to choose the country or node where my traffic should exit the Tor network?

4
  • possible duplicate of How reliable is setting an exit via country code? Commented Nov 5, 2013 at 17:38
  • The specific country part of the question is definitely a duplicate IMO; the selecting a specific exit node isn't a duplicate of that question IMO. Commented Nov 5, 2013 at 19:09
  • None of this information here is easy to follow. In the torrc file: > # This file was generated by Tor; if you edit it, comments will not be preserved > # The old torrc file was renamed to torrc.orig.1 or similar, and Tor will ignore it torrc.orig.1 is empty I tried entering Exitnodes Strictnodes 1 {US} at the end of both of them (one at a time). Neither works. Commented May 4, 2016 at 0:32
  • 1
    This is a test comment to test out this bug.
    – user27347
    Commented Jul 18, 2019 at 20:52

8 Answers 8

77

You can use ExitNodes in your torrc to set a country code, but it wouldn't be the best solution to your request. Streaming Netflix over Tor would be incredibly slow and actually have a fairly negative effect on the network just to let you watch a few extra TV shows.

Your best option would probably be to set up a VPN in the country of your choosing. This would give you the speed you need to watch properly and keep that bandwidth free for Tor users who actually need it for anonymity.

See this answer for a good breakdown of why this use of Tor isn't good practice.

To use an exit node from a particular country add the ISO country code in curly brackets. Eg. {us} for an exit in the United States.

8
  • 6
    You probably also want to look up the StrictNodes directive to ensure that it will stick to that ExitNode line even if no usable exits are available.
    – user5
    Commented Dec 27, 2013 at 15:28
  • 4
    (Re Sam's comment above, StrictNodes no longer applies to the ExitNodes config option. It only applies to excluding nodes.) Commented Feb 8, 2015 at 10:22
  • 3
    For information, it looks like StrictNodes (shared by @SamWhited) is a replacement for StrictExitNodes blog.dontneedcoffee.com/2012/06/… lists.torproject.org/pipermail/tor-talk/2010-November/…
    – baptx
    Commented Nov 24, 2015 at 13:16
  • 1
    @Geremia yup, but it wasn't at the time; feel free to submit an update to this answer.
    – user5
    Commented Dec 15, 2016 at 23:52
  • 1
    @Geremia StrictNodes seems to be present even on latest Tor versions (tested on Linux), you have to use it with ExitNodes like that, for example to get an IP address from France: tor ExitNodes {fr} StrictNodes 1
    – baptx
    Commented Oct 8, 2020 at 10:23
26

The following excerpts from the Tor Project Manual should tell you everything you need to know:

ExitNodes node,node,…

A list of identity fingerprints, nicknames, country codes and address patterns of nodes to use as exit node---that is, a node that delivers traffic for you outside the Tor network.

Note that if you list too few nodes here, or if you exclude too many exit nodes with ExcludeExitNodes, you can degrade functionality. For example, if none of the exits you list allows traffic on port 80 or 443, you won’t be able to browse the web.

Note also that not every circuit is used to deliver traffic outside of the Tor network. It is normal to see non-exit circuits (such as those used to connect to hidden services, those that do directory fetches, those used for relay reachability self-tests, and so on) that end at a non-exit node. To keep a node from being used entirely, see ExcludeNodes and StrictNodes.

The ExcludeNodes option overrides this option: any node listed in both ExitNodes and ExcludeNodes is treated as excluded.

The .exit address notation, if enabled via AllowDotExit, overrides this option.

To use a country code in the ExitNodes line you specify its ISO country code in brackets. Eg. ExitNodes {us} to use exit nodes in the United States.

StrictNodes 0|1

If StrictNodes is set to 1, Tor will treat the ExcludeNodes option as a requirement to follow for all the circuits you generate, even if doing so will break functionality for you. If StrictNodes is set to 0, Tor will still try to avoid nodes in the ExcludeNodes list, but it will err on the side of avoiding unexpected errors. Specifically, StrictNodes 0 tells Tor that it is okay to use an excluded node when it is necessary to perform relay reachability self-tests, connect to a hidden service, provide a hidden service to a client, fulfill a .exit request, upload directory information, or download directory information. (Default: 0)

6

In addition to ExitNodes {us} and StrictNodes 1, you should also use DNSPort 5553, along with dnsmasq (this is a dns relay program) with --server=/geoblocked.url/127.0.0.1#5553

Then use Tor for ONLY the DNS lookups, since this is the only part that is actually geoblocked.

6

Yes: edit the file: ThisPC\Desktop\Tor Browser\Browser\TorBrowser\Data\Tor\torrc or wherever you put Tor.

at the end put: ExitNodes {GB}

Then the last node will always be in the United Kindom, or put any other country code to exit from another country eg: US.

1
  • 3
    Your answer is not fully correct. The person also needs to specify StrictNodes 1 to always use UK-based nodes. Commented Apr 21, 2016 at 6:42
3

On Windows

  1. Right-click the Tor icon. It's a purple-and-green globe icon that you'll either find on your desktop or in the Start menu.
    If you haven't done so yet, first run Tor so that the appropriate folder is established. Otherwise, you won't be able to set a specific country.
  2. Click Open file location. You'll see this option near the top of the drop-down menu.
  3. Double-click the "TorBrowser" folder. Doing so will open it.
  4. Double-click the "Data" folder.
  5. Double-click the "Tor" folder.
  6. Double-click the "torrc" file. This will open the "Open with" window.
  7. Click Notepad, then click OK. Doing so will open the "torrc" file as a text document, allowing you to edit it.
  8. Locate the "ExitNodes" line. It should be near the bottom of the text on this page. You'll see something like "{us}" to the right of the "ExitNodes" phrase. If you don't see this line of text, copy ExitNodes {} StrictNodes 1 into the file.
  9. Change the value in the bracket to match your preferred country. You can view a comprehensive list of supported countries beneath the "List of country codes for Tor" heading here: http://www.b3rn3d.com/blog/2014/03/05/tor-country-codes/ For example, you would change "{us}" to "{ug}" to transfer your preferred country from the United States to Uganda.
  10. Click File. It's in the top-left corner of the Notepad window.
  11. Click Save As. You'll see this option near the top of the drop-down menu. Since Notepad saves documents as text files automatically, you must use the Save As option to save your updated country file as a Tor file.
  12. Click the "Save as type" box. By default, the box here will say "Text Documents (*.txt)". Clicking it will invoke a drop-down menu.
  13. Click All Files. It's in the drop-down menu. After doing so, you'll see a list of the "Tor" folder's contents appear in the Save As window.
  14. Click the "torrc" file. You'll find it in the Save As window. This will select "torrc" as the file to replace with your updated file.
  15. Click Save. It's at the bottom of the Save As window.
  16. Click Yes when prompted. This will replace the "torrc" file with your new one, thereby saving your country settings.
  17. Open Tor. Doing so will take a minute, since Tor will need to connect with your new country's servers. After it connects, your country settings will be active. You can double-check this by going to Google, clicking the onion icon in the top-left corner of the browser, and looking at the country name above the "Internet" value here.
3

I find that lower case works fine and I also don't need to use StrictNodes. For example I simply add ExitNodes {jp} to my torrc to make the receiver always think the sender is from Japan.

2
  • 1
    as is explained in other answers StrictNodes 1 means that it will fail closed (won't connect) if it can't find an IP that is a match for the country in it's local GeoIP database. If it is not set and there is no relay in the country that also has an exit policy that would allow your chosing it for your traffic, it will choose another relay. See the manual entry for StrictNodes. Also this is probably a better reference list of country codes: en.wikipedia.org/wiki/…
    – cacahuatl
    Commented Jun 30, 2016 at 12:54
  • 1
    you're also correct that the case does not matter, the comparisons are case agnostic.
    – cacahuatl
    Commented Jun 30, 2016 at 13:05
0

Into file /etc/tor/torrc add new line ExitNodes {fr} StrictNodes 1 it will make sure to only connect using French exit nodes.

If you are using Tor browser, then you may need to use different torrc file. Find it using:

A) locate torrc

B) find / -type f -name torrc

-1

AFAIK this is not in the documentation and not in the answer above, so:

The country coude must be in capitals, so:

ExitNodes {NL}

With small letters "{nl}" the line was ignored.

With the following commands you can check that the setting is working:

torsocks curl ipinfo.io/
torsocks curl ipinfo.io/country
1
  • 2
    It does not have to be in capitals. The comparisons are case insensitive/agnostic and infact everything is converted to lowercase when they're read in from the geoip file.
    – cacahuatl
    Commented Jun 30, 2016 at 13:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .