Route to VPN server is always bound to the first interface

オープン
#1,081 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
c

調査の方向性

tun0 と tun1 を使用する 2 つの OpenVPN 設定で問題を再現し、その後、報告に示されているルートテーブルと詳細ログを調べます。各 --route エントリがどのようにトンネルインターフェースに関連付けられているかを追跡します。192.168.100.0/24 と 192.168.101.0/24 のルートがそれぞれのインターフェースにバインドされたままになれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
C
スター
14.8k
フォーク
3.4k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OpenVPN/openvpn のほかの issue

OpenVPN/openvpn の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。