How to Share Pi OS via Torrent [with VPN]
First of all: Why sharing Raspberry Pi OS?
I got some incompatibility issues with some IoT Projects and the latest Pi Images (bookworm, DEBIAN12).
So want to make sure that the projects that I place effort on will continue to work.
We can get Legacy images from here
But what if at some point they wont be available?
The raspberry team provides for each image a .torrent
file so that any of us will become P2P keepers of the OS history.
How to Setup Torrents for a Raspberry Pi
I have been collecting some similar interesting Services to spin with Docker.
You have many alternatives, among them: QBittorrent, Transmission,…
Qbittorrent with the Raspberry Pi
You need this docker-compose config file:
---
version: "2.1"
services:
qbittorrent:
image: ghcr.io/linuxserver/qbittorrent
container_name: qbittorrent
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Madrid
- WEBUI_PORT=6011
volumes:
- /home/Docker/qbittorrent/config:/config
- /home/Downloads:/downloads
#network_mode: "container:your_gluetun_container_name" #change gluetun to your VPN container name
#network_mode: "service:your_gluetun_service_name" #change gluetun to your VPN service name
# ports: #you wont need the ports in this configuration file, you will need to include them in the Gluetun container
# - 6081:6881
# - 6081:6881/udp
# - 6011:6011
restart: unless-stopped
Thanks to this guide and this one for Transmission
Transmission with the Pi
---
version: "2.1"
services:
transmission:
image: ghcr.io/linuxserver/transmission
container_name: transmission
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Madrid
ports:
- 9091:9091 #UI Port for Transmission
- 51413:51413
- 51413:51413/udp
volumes:
- /home/Docker/Torrents/Transmission/config:/config
- /home/Downloads:/downloads
- /home/Downloads/Transmission_watch:/watch
restart: unless-stopped
How to Torrent with a VPN
Here I want to show you have to do it using the VPN you just setup.
But you can do similarly with 3rd party VPNs.
Choose one and use your wg0
network interface from the wireguard client:
version: "2.1"
services:
qbittorrent:
image: ghcr.io/linuxserver/qbittorrent
container_name: qbittorrent
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Madrid
- WEBUI_PORT=6011 #UI PORT FOR QBITTORRENT
#network_mode: "container:your_gluetun_container_name" #change gluetun to your VPN container name
#network_mode: "service:your_gluetun_service_name" #change gluetun to your VPN service name
# ports: #you wont need the ports in this configuration file, you will need to include them in the Gluetun container
# - 6081:6881
# - 6081:6881/udp
# - 6011:6011
volumes:
- /home/Docker/qbittorrent/config:/config
- /home/Downloads:/downloads
network_mode: "host" # Use the host network stack (which includes wg0)
restart: unless-stopped
Key Points to understand:
network_mode: "host"
- This allows the container to share the host network stack directly, including the
wg0
interface.
- This allows the container to share the host network stack directly, including the
No Port Mapping
- When using
network_mode: "host"
, port mapping (ports:
) is unnecessary since the container uses the host’s network stack.
- When using
Ensure
wg0
is Active- Before starting the container, ensure that your WireGuard interface (
wg0
) is active and routes traffic properly. Use the following command to check:
- Before starting the container, ensure that your WireGuard interface (
wg show
- Routing Through WireGuard
- Verify that your host system routes the necessary traffic through the WireGuard tunnel. For example, you may need to ensure that the
qBittorrent
container traffic follows the correctwg0
routing rules.
- Verify that your host system routes the necessary traffic through the WireGuard tunnel. For example, you may need to ensure that the
Verify the Setup After starting the container with docker-compose up -d
:
- Access the
qBittorrent
Web UI athttp://<host-ip>:6011
. - Verify the external IP of your
qBittorrent
traffic to confirm it uses the WireGuard tunnel:- Check your IP address via a tracker (e.g., ipleak.net) or using the tracker settings in
qBittorrent
.
- Check your IP address via a tracker (e.g., ipleak.net) or using the tracker settings in
#docker exec -it qbittorrent sh
curl -sS https://ipinfo.io/json #the command to use
#wget -qO- https://ipinfo.io/json
#for windows you would use
#powershell -Command "(Invoke-WebRequest -Uri https://ipinfo.io/json).Content"
Conclusiones
So thats it for now.
You you can improve software availability and resilience.
Kind of share your work, but…share what you’ve saved?
At least, Ill keep a copy of Raspberry Pi OS (Debian 11) for the Pi.
And probably some good Armbian for the Orange Pi 5
FAQ
VPN Providers
Setup a VPN with Wireguard on a VPS
How to use Gluetun
How to check IPs
curl -sS https://ipinfo.io/json #the command to use
curl -sS http://ip-api.com/json/ #provides info about country, ISP, ...
curl -6 ifconfig.me #ipv6 info