Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ruTorrent + rtorrent over Tor Network (Docker)

Your ISP blocks BitTorrent? This image bypasses it. All torrent traffic is routed through the Tor network — your ISP only sees encrypted Tor traffic, not BitTorrent. Works on any network that blocks or throttles torrents.

A single Docker image with ruTorrent + rtorrent + Tor — all torrent traffic is transparently routed through the Tor network using iptables. Your real IP is never exposed to trackers or peers.

[Browser] → :8080 → [ruTorrent Web UI]
                          │
                     [rtorrent] ──iptables──→ [Tor TransPort 9040] ──→ Tor Network ──→ Internet
                                  │
                              [DNS :5353] ──→ Tor DNS ──→ Tor Network

All services run inside one container. Just docker run.

Features

  • rtorrent compiled from source (v0.9.8) with libtorrent (v0.13.8)
  • ruTorrent v5.2.10 web interface
  • Tor built-in — all torrent traffic routed via iptables transparent proxy
  • IP leak protection — DHT, PEX, and UDP trackers disabled
  • Encrypted connections enforced
  • DNS leak protection — DNS resolved through Tor
  • Startup IP verification — logs confirm Tor is working before downloading
  • Nyx — built-in Tor traffic monitor with live bandwidth graphs
  • Watch folders — drop .torrent files to auto-load
  • Persistent storage — downloads survive container restarts

Prerequisites


Deploy Option 1: Docker Run (Easiest)

docker run -d \
  --name rutorrent-tor \
  --cap-add=NET_ADMIN \
  -p 8080:80 \
  -p 6881-6889:6881-6889 \
  -v ./downloads:/srv/rtorrent/download \
  -v ./watch:/srv/rtorrent/watch \
  srayuth089/r_ru-torrent-docker:latest

Done! Open http://localhost:8080

--cap-add=NET_ADMIN is required for iptables to route rtorrent traffic through Tor.

Verify Tor is working

docker logs rutorrent-tor

You should see:

Tor is ready!
Tor exit IP: 185.xxx.xxx.xxx
Real IP: 203.xxx.xxx.xxx
OK: Tor is hiding your real IP.
iptables rules applied — all rtorrent traffic routed through Tor.

Deploy Option 2: Docker Compose

Create docker-compose.yml:

services:
  rutorrent:
    image: srayuth089/r_ru-torrent-docker:latest
    container_name: rutorrent-tor
    restart: unless-stopped
    cap_add:
      - NET_ADMIN
    ports:
      - "8080:80"
      - "6881-6889:6881-6889"
    volumes:
      - ./downloads:/srv/rtorrent/download
      - ./watch/load:/srv/rtorrent/watch/load
      - ./watch/start:/srv/rtorrent/watch/start
    environment:
      - TZ=Asia/Bangkok
docker compose up -d

Deploy Option 3: Build from Source

git clone https://github.com/srayuth089/r_ru-torrent-docker.git
cd r_ru-torrent-docker
docker compose up -d --build

Open http://localhost:8080


Adding Torrents

Option 1: Web UI — Use the ruTorrent web interface at http://localhost:8080

Option 2: Watch folders — Drop .torrent files into:

Folder Behavior
watch/load/ Loads torrent but does NOT auto-start
watch/start/ Loads and starts downloading immediately

How Tor Routing Works

All traffic from rtorrent is transparently redirected through Tor using iptables. Only the rtorrent process is affected — other services (Apache, PHP) are not routed through Tor.

Protection How
All TCP traffic iptables redirects all rtorrent TCP to Tor's TransPort (9040)
DNS iptables redirects all rtorrent DNS to Tor's DNSPort (5353)
DHT disabled dht.mode.set = disable — DHT leaks your real IP
PEX disabled protocol.pex.set = no — Peer Exchange leaks your real IP
UDP disabled trackers.use_udp.set = no — UDP cannot go through Tor
Encryption protocol.encryption.set = allow_incoming,try_outgoing,enable_retry

Monitoring Tor Traffic

Nyx (built-in Tor monitor)

docker exec -it rutorrent-tor nyx

Shows live bandwidth graphs, active Tor circuits, and connection details. Press q to quit.

Quick verification commands

# Check Tor exit IP
docker exec rutorrent-tor curl -s --socks5-hostname 127.0.0.1:9050 https://api.ipify.org

# Verify Tor status
docker exec rutorrent-tor curl -s --socks5-hostname 127.0.0.1:9050 https://check.torproject.org/api/ip
# Returns: {"IsTor":true,"IP":"xxx.xxx.xxx.xxx"}

# Check iptables traffic counters
docker exec rutorrent-tor iptables -t nat -L OUTPUT -n -v

Configuration

Change Web UI Port

docker run -d --cap-add=NET_ADMIN -p 9090:80 ...  # Change 8080 to any port

Adjust Download Speed

Mount a custom .rtorrent.rc:

docker run -d --cap-add=NET_ADMIN \
  -v ./my-rtorrent.rc:/srv/rtorrent/.rtorrent.rc \
  ...

Change Download Location

docker run -d --cap-add=NET_ADMIN \
  -v /path/to/your/folder:/srv/rtorrent/download \
  ...

Commands

# Start
docker run -d --name rutorrent-tor --cap-add=NET_ADMIN \
  -p 8080:80 -p 6881-6889:6881-6889 \
  srayuth089/r_ru-torrent-docker:latest

# Stop
docker stop rutorrent-tor

# View logs
docker logs -f rutorrent-tor

# Monitor Tor traffic (live graphs)
docker exec -it rutorrent-tor nyx

# Check Tor IP
docker exec rutorrent-tor curl -s --socks5-hostname 127.0.0.1:9050 https://api.ipify.org

# Verify Tor
docker exec rutorrent-tor curl -s --socks5-hostname 127.0.0.1:9050 https://check.torproject.org/api/ip

# Get new Tor identity (new circuit)
docker exec rutorrent-tor killall -HUP tor

# Remove
docker rm -f rutorrent-tor

Project Structure

r_ru-torrent-docker/
├── docker-compose.yml            # Docker compose (optional)
├── Dockerfile                    # Single image: Tor + rtorrent + ruTorrent
├── entrypoint.sh                 # Starts Tor → iptables → Apache → rtorrent
├── config/
│   ├── tor/torrc                 # Tor config (SOCKS + TransPort + DNS + ControlPort)
│   ├── rtorrent/.rtorrent.rc     # rtorrent config
│   ├── apache/rutorrent.conf     # Apache virtual host
│   └── rutorrent/config.php      # ruTorrent PHP config
└── watch/
    ├── load/                     # Drop .torrent files (load only)
    └── start/                    # Drop .torrent files (auto-start)

Troubleshooting

Tor not connecting

docker logs rutorrent-tor | grep -i tor
docker exec rutorrent-tor curl -s --socks5-hostname 127.0.0.1:9050 https://api.ipify.org

Slow download speeds

Tor is slower than direct connections. To improve:

  • Get a new circuit: docker exec rutorrent-tor killall -HUP tor
  • Wait — Tor circuits improve over time

No peers found

Check the Trackers tab in ruTorrent. If trackers show errors, the torrent may need more time to announce through Tor.

Web UI stuck on "Loading..."

Restart the container:

docker restart rutorrent-tor

Important Notes

  • Speed: Tor adds latency. This is the tradeoff for privacy.
  • Incoming connections: Peers cannot connect TO you through Tor. Only outbound works.
  • NET_ADMIN: Required for iptables rules. Without it, traffic will NOT route through Tor.
  • Legal use only: For privacy when downloading legal content. Respect copyright laws.

Support This Project

If this helped you, consider buying me a coffee!

Buy Me A Coffee

"Buy Me A Coffee"

License

MIT

About

A fully Dockerized ruTorrent + rtorrent setup that routes all torrent traffic through the Tor network to hide your real IP address.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages