Wireguard Basic Page

Hi there,

I belive there's a small error in the code .
when key's are generated ...the WG_PUB="$(cat wgclient.pub)" should be WG_PUB="$(cat wgserver.pub)"

WG_PUB="$(cat wgclient.pub)" will give error

# Generate and exchange the keys
umask u=rw,g=,o=
wg genkey | tee wgserver.key | wg pubkey > wgserver.pub
wg genpsk > wg.psk
WG_KEY="$(cat wgserver.key)"
WG_PSK="$(cat wg.psk)"
WG_PUB="$(cat wgclient.pub)"

...which code?

because there isn't a wgclient.pub generated

No, to which code do you refer? Link?

That's because you have to provide the client's public key that was generated by it.

OpenWrt cannot guess or generate the remote client's Public Key as it's based on the client's Private Key.

So, did you copy over or paste the peer's Public Key into a wgclient.pub file - as the instructions state?

Key managment will fail on last line.


OK. I tested for this thread:

  • I read the page you linked (hence I sent you a screenshot - before you responded to @darksky)
  • I performed all steps
  • the last line works! (except if I do not exchange keys and provide wgclient.pub from the peer)

Perhaps you should install the LuCI web app and setup your peers from there.