Opened 4 years ago

Last modified 17 months ago

#17172 assigned enhancement

A fast guide to run a Win32 tor relay

Reported by: TORques Owned by: phoul
Priority: Medium Milestone:
Component: Community/Relays Version:
Severity: Normal Keywords: Win32 relay tor-docs windows
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


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:

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.

  1. 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).

  1. 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


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" and remove the TCP limitation if necessary with "Half-open_limit_fixv4.2.exe"

Must reboot for these changes to take effect!

  1. 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 for the specific torrc settings

Address				# 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 <>		# 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

  1. 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.

  1. 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 and learn how to make and use some .py apps for controlling your running tor server.

Child Tickets

Change History (6)

comment:1 Changed 2 years ago by nickm

Keywords: tor-docs windows added
Severity: Normal

comment:2 Changed 20 months ago by teor

Component: Internal Services/WikiCommunity/Relays
Milestone: Tor: unspecified
Owner: set to Nusenu
Version: Tor: unspecified

Re-assigning this ticket to the relay component.
Does the tor relay guide have a windows section?

comment:3 in reply to:  2 Changed 20 months ago by cypherpunks

Owner: Nusenu deleted
Status: newassigned

Replying to teor:

Re-assigning this ticket to the relay component.
Does the tor relay guide have a windows section?

It does not have a windows section and it is unlikely I will add one but if someone wants to add and maintain such a section, feel free.

comment:4 Changed 20 months ago by cypherpunks

Status: assignednew

comment:5 Changed 18 months ago by phoul

Owner: set to phoul
Status: newassigned

comment:6 Changed 17 months ago by nusenu

According to phoul, Jaruga is working on this here:

eventually it should be located here:

a few comments:

  • the guide is missing with what user the steps need/should be performed
  • it is unusual to have program binaries in their own folder on the top level folder c:\ (instead of program files)
  • under what user is tor running? (please don't recommend users to run it with their ordinary account)
  • the current guide appears to require manual steps to start tor every time, shouldn't we aim for a service that starts at boot?

I believe the actual thing to do here (mid-therm) would be to create an installer for Windows.
The installer would ask the user a few simple questions:

  • do you want to run a relay? (non-exit)
    • if yes:
    • what ORPort do you want to use? (this needs to be reachable from the outside)
    • what contactInfo do you want to use for your relay? (this will be published)
    • do you want to start your relay after completing the installation?

based on the answers

  • the binary is installed
  • the torrc configuration is generated automatically
  • the folders with proper permissions is setup
  • the tor service is created
  • tor is started

this should also include a auto-updater otherwise we will end up with lots of outdated Windows based tor relays if tor relays on Windows gains traction

Note: See TracTickets for help on using tickets.