Change wireguard client without reboot

Well, that's how I want to change the wireguard client on my router without having to restart the router because when I press stop on wireguard it's as if it didn't stop at all.

  • Did you try disable config, save then restart?
  • There's no need to disable such a tunnel, just change any rules and routes sending traffic to it (i.e. the opposite of how you configured it)

Otherwise, you'll need to explain what you mean by "disable".

Maybe I messed it up a bit.
What I want is to switch between vpn wireguard without rebooting the router.

Do you have your wg-interfaces configured in /etc/config/network?
Then you could use:

ifdown <wg-interface-name>
ifup <the-other-wg-interface-name>

Another option is, if you have your wireguard interface configured in /etc/config/network, you can option disabled 1 an interface and option disable 0 the other interface, and do an incremental reload/restart of the network service with ubus call network reload, which does not do the whole /etc/init.d/network restart with bringing everything down, and reconfigures the firewall, but only brings down old interfaces and starting new, or appling changes to existing interfaces. But I don't know where ubus call network reload is documented, I have this for reasons in my personal notes :sweat_smile:

without commands impossible right?
With those commands it works.
But it costs me almost the same to enter those commands as to restart....

https://openwrt.org/docs/guide-user/services/vpn/wireguard/extras#dynamic_connection