I wanted to posted my guide on how to use any app including qbittorrent with a VPN in the new Electric Eel version.
- Install the dockge app from Truenas.
- Compose an image for the VPN, use this docker compose.yaml code and change as needed:
This code comes from: https://hub.docker.com/r/qmcgaw/gluetun
version: "3"
services:
gluetun:
image: qmcgaw/gluetun
container_name: gluetun
# line above must be uncommented to allow external containers to connect.
# See https://github.com/qdm12/gluetun-wiki/blob/main/setup/connect-a-container-to-gluetun.md#external-container-to-gluetun
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun:/dev/net/tun
ports:
- 8888:8888/tcp # HTTP proxy
- 8388:8388/tcp # Shadowsocks
- 8388:8388/udp # Shadowsocks
- 8080:8080 #qbittorrent
- 6881:6881 #qbittorrent
- 6881:6881/udp #qbittorrent
volumes:
- /mnt/YOUR_TRUENAS_DATASET/DATASET_DIR:/gluetun
environment:
# See https://github.com/qdm12/gluetun-wiki/tree/main/setup#setup
- VPN_TYPE=openvpn
- VPN_SERVICE_PROVIDER=REPLACE_WITH_YOUR_VPN_NAME
- OPENVPN_USER=YOUR_VPN_OpenVPN_IKEv2_USERNAME
- OPENVPN_PASSWORD=YOUR_VPN_OpenVPN_IKEv2_PASSWORD
- SERVER_COUNTRIES=THIS_IS_PROTON_VPN_SPECIFIC_SETTING
- TZ=YOUR_TIMEZONE
- UPDATER_PERIOD=
- Compose an image for any app you would like to run thru the VPN, In this example qbittorrent.
Use this docker compose.yaml code and change as needed:
services:
qbittorrent:
image: lscr.io/linuxserver/qbittorrent:latest
container_name: qbittorrent
environment:
- PUID=YOUR_TRUENAS_USER_ID
- PGID=YOUR_TRUENAS_GROUP_ID
- TZ=YOUR_TIMEZONE/UTC
- WEBUI_PORT=8080
- TORRENTING_PORT=6881
volumes:
- /mnt/YOUR_TRUENAS_DATASET/QBITTORRENT_DIR:/config #Directory you want to save your qbit config files
- /mnt/YOUR_TRUENAS_DATASET/MEDIA_DIR:/media #movies/series/music directory
restart: unless-stopped
network_mode: container:gluetun #this is what makes the app to connect to the VPN.
# Note that all ports were moved to the gluetun app.
-
Troubleshooting
- Make sure the app you want to connect have the network_mode: container:gluetun and that all the ports are moved to the gluetun app.
- If app is not opening after applying the settings. Click the Stop & Inactive button (hidden under the stop button). Then try again.
- Make sure apps are running.
- Test qbittorrent is behind VPN by using the ipleak.net torrent tool
-
To use Wireguard instead, substitute this code with the OpenVPN code on step 2:
(Please note the devices setting is not included for wireguard)
version: "3"
services:
gluetun:
image: qmcgaw/gluetun
container_name: gluetun
cap_add:
- NET_ADMIN
ports:
- 8888:8888/tcp # HTTP proxy
- 8388:8388/tcp # Shadowsocks
- 8388:8388/udp # Shadowsocks
- 8080:8080 #qbittorrent
- 6881:6881 #qbittorrent
- 6881:6881/udp #qbittorrent
volumes:
- /mnt/YOUR_TRUENAS_DATASET/DATASET_DIR:/gluetun
environment:
- VPN_TYPE=wireguard
- VPN_SERVICE_PROVIDER=REPLACE_WITH_YOUR_VPN_NAME
- WIREGUARD_PRIVATE_KEY=REPLACE_WITH_YOUR_VPN_PRIVATE_KEY
- WIREGUARD_ADDRESSES=REPLACE_WITH_YOUR_VPN_ADDRESS
- WIREGUARD_PUBLIC_KEY=REPLACE_WITH_YOUR_VPN_PUBLIC_KEY
- WIREGUARD_ENDPOINT_IP=REPLACE_WITH_YOUR_VPN_SERVER_ENDPOINT_IP
- WIREGUARD_ENDPOINT_PORT=OPTIONAL_REPLACE_WITH_YOUR_VPN_SERVER_ENDPOINT_PORT_IF_NOT_51820 # do not include this line if port is 51820.
- WIREGUARD_PRESHARED_KEY=OPTIONAL_REPLACE_WITH_YOUR_VPN_PRESHARED_KEY