add a route for VPN with NetworkManager
In your case, ip r add 10.1.0.0 dev tun0
adds a "device route". That is, there is no gateway—meaning the gateway is 0.0.0.0
.
In Network Manager just configure 0.0.0.0
as gateway.
What you currently cannot do with Network Manager is to use special wildcards to refer to the actual gateway as provided from the VPN (or DHCP, autoconf). Similar to OpenVPN's special names vpn_gateway
or net_gateway
.
Related videos on Youtube
Philipp Grigoryev
Updated on September 18, 2022Comments
-
Philipp Grigoryev over 1 year
Is it possible to add a route with NetworkManager for a VPN connection by using an interface name instead of a gateway address?
I don't know an IP of my gateway after I'm connected to the VPN server, so I manually add a couple routes with
ip r add 10.1.0.0 dev tun0 ip r add 10.2.0.0 dev tun0
Looking for a way to make it happening automatically, preferably with NetworkManager, if not then with some post-up script.
TIA!