[BUG] Server mode + host networking + read only = stale wg0 iface, deletes host route on failure
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- docker, linux
- Ambito
- devops, networking
Direzione di ricerca
Inizia tracciando lo script di esecuzione del servizio e lo script di terminazione nel percorso di errore di wg-quick, in particolare la pulizia con ip route del default e l’interfaccia wg0 obsoleta. Riproduci il problema con network_mode: host, in modalità server e in modalità di sola lettura, quindi verifica che un riavvio non riuscito non lasci né una modifica alla route predefinita dell’host né un’interfaccia wg0 non eliminata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
In server mode with network_mode: host and in read-only mode, if wg-quick up fails to bring a tunnel up, the service run script executes ip route del default. Because the container shares the host network namespace, this delete's the HOST's default route, knocking it (and any LAN it routes for) offline except via v6.
This is furthermore self-fulfilling: for some reason the original wg0 iface is always left behind on restart, so every subsequent start-up fails unless the user intervenes by manually deleting the stale wg0. The finish script does not clean it up.
Expected Behavior
A container should never delete the host's default route. ip route del default is a client leak-guard that should be absent from server mode and/or scoped to routes that the container itself created.
The interface wg0 should be cleaned up automatically.
Steps To Reproduce
- Run the container in server mode with
network_mode: hostandread_only: trueon a host whose default route is externally managed, e.g., via DHCP. - Run
docker restart <container_name>
The default route will be gone, but the wg0 interface left behind.
Environment
- OS: Ubuntu Server 24.04, kernel 6.8
- How docker service was installed: community edition repo added to apt
CPU architecture
x86-64
Docker creation
services:
wireguard:
image: linuxserver/wireguard:latest
container_name: wireguard
read_only: true
network_mode: host
cap_add:
- NET_ADMIN
environment:
- PUID=1000
- PGID=1000
- TZ=America/Los_Angeles
- SERVERURL=<redacted>
- SERVERPORT=51820
- PEERS=2
- USE_COREDNS=false
- INTERNAL_SUBNET=10.14.15.0/24
- ALLOWEDIPS=10.0.0.0/24,10.14.15.0/24
- PERSISTENTKEEPALIVE_PEERS=all
volumes:
- ./config:/config
tmpfs:
- /run:exec
restart: unless-stopped
Container logs
───────────────────────────────────────
GID/UID
───────────────────────────────────────
User UID: 1000
User GID: 1000
───────────────────────────────────────
Linuxserver.io version: 1.0.20260223-r0-ls118
Build-date: 2026-07-16T12:47:37+00:00
───────────────────────────────────────
Uname info: Linux PacketFucker3000 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 21:53:05 UTC 2026 x86_64 GNU/Linux
**** Server mode is selected ****
**** PersistentKeepalive will be set for: all ****
**** External server address is set to <redacted> ****
**** External server port is set to 51820. Make sure that port is properly forwarded to port 51820 inside this container ****
**** Internal subnet is set to 10.14.15.0/24 ****
**** AllowedIPs for peers 10.0.0.0/24,10.14.15.0/24 ****
**** PEERDNS var is either not set or is set to "auto", setting peer DNS to 10.14.15.1 to use wireguard docker host's DNS. ****
**** Server mode is selected ****
**** No changes to parameters. Existing configs are used. ****
[custom-init] No custom files found, skipping...
**** Disabling CoreDNS ****
**** Found WG conf /config/wg_confs/wg0.conf, adding to list ****
**** Activating tunnel /config/wg_confs/wg0.conf ****
wg-quick: `wg0' already exists
**** Tunnel /config/wg_confs/wg0.conf failed, will stop all others! ****
RTNETLINK answers: No such process
**** All tunnels are now down. Please fix the tunnel config /config/wg_confs/wg0.conf and restart the container ****
[ls.io-init] done.
- Lingua principale
- Dockerfile
- Stelle
- 3.6k
- Fork
- 440
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di linuxserver/docker-wireguard
-
Bad peer port config Apertano-issue-activity
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
linuxserver/docker-wireguard#416 · 5 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
linuxserver/docker-wireguard#418 · 2 commenti ·
Tutte le issue di linuxserver/docker-wireguard
Issue simili
-
task
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
vsanthanam/JBird#429 ·
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
alexgorbatchev/simple-ptt#14 ·
-
github-request
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
openedx/axim-engineering#1758 · 2 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
components-web-app/docs#92 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100