Configure Tor to use a specific country as an exit node
Many Internet services offer access to their services only if you are visiting the websites or applications from certain countries.
System IP addresses and sometimes additional information such as the system time, are checked when a user wants to access a country restricted service. If the IP is located in an allowed country access is allowed, otherwise it is rejected.
Many workarounds exist that help users access these restricted services even if they are currently residing in a different country. This articles look at how you can configure the anonymization client Tor to have the exit node of the network in a specific country.
Tor offers lots of so called nodes which are servers in a specific country running the Tor software. If you just run the software, an exit node is picked for you automatically. What most users don't know is that it is possible to customize the selection.
I'm using Vidalia, a package that contains all necessary programs, to explain how a specific country can be selected when using Tor. Note that it is included as part of the Tor Browser which you can download here.
Download The Tor browser and install/run the software afterwards. The main program interface looks like the one on the screenshot below when you run Vidalia for the first time.
The control panel displays the current status of Tor. Additional information is displayed which we are going to use to find servers located in the country that we need an IP address from. A click on view the network displays a visual representation of all Tor servers but only if Tor is running.
Servers can be sorted by country flag and do have a performance indicators next to them as well. Write down some server names with the best performance and leave the menu again. We need to add those servers as exit nodes to the Tor configuration. A click on Settings and there on the advanced tab displays a menu where you find the entry Tor Configuration Menu.
A click on browse opens the browse for files dialog. Left-click on the file "torrc" and choose edit from that menu. Now add the following two lines to the configuration, just paste it at the beginning for instance:
ExitNodes server1, server2, server3
StrictExitNodes 1
Replace server1, server 2 and so on with the server names that you have written down in the network display window. Stop and restart Tor afterwards and the changes should have been made.
Note: the following step is not required if you are using the Tor Browser bundle directly. If you plan to use a different browser, it needs to be made.
Now we have to add a http proxy to our browser. Firefox users click on Tools > Options > Advanced Network and there on the button Settings. Select Manual Proxy Configuration and enter localhost and port 8118 there.
You can test if everything is working fine by visiting my IP lookup script which should display a IP from the country that you have selected the servers from.
For information, the TOR country code list is available here -> http://startup-bootcamp.fr/liste-des-codes-des-pays-tor/
This article is in French, but the list is the right.
Guys. how can I connect to an Iran’s server so that my IP will be detected as if I am connected in Iran (I am leaving abroad now)?
I use a much easier way: In TorK, you can click on “Be from…” and select a country. When done, you can reset the state as easily. It’s a pity that this tool seems more or less unmaintained (although still available in the latest openSUSE distro) and is KDE-centric. But it shouldn’t be too hard to make it work elsewhere since it’s open source software.
why don’t they just make the network map double-clickable to change exit node? because it would be too convenient? you get these brilliant minds at work and they develop a stupid flaw in their program. how does that happen? I don’t understand server node this and that.. I just want to click and connect.
Whenever I add the two lines below to my Windows 7 torrc file, my Tor Browser Bundle on complains that the proxy server is refusing connections.
StrictExitNodes 1
ExitNodes {US}
Specifically, I get the error below:
The proxy server is refusing connections. Firefox is configured to use a proxy server that is refusing connections. Check the proxy settings to make sure that they are correct. Contact your network administrator to make sure the proxy server is working.
My Tor Browser Bundle is the latest update, it works just fine WITHOUT the two lines added of:
StrictExitNodes 1
ExitNodes {US}
So, there isn’t enough information in this blog to actually perform the task well enough to actually work.
To help determine the problem,
I first tried to load a torrc.txt (instead of a torrc), so, thinking that was the problem, I changed the setting back to torrc.
However, that changed nothing. I then noticed the existing line:
StrictNodes 1
This line was in addition to the two lines added:
StrictExitNodes 1
ExitNodes {US}
Do you think we should remove the “StrictNodes” line?
Do you think the ONLY file name usable is “torrc” ?
** Update **
ExitNodes now is a problem with Tor.. They’re working on it. Cause everytime every ip ends in the middle of the sea. And de StrictExitNodes has changed into StrictNodes
Awesome!!! Thanks
People, this works, even today. View my date posted up above. See, it worked for me . . . even today.
If you’re getting an error at line 1 a simple Google search may explain why.
But just in case, and because I’m not a du . . . arrogant buttwipe prick, (for the devout and youngins reading this) it was solved by simply deleting the comment lines at the top of the file. Notice how the first line says that you cannot save comments. Those top two lines are comment lines. They’re causing your error. Delete them, and it should save just fine and even work too.
Not sure if the step of setting up a proxy is still necessary though since the Tor bundle comes with it’s own modified Firefox browser that is already set up to use the Tor network. This last step may be outdated and come from a time when Firefox literally did need to be set up to use the Tor network. I’m not using it, but I’m also still a noob at this, so I could be wrong.
thankyou – Nice clear instruction with all info!…. respect
ExitNodes solved my problem to use any specfic IP at my choice. Thanks for your article. I liked it 10/10
i have the same problem:
The proxy server is refusing connections
Firefox is configured to use a proxy server that is refusing connections.
How did you fix it?
by
Please ignore my previous comment regarding the proxy settings. I had made a mistake which I finally realised and then fixed. It works just fine now. Thanks so much.
Please Sharan, how did you fix it?
I think i made the same mistake, but I can’t find it :(
After making these settings, when I click on the “IP lookup” hyperlink, I get this error message:
The proxy server is refusing connections
Firefox is configured to use a proxy server that is refusing connections.
I wonder if any other changes are to be made. The devil is in the details.
Trying this with either
ExitNodes server1, server2, server3
StrictExitNodes 1
or
ExitNodes {US}
results in an error message; “Error at line 1: “” when I try to save the changes, once I remove the added lines I still get the ertror and have to cancel out, do I have to change the parameter for vidalia 0.2.21/tor 0.2.3.25?
Delete the first line of your file (StrictExitNodes 1).
Just use ExitNodes {US}
So, this isn’t working for me. I’m using the country code US in my torrc like so:
StrictExitNodes 1
ExitNodes {US}
But I’m still getting exit nodes from Western Europe and the US. I’m using the Vidalia bundle, though I’m starting Tor and Polipo from the command line programmatically and executing HTTP requests that way. Any thoughts? I really, really need the exit nodes to only be from the US.
I wonder if it will help to reverse the order of those two lines. Put the StrictExitNodes line last (follow the order given in the instructions). Just something to try out. I really don’t know if the order matters.
Nevermind: Tor wasn’t using the torrc file I thought it was using. I forced it to use the edited one by adding the “-f” argument to the command line when I start it.
Big big thanks for useful info
Thanks Lerome, great hint. Works with the TOR browser-package as well, just don’t forget to activate your flash-player extension if you intend to watch tv abroad..
Just edit the file and save it. The comments will be deleted (you don’t need those) and the new file will replace the old one, which will be renamed, as it says.
it says this
# 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
what should i do
This methods does not work for the latest version of vidalia bundle as of 18/05/2012
Jack – it works for me as of 9Jul2012. But once done, I can’t seem to restore it to its factory setting of randomly picking an exit node country.
I need to access a UK web site while in France. The site blocks non-UK IP addresses. I simply added the following line of code to the torrc file (do this by going to Settings in the Vidalia Control Panel, then selecting Advanced. Then hit the button that says Edit current torc. Add this in a new line immediately after the end:
ExitNodes {gb}
Best to copy and paste it!
The country abbreviation is in brackets – in this case gb is Great Britain. Try the appropriate abbreviation for your own country.
I have found that this works reliably. It is simple to check by going to View the Network in the Vidalia Control Panel. The connections will be shown in a box. By left-clicking on one of the connections, its details will be show so that you can check the country.
Does, e.g., “ExitNodes {gb}”, etc., still work in the recent Tor? I don’t think it does.
@Lerome : It works! Thank u!!
Thank you.
You are amazing. Thank you.
thanks very much worked as described on Mc Os with vidalia and firefox 5
I followed instructions to edit the exit nodes, but they keep getting overwritten and replaced by :
# 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
Any advice welcome
I’ll make sure to give back the bandwidth I take then
Thanks, it works for just the first 3 server I chose for one country, But when I stop tor and change to another different 3 server from the same country, tor refuse to start. Do you have any advise?
Many youtube videos are blocked in various countries. Tor is possibly the simplest way for these people to access them, so although it is bad in that it degrades the entire network by hogging bandwidth, it’s also understandable why people would still choose to do it. I do not think it is something that will stop, it will only become worse.
I can’t find that “Browse” button, is it the settings button you mean?
Thanks!
I agree with the concern about leeching TOR bandwidth for inefficient services, like video streaming or downloads etc.
In the end it will only degrade TOR for everyone.
I understand that a lot of people use Tor to access streaming services. Please, understand that the Tor network is run by volunteers and is already slow. Using it for video streaming puts a heavy strain on the few existing exit nodes, thereby deteriorating speeds for users who, for example, would like to access Wikipedia or other site banned in their country.
Thank you.
Thanks friend, great advice and worked great! I now listen to last.fm for free!!!
The same problem. Tor won’t start after making the adjustments above. tor.pa goes to “www.pandora.com” so thats useless. Anyone have a proxy in an a rated place?
I had to use this config file to get the browser to use the exitnodes I entered in the torcc file:
http://openpandora.googlepages.com/tor.pac
Just save it in any folder you want and enter the path (file:///c: …) in the last box of the connections settings page which was mentioned in this article.
i am in ksa and i want to open some sites which are blocked. i am using tor but can not access such
thanks
Nice article but unfortunately I can’t get this to work. I keep getting a local IP address.
Tor Proxy Software Tutorial – Get an IP in a Specific Country
http://www.youtube.com/watch?v=5iLCgRHp_2k
fools how can u cay it is nice if its not working
Ha ha ha! It reminds me of a guy who one day told my co-worker (looking at her screen) “That’s wonderful!”. Then he added “What is it?”.