Is there any way to add a static route automatically when WireGuard connects?

Is there any way to automatically add a static route when wireguard client connects and remove it when it disconnects? I have to ssh into the router and add it manually currently to access devices on my home network from clients on the router when I let the router act as the vpn client and route all traffic via the vpn.

Can you put this in wireguard config? e.g. set allowips?

If you need complicated static router settings, wait for our firmware 4.x.

I already have tried using allowips alone. That is required to get the traffic into the network as well but the problem is that I have to add a route into my home 10.0.0.0/24 network via the gateway of the vpn on the wg0 interface. Otherwise internet over the VPN works fine but no traffic goes into the home network. (Yes the local network I’m using currently is also in the 10.0.0.0/24 range and I’m sure that’s why the route is required but I don’t control that and it is not uncommon to encounter that range.)

Check this guide. The guide shows how to add static route and how to enable it in booting script.