Setting up Tor server for localhost This note was created on 2020-02-11 This note was last edited on 2024-04-02 Tor is an open source implementation of second generation onion routing that provides free access to an anonymous proxy network. Its primary goal is to enable online anonymity[1] by protecting against traffic analysis attacks. By using Tor you can access a blocked websites and Darknet's .onion sites. === Installation === Tor server can be installed on most distros using its package manager. Here's how to install it on Ubuntu/Debian: # apt install tor === Basic configuration === By default Tor use configuration file "/etc/tor/torrc". We are going to configure Tor server to work only with localhost. Add/uncomment following options in configuration file: ~~~ SOCKSPort 9050 SOCKSPolicy accept 127.0.0.1 ~~~ Enable and start the daemon: # systemctl enable tor # systemctl start tor Now you're able to route traffic through Tor network via local port 9050 using SOCKS5 protocol. === Configure to use only specific entry/exit node(s) === Add following options to configuration file: ~~~ EntryNodes {ca} StrictNodes1 ExitNodes {de} StrictNodes1 ~~~ In the example above, Canadian nodes are used as entry and German as exit. --- [1] Please note, routing traffic through Tor doesn't make you anomymous. For this purpose you should use Tor Browser (https://www.torproject.org/download).