I run almost all traffic through Mullvad VPN on my router(s), but there are a couple of cases where I need to bypass the VPN. I've done that successfully with a simple added routing table and policy rules, and it works fine.
However, my new ISP uses a CG-NAT implementation where not only my own IP changes regularly, but also the gateway address. When that happens, it makes the bypass route fail silently because the WAN gateway is specified explicitly and the old address is no longer valid. I have to notice that it's broken (usually by getting blocked from whatever I needed to do VPN-less) and manually fix the bypass route every time.
What I'd like is a script that checks occasionally (once per hour, maybe?) for a change of the WAN gateway (i.e. current gateway doesn't match what's listed in the bypass route), rewrites the bypass route if needed, and applies it.
As I mentioned in my other topic, I don't have any knowledge at all of shell scripting and this seems much more involved than that (if it's even possible) so I'm asking for some direct help here.
Would any kind soul be willing to A) write a script for this, and B) tell me how to use it (this could just be a link to the appropriate docs page, i.e. cron
or whatever), please?