As I couldn't find any guide on how to setup a tor relay on OpenWrt, maybe because it's too simple, I decided to write it myself.
Why would you want to contribute to the tor project? https://www.torproject.org/
Why a relay? Because non-exit relays:
usually do not receive abuse complaints. All relays will be listed in the public list of Tor relays, so may be blocked by certain services that don't understand how Tor works or deliberately want to censor Tor users https://community.torproject.org/relay/types-of-relays/
Ready? Let's go.
- Install the tor package just like you ususally install software, e.g. using LuCI or:
root@router:~# opkg update; opkg install tor
- Edit /etc/tor/torrc. You need to uncomment/modify these lines:
SOCKSPort 0 # run Tor only as a relay Log notice syslog DataDirectory /var/lib/tor ORPort 9001 IPv4Only Nickname writeyournicknamehere ContactInfo <youremailaddress> ExitRelay 0 User tor
- You may want to uncomment and modify these lines as well:
#RelayBandwidthRate 100 KBytes # Throttle traffic to 100KB/s (800Kbps) #RelayBandwidthBurst 200 KBytes # But allow bursts up to 200KB (1600Kb)
Forward the ORPort you specified in torrc (9001 in this example). The easiest way to do this is in LuCI menu Network / Firewall / Port Forwards.
root@router:~# /etc/init.d/tor restart
You can now check the correct execution of the tor relay with
root@router:~# logread -e Tor