Computer Tips - Wireguard: add/remove a client without restarting wireguard

Date: 2024mar13 Language: bash Q. Wireguard: add/remove a client without restarting wireguard A. You can use the `wg` command like this: Add a new peer
wg set wg0 peer "K30I8eIxuBL3OA43Xl34x0Tc60wqyDBx4msVm8VLkAE=" allowed-ips 10.101.1.2/32 ip -4 route add 10.101.1.2/32 dev wg0
Remove a peer
wg set wg0 peer "K30I8eIxuBL3OA43Xl34x0Tc60wqyDBx4msVm8VLkAE=" remove ip -4 route delete 10.101.1.2/32 dev wg0
I took this from https://serverfault.com/questions/1101002/wireguard-client-addition-without-restart Other good answers are there.