Wireguard on Raspberry

apt-cache policy wireguard to see if it is in the repository

apt install wireguard -y to get it

To created the keys

sudo su to not type in sudo for the following commands

cd /etc/wireguard

$(umask 077; wg genkey | tee privatekey | wg pubkey > publickey) produce new private and public keys

exit to required sudo again

sudo touch /etc/wireguard/wg0.conf and edit it

[Interface]
Address = 192.168.50.1/24
ListenPort = 51820
PrivateKey = </etc/wireguard/privatekey of the server>

[Peer]
PublicKey = </etc/wireguard/publickey of a client>
AllowedIPs = 192.168.10.22/32

wg-quick up wg0 to bring it up

ifconfig to see if it is there

wg-quick down wg0 to bring it down

systemctl enable wg-quick@wg0

systemctl restart wg-quick@wg0


Linurs startpage