I followed the instructions on this forum, and I am routing all of the traffic via wireguard. Nothing interesting here. However, I noticed that, if I disconnect wireguard, the route stays active, and the servers are unable to reach the internet. If I enable gateway=ping, the route doesn’t work all together. How can I create a backup route in case wireguard link is down.
Since in a generic case, there may be multiple peers associated to a single Wireguard interface, it doesn’t seem a good idea to change the interface state to inactive when a single peer goes down (even though in your case this single peer is the only one associated to that interface).
Hence if you need to deactivate the route via that peer if connection to that peer is down (and bear in mind that many people want the opposite, i.e. that traffic that should go via VPN doesn’t leak in plaintext if the VPN doesn’t work), you need to check the transparency of the tunnel using the same means like in case of WAN failover - using /tool netwatch, a combination of /system scheduler and /system script, or recursive routing.