Skip to content

Route to VPN server is always bound to the first interface #1081

Description

@ferrao

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions