I wrote a script in python that sets ufw rules to allow local network access but require all other traffic to be routed over a vpn interface. This is useful if you want to force all traffic to be sent over vpn from your linux machine except local network traffic (for local ssh access and the like). The snippet can be found here on gitlab: https://gitlab.com/snippets/1524634 You can run –help and see the arguments. You’ll have an option to review the ruleset before it applies it as well. Enjoy!