add/remove a peer

ST smntov at
Sat Mar 24 20:32:47 CET 2018


I'm learning WireGuard and have a question regarding adding/removing a

Is there something like:

1) wg add peer ABCDEF... allowed-ips endpoint

and by default, if some(/all) values are not provided - WG will generate
them on its own. E.g. if IP is not provided - it will scan all known IPs
and choose a new one (with /32) from the range that was mentioned with
`ip address add dev wg0` command. This way system administrator doesn't
have to choose IPs manually for new clients (doing so manually is
boring, time consuming and error prone). The same for the keys: the
server will generate the pair of keys - the public (together with the
new IP) keep for itself to set a new peer/client. And the private key
together with (or the range mentioned with `ip address add dev
wg0` command) print as output to be used for setting up a new client.

So adding a new client on server could look like this:

wg add peer persistent-keepalive 25  endpoint >

Where wg0.conf will look like:

PrivateKey = ui4AN....AbhwcvHWo=
ListenPort = 22000

PublicKey = ViCKc...gQp43rp7BHM=
AllowedIPs =
Endpoint =
PersistentKeepalive = 25

wg0.conf can now be encrypted, let's say with PGP and sent to the new
client to be placed under /etc/wireguard/wg0.conf. Super easy even for
not so tech-savvy folks...

2) similar for removing clients:

wg rm peer ABCDEF...
wg rm peer allowed-ips

Is this implemented already or should I file it as a feature request
somewhere? (if so - where?)

Thank you!

More information about the WireGuard mailing list