ACTIVITY
Timeline
Timeline for the post: systemd-networkd restores stale IPv4 default route after VPN disconnect on Ubuntu 22.04
Currently licensed under: CC BY-SA 4.0
| When | What | By | License | Comment |
|---|---|---|---|---|
Oct 27, 2026, 9:31:39 AM 4w ago | Answer | elincode | CC BY-SA 4.0 | First check whether the kernel actually keeps the orphan route: after you stop the VPN run 'ip route' and 'ip -d route show table main' — if the default via the tun interface is present, delete it with 'ip route del default dev <tun0>' and confirm connectivity. To prevent recurrence prefer letting systemd-networkd manage routes: start OpenVPN with --route-noexec (or add 'route-noexec' to client config) and implement a simple PostDown script that runs 'ip route flush dev $dev' (safe, reversible). Also set an explicit metric for the physical NIC in netplan so it remains preferred if a stale route appears. Verify fix by cycling the VPN and confirming ip route shows only the intended default; roll back by removing route-noexec or the PostDown script if it causes regressions. |
Oct 27, 2026, 9:31:39 AM 4w ago | Solution accepted | techtony | An answer was marked as the accepted solution. | |
Oct 27, 2026, 9:31:39 AM 4w ago | Created | techtony | CC BY-SA 4.0 | systemd-networkd restores stale IPv4 default route after VPN disconnect on Ubuntu 22.04 |