Route to VPN server is always bound to the first interface

Aperta
#1,081 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
c

Direzione di ricerca

Riprodurre il problema con le due configurazioni OpenVPN che usano tun0 e tun1, quindi esaminare la tabella di routing e i log dettagliati mostrati nel report. Tracciare il modo in cui ogni voce --route viene associata alla relativa interfaccia del tunnel. Il lavoro è completato quando le route 192.168.100.0/24 e 192.168.101.0/24 rimangono associate alle rispettive interfacce.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I establish two VPNs with OpenVPN. Each one get's it's own interface tun0 and tun1
But the route configured with the --route argument always get's applied to the first interface (tun0).

Both VPNs have the bellow config:

client
dev tun
remote zzz.zzz.zzz.zzz 10443 tcp
tun-mtu 1400
tls-client
nobind
user nobody
group nobody
ping 15
ping-restart 45
persist-tun
persist-key
mute-replay-warnings
verb 3
cipher AES-256-CBC
auth SHA256
pull
auth-user-pass
connect-retry 1
reneg-sec 3600
remote-cert-tls server

I can see the following output from running openvpn:

VPN1

2026-07-22 13:28:59 net_route_v4_best_gw query: dst 0.0.0.0
2026-07-22 13:28:59 net_route_v4_best_gw result: via 192.168.1.1 dev wlan0
2026-07-22 13:28:59 net_route_v4_best_gw query: dst zzz.zzz.zzz.zzz
2026-07-22 13:28:59 net_route_v4_best_gw result: via 192.168.1.1 dev wlan0
2026-07-22 13:28:59 TUN/TAP device tun0 opened
2026-07-22 13:28:59 tun/tap device [tun0] opened
2026-07-22 13:28:59 net_iface_mtu_set: mtu 1400 for tun0
2026-07-22 13:28:59 net_iface_up: set tun0 up
2026-07-22 13:28:59 net_addr_v4_add: xxx.xxx.xxx.xxx/24 dev tun0
2026-07-22 13:28:59 net_route_v4_add: 192.168.100.0/24 via xxx.xxx.xxx.xxx dev [NULL] table 0 metric -1

VPN2

2026-07-22 13:29:03 net_route_v4_best_gw query: dst 0.0.0.0
2026-07-22 13:29:03 net_route_v4_best_gw result: via 192.168.1.1 dev wlan0
2026-07-22 13:29:03 net_route_v4_best_gw query: dst zzz.zzz.zzz.zzz
2026-07-22 13:29:03 net_route_v4_best_gw result: via 192.168.1.1 dev wlan0
2026-07-22 13:29:03 TUN/TAP device tun1 opened
2026-07-22 13:29:03 tun/tap device [tun1] opened
2026-07-22 13:29:03 net_iface_mtu_set: mtu 1400 for tun1
2026-07-22 13:29:03 net_iface_up: set tun1 up
2026-07-22 13:29:03 net_addr_v4_add: yyy.yyy.yyy.yyy/24 dev tun1
2026-07-22 13:29:03 net_route_v4_add: 192.168.101.0/24 via yyy.yyy.yyy.yyy dev [NULL] table 0 metric -1

But on my route table:

192.168.100.0   xxx.xxx.xxx.xxx  255.255.255.0   UG    0      0        0 tun0
192.168.101.0   yyy.yyy.yyy.yyy  255.255.255.0   UG    0      0        0 tun0

If I remove the second route and re-add it to tun1, everything works as I expected to.
I have also tried to use dev tun0 and dev tun1 on each ovpn file, but it makes no difference, I still get both routes added to tun0

  • OS: Arch Linux
  • OpenVPN version: 2.7.5 [git:makepkg/b25bb2a8bda814ed+] x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] [DCO] built on Jul 1 2026
    library versions: OpenSSL 3.6.3 9 Jun 2026, LZO 2.10
Lingua principale
C
Stelle
14.8k
Fork
3.4k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenVPN/openvpn

Tutte le issue di OpenVPN/openvpn

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.