[tor-bugs] #17172 [Wiki]: A fast guide to run a Win32 tor relay
Tor Bug Tracker & Wiki
blackhole at torproject.org
Sun Sep 27 16:47:59 UTC 2015
#17172: A fast guide to run a Win32 tor relay
-------------------------+----------------------------------
Reporter: TORques | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Tor: unspecified
Component: Wiki | Version: Tor: unspecified
Keywords: Win32 relay | Actual Points:
Parent ID: | Points:
Sponsor: |
-------------------------+----------------------------------
https://www.torproject.org/docs/tor-doc-relay.html.en
Since Vidalia (a graphical interface for Tor) is no longer included in
Tor Browser, there are currently no easy relay packages for Windows and OS
X users. One option might be to run Debian in a VM, or use a different
means of getting a Tor binary on your system (Expert Bundle, Homebrew,
Macports). Please help make this process easier!
Running a Win32 tor relay
@@@@@@@@@@@@@
Succesfully tested on Windows XP SP3 32bit OS.
----
1. Download the Microsoft Windows Tor Expert Bundle from:
https://www.torproject.org/download/download.html.en
----
The Tor Expert Bundle contains just Tor and nothing else. You'll need to
configure Tor and all of your applications manually. This installer must
be run as Administrator. Extract the zip archive to "C:\relay" (or
wherever you want but consider to avoid the spaces in selected path). Now
your tor is installed and ready.
----
2. Open TCP ports in your firewall for the ORPort (443 or 9001 or other)
and the DirPort 9030 (80 or 9030 or other) and set the according
forwarding rules in your router
----
tor.exe will try to automatically forward these ports using NAT-PMP
(common on Apple routers) and UPnP (common on routers from other
manufacturers).
----
3. Increase the number of connections in Windows
----
Write the next code with a text editor and save the file as *.reg
{{{
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
"MaxHashTableSize"=dword:00000800
"MaxUserPort"=dword:0000fffe
"TcpTimedWaitDelay"=dword:0000001e
"TcpNumConnections"=dword:00fffffe
}}}
Hit *.reg and add new settings in Registry.
This are the default settings in Registry:
MaxHashTableSize = 512 (Default = 512, Range = 64-65536)
MaxUserPort = 5000 (Default = 5000, Max = 65534)
TcpTimedWaitDelay = 240 (Default = 240 secs, Range = 30-300)
The "TcpNumConnections" default value is 0x00fffffe (Default = 16,777,214)
but other third party software may reduced this value
For other tpc performance settings use some tweaking software like "TCP
optimizer" http://www.softpedia.com/get/Tweak/Network-Tweak/TCP-
Optimizer.shtml and remove the TCP limitation if necessary with "Half-
open_limit_fix__v4.2.exe" http://www.half-open.com/__
Must reboot for these changes to take effect!
----
3. Create the torrc file
----
First, you need to create a torrc file with a text editor and put the
file in "C:\relay\Data\Tor". Here is the torrc sample for your non-exit
relay (don't forget to set your public IP):
{{{
## this torrc is specific for a non-exit relay
## if you want to run an exit relay read the
https://www.torproject.org/docs/tor-manual.html.en for the specific torrc
settings
Address xxx.xxx.xxx.xxx # your public (external)
IP if you are behind a router/modem
Nickname JustAnotherRelay # this is the relay name -
you can change the nickname as you wish
ContactInfo <example at example.com> # your contact e-mail
address here
ORPort 9001 # you will connect with
other relays through this port (usually 443, 9001 or other port)
DirPort 9030 # this port is used for
receive/send/update the tor directories (usually 80, 9030 or other port)
SocksPort 9050 # the standard socks port
for a relay - TBB use port 9150 by default to not interfere with the relay
ControlPort 9051 # the standard control
port for a relay - TBB use port 9151 by default to not interfere with the
relay
CookieAuthentication 1 # allow connections on the
control port when the connecting process knows the contents of a file
named "control_auth_cookie", which Tor will create in its data directory.
# This authentication
method should only be used on systems with good filesystem security.
(Default: 0)
DataDirectory C:\relay\Data\Tor # path to tor data
directory - change this path accordingly if you installed tor files
elsewhere
GeoIPFile C:\relay\Data\Tor\geoip # path to geoip - change
this path accordingly if you installed tor files elsewhere
GeoIPv6File C:\relay\Data\Tor\geoip6 # path to geoip6 - change
this path accordingly if you installed tor files elsewhere
Log notice file C:/relay/Data/Tor/log # here is the log created
by tor with the relay messages [error], [warn] and [notice]
RelayBandwidthRate 5 MB # you can change your
relay upload/download bandwidth according with your resouces/preferences
RelayBandwidthBurst 10 MB # you can change your
relay upload/download burst bandwidth according with your
resouces/preferences
#NumCPUs 2 # this is optional - use
it only if you have 2 CPUs or more
AvoidDiskWrites 1 # this is good to increase
your SSD lifespan and to increase the relay performances
ProtocolWarnings 1 # tor will log additional
[warn] about other relays incorrect behaviour
PortForwarding 1 # Attempt to automatically
forward the DirPort and ORPort on a NAT router connecting this Tor server
to the Internet.
#If set, Tor will try both
NAT-PMP (common on Apple routers) and UPnP (common on routers from other
manufacturers). (Default: 0)
ExitRelay 0 # you don't want to run an
exit relay
ExitPolicy reject *:* # reject all attempts to
be used as an exit relay
}}}
----
4. Run the Tor relay as an NT service
----
You can run Tor as a service on all versions of Windows except Windows
95/98/ME.To install Tor as a service, you can simply run in a cmd window:
{{{
sc create "Tor Win32 Service" binPath= "\"C:\relay\Tor\tor.exe\" --nt-
service -f \"C:/relay/Data/Tor/torrc\""
}}}
Now your relay is running! tor.exe run in the background until you will
delete it from Task Manager or you will stop the Tor Win32 Service.
----
5. Optional: you can make a controller for your tor server using Python
2.7 and the STEM libraries
----
Install Python 2.7 from the Python site.
Execute "pip install stem" from a cmd window.
Go to the STEM official page https://stem.torproject.org/index.html and
learn how to make and use some .py apps for controlling your running tor
server.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/17172>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list