[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Add route exception in NetworkManager vpn



On Tue, 11 Oct 2022, Erwan David wrote:

Hi,

I use a vpn with network manager which routes everything through it.
I'd like to add some exceptions for local or not so local ressources that cannot be reached through the VPN. The ideal situation would be to be able to give as gateway for those routes "the default gateway before the VPN was up".
Is there a way to do this ?

It may be through a dispatcher script at vpn-preup time, but I'm not sure by reading the doc if the routes have been changed at that time or not.

The original route must still be there or the VPN itself couldn't stay
up although possibly now as a route to a single IP.

So provided you can find that route, you can create more routes via the
same next-hop.

so something like:

ip route add 8.8.8.8/32 via 1.2.3.4 dev isp


After the vpn is up, use ip route show (and possibly ip rule show) to
see how the vpn traffic is routed.


Reply to: