qBittorrent
La configuration de qBittorrent est un peu particulière pour éviter de sortir directement avec les IPs d'Altaïr. Un point de sortie (ici Alshain) est utilisé, et tout le traffic de qBittorrent est routé par ce point de sortie. Un tunnel Wireguard assure la liaison entre Altaïr et Alshain. L'IPv6 est routée directement alors que l'IPv4 est NATé (en deux fois, sur Altaïr et sur Alshain pour le moment).
Configuration réseaux :
Configuration du point VPN pour le point de sortie
# Altaïr
bash -c '(umask 0077; wg genkey > altair.key)'
wg pubkey < altair.key > altair.pub
# Alshain
bash -c '(umask 0077; wg genkey > alshain.key)'
wg pubkey < alshain.key > alshain.pub
# Secret partagé
wg genpsk > altair-alshain.psk
/etc/NetworkManager/system-connections/int-ppsfleet.nmconnection
[connection]
id=int-ppsfleet
type=wireguard
interface-name=int-ppsfleet
[wireguard]
listen-port=51756
private-key=$ALSHAIN_PRIVATE_KEY
[wireguard-peer.$ALTAIR_PUBLIC_KEY]
preshared-key=$ALTAIR_ALSHAIN_SHARED_SECRET
preshared-key-flags=0
allowed-ips=10.114.20.10/32;2001:bc8:24d8:114:20:10::/96;
[ipv4]
address1=10.114.20.1/24
method=manual
[ipv6]
address1=2001:bc8:24d8:114:20::1/80
addr-gen-mode=stable-privacy
method=manual
sudo systemctl restart NetworkManager
Configuration du réseau sur Altaïr
external avec comme ID 200 en ajoutant la ligne suivante au fichier /etc/iproute2/rt_tables.
200 external
/etc/NetworkManager/system-connections/int-ppsfleet.nmconnection avec le contenu suivant.
[connection]
id=int-ppsfleet
uuid=fe155cee-4941-3f9b-a441-a7fd21d2412a
type=wireguard
interface-name=int-ppsfleet
[wireguard]
peer-routes=false
private-key=$ALTAIR_PRIVATE_KEY
[wireguard-peer.$ALSHAIN_PUBLIC_KEY]
endpoint=[2001:bc8:24d8::]:51756
preshared-key=$ALTAIR_ALSHAIN_SHARED_SECRET
preshared-key-flags=0
allowed-ips=0.0.0.0/0;::/0;
[ipv4]
address1=10.114.20.10/24
method=manual
route-table=200
gateway=10.114.20.1
routing-rule1=priority 5 oif int-ppsfleet table 200
[ipv6]
addr-gen-mode=stable-privacy
address1=2001:bc8:24d8:114:20:10::1/112
method=manual
route-table=200
gateway=2001:bc8:24d8:114:20::1
routing-rule1=priority 5 oif int-ppsfleet table 200
/etc/NetworkManager/system-connections/net-external.nmconnection avec le contenu suivant.
[connection]
id=net-external
uuid=d72a0e46-85bc-4b4c-bb64-fb904c463894
type=bridge
autoconnect=true
interface-name=net-external
[ethernet]
[bridge]
stp=false
[ipv4]
address1=10.89.0.1/24
method=manual
routing-rule1=priority 5 from 10.89.0.0/24 table 200
[ipv6]
addr-gen-mode=default
address1=2001:bc8:24d8:114:20:10:1:1/112
method=manual
routing-rule1=priority 5 from 2001:bc8:24d8:114:20:10:1:0/112 table 200
sudo systemctl restart NetworkManager
/etc/sysconfig/nftables.conf
table ip6 nat {
chain POSTROUTING {
type nat hook postrouting priority srcnat; policy accept;
ip6 saddr 2001:bc8:24d8:114:20:10:1:0/112 return
#iifname tun0 masquerade
}
}
sudo systemctl restart nftables
Créer le conteneur qBittorrent sur Altaïr
sudo cp /usr/share/containers/containers.conf /etc/containers/
sudo mkdir -p /opt/cni/bin
sudo mkdir -p /etc/cni/net.d
curl -L https://github.com/containernetworking/plugins/releases/download/v1.3.0/cni-plugins-linux-amd64-v1.3.0.tgz | sudo tar -C /opt/cni/bin -zxv
#netavark, le bridge se fait supprimer avec le dernier conteneur qui l'utilise ce qui rend impossible la configuration via le système, donc les règles de routage fines qui vont avec). Editer le fichier /etc/containers/containers.conf:
[network]
network_backend = "cni"
cni_config_dir = "/etc/cni/net.d"
/etc/cni/net.d/87-external-bridge.conflist
sudo{
podman"cniVersion": network"0.4.0",
create"name": --interface-name"net-external",
"plugins": [
{
"type": "bridge",
"bridge": "net-externalexternal",
--ipv6"isGateway": net-externaltrue,
"ipMasq": true,
"hairpinMode": true,
"ipam": {
"type": "host-local",
"routes": [{ "dst": "0.0.0.0/0" }, { "dst": "::/0" }],
"ranges": [
[
{
"subnet": "10.89.0.0/24",
"gateway": "10.89.0.1"
}
],
[
{
"subnet": "2001:bc8:24d8:114:20:10:1:0/112",
"gateway": "2001:bc8:24d8:114:20:10:1:1"
}
]
]
}
},
{
"type": "portmap",
"capabilities": {
"portMappings": true
}
},
{
"type": "firewall"
},
{
"type": "tuning"
}
]
}
sudo podman run -d --name=qbittorrent \
-e PUID=985 -e PGID=985 -e TZ=Europe/Paris -e WEBUI_PORT=8080 \
-p '[::1]:8080:8080' -p 127.0.0.1:8080:8080 -p 6881:6881 -p 6881:6881/udp \
-v /var/opt/qbittorrent/config:/config:Z -v /data/downloads:/downloads:Z \
--restart always \
--network net-external \
lscr.io/linuxserver/qbittorrent:latest
sudo podman generate systemd --new --name qbittorrent | sudo tee /etc/systemd/system/qbittorrent.service
systemctl daemon-reload
systemctl enable qbittorrent