dd-wrtでOpenVPN (8)

ルーティング情報
用途としてLAN内にリモートアクセスすることだけを考えていて、デフォルトルートを入れたくない。

dd-wrtのLAN側ネットワークへの経路をプッシュする
OpenVPN - Advanced Options [x] Enable
Additional Config:
push "route 192.168.131.0 255.255.255.0 vpn_gateway"
項目
Redirect default GatewayDisable
Ubuntu側クライアントを切断して、再接続する。
dd-wrt上のログ:
... 20210227 23:22:10 client1/192.168.129.58:54979 PUSH: Received control message: 'PUSH_REQUEST'
20210227 23:22:10 client1/192.168.129.58:54979 SENT CONTROL [client1]: 'PUSH_REPLY route 192.168.131.0 255.255.255.0 vpn_gateway route-gateway 10.10.1.1 topology subnet ping 10 ping-restart 120 ifconfig 10.10.1.2 255.255.255.0 peer-id 0' (status=1)
クライアント側のルーティングテーブル
kenhrd@ubuntu:~$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 10.10.1.1 0.0.0.0 UG 50 0 0 tun0
default 192.168.129.254 0.0.0.0 UG 100 0 0 ens33
10.10.1.0 * 255.255.255.0 U 50 0 0 tun0
link-local * 255.255.0.0 U 1000 0 0 ens33
192.168.122.0 * 255.255.255.0 U 0 0 0 virbr0
192.168.129.0 * 255.255.255.0 U 100 0 0 ens33
192.168.131.0 10.10.1.1 255.255.255.0 UG 50 0 0 tun0
pushした経路が乗るのはいいがdefaultが出るのはおかしい ... クライアント側の設定だった(cf https://askubuntu.com/questions/254031/change-openvpn-clients-default-route)
You can fix that behaviour by editing the VPN connection and on the IPv4 settings tab select the 'Routes...' button. You'll see an option called 'Use this connection only for resources on this network'. Make sure that's enabled and then restart your VPN. That should sort you out.
設定したところでUbuntuのルーティング
kenhrd@ubuntu:~$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.129.254 0.0.0.0 UG 100 0 0 ens33
10.10.1.0 0.0.0.0 255.255.255.0 U 50 0 0 tun0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 ens33
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
192.168.129.0 0.0.0.0 255.255.255.0 U 100 0 0 ens33
192.168.131.0 10.10.1.1 255.255.255.0 UG 50 0 0 tun0

(つづく)