Configuration Port Forwarding ProtonVPN sur Seedbox Alpine (WireGuard + qBittorrent)
Objectif
Permettre le seeding réel (connexions entrantes) via ProtonVPN sur une seedbox Alpine Linux, malgré le NAT-PMP dynamique (port change souvent).
Prérequis
- ProtonVPN Plus ou supérieur (port forwarding disponible)
- WireGuard installé (
wg-quick) - qBittorrent (ou autre client avec API Web)
- Seedbox sous Alpine Linux (OpenRC, pas systemd)
Étape 1 – Config WireGuard avec NAT-PMP activé
- Sur account.protonvpn.com → Downloads → WireGuard configuration
- Choisir un serveur P2P (icône double-flèche)
- Options avancées : NAT-PMP (Port Forwarding) = on
- Décoche Moderate NAT si coché
- Télécharge et remplace
/etc/wireguard/protonvpn/wg0.conf
Points clés du fichier (extrait) :
# NAT-PMP (Port Forwarding) = on
...
AllowedIPs = 0.0.0.0/0 # Supprimer ::/0 pour éviter erreur IPv6
...
Endpoint = 178.249.212.xxx:51820
PersistentKeepalive = 25
Corriger droits et lancer :
Bashchmod 600 /etc/wireguard/protonvpn/wg0.conf
wg-quick down wg0 2>/dev/null || true
wg-quick up /etc/wireguard/protonvpn/wg0.conf
Vérifier IP :
Étape 2 – Installer natpmpc
Sur Alpine, natpmpc est dans le paquet libnatpmp (repo community).
# Activer community si besoin
vi /etc/apk/repositories # Ajouter ou décommenter :
# https://dl-cdn.alpinelinux.org/alpine/edge/community
apk update
apk add libnatpmp
Étape 3 – Tester le port forwarding manuellement
Sortie type :
→ Note le public port (ex. 54436) → c'est ce port que les peers voient.Test externe :
- https://canyouseeme.org → IP = ton IP Proton, Port = 54436 → Success
Étape 4 – Script de renouvellement automatique + update qBittorrent
Le port expire après 60 s → renew toutes les ~45 s.
Fichier : /usr/local/bin/renew-proton-port.sh
#!/bin/sh
QB_URL="http://127.0.0.1:8080"
LOG="/var/log/proton-natpmp.log"
while true; do
natpmpc -a 1 0 tcp 60 -g 10.2.0.1 >> "$LOG" 2>&1
natpmpc -a 1 0 udp 60 -g 10.2.0.1 >> "$LOG" 2>&1
PORT=$(natpmpc -a 1 0 tcp 60 -g 10.2.0.1 | grep "Mapped public port" | awk '{print $4}' | tail -1)
if [ -n "$PORT" ]; then
echo "$(date '+%Y-%m-%d %H:%M:%S') - Port détecté : $PORT" >> "$LOG"
curl -s -X POST "$QB_URL/api/v2/app/setPreferences" \
-d "json={\"listen_port\":$PORT}" >> "$LOG" 2>&1
echo "$(date '+%Y-%m-%d %H:%M:%S') - Port mis à jour dans qBittorrent : $PORT" >> "$LOG"
fi
sleep 45
done
Rendre executable :
Étape 5 – Service OpenRC pour auto-démarrage
Fichier : /etc/init.d/renew-proton-port
#!/sbin/openrc-run
description="Renew ProtonVPN NAT-PMP port forwarding"
command="/usr/local/bin/renew-proton-port.sh"
command_background="yes"
pidfile="/run/renew-proton-port.pid"
depend() {
need net
after wg-quick@wg0
}
Activer et lancer :
chmod +x /etc/init.d/renew-proton-port
rc-update add renew-proton-port default
rc-service renew-proton-port start
Vérifier :
rc-service renew-proton-port status
ps aux | grep renew-proton-port
tail -f /var/log/proton-natpmp.log
Étape 6 – Configuration qBittorrent
-
Options → Web UI → Activer l'interface
-
Cocher : "Bypass authentication for clients on localhost" → Permet au script d'update sans mot de passe dans le script
-
Options → Connexion → Port entrantes : (sera auto-mis à jour par le script)
Résultats attendus
- Port forwarding maintenu
- qBittorrent écoute toujours sur le port public actuel
- Connexions entrantes possibles → seeding actif
- Upload qui augmente sur torrents avec leechers
Astuces / Dépannage
- Si port change souvent → logs confirment l'update
- Si curl API échoue → vérifier bypass localhost + qBittorrent écoute sur 127.0.0.1
- Si wg0 down → service attend net, mais relance manuellement wg-quick up wg0
- Alternative idéale : Docker + Gluetun (gère NAT-PMP + update auto nativement)
Date de config : Février 2026