To set up a WireGuard VPN server on Ubuntu 20.04, you can use the following steps:
wireguard
package from the official Ubuntu repositories:sudo apt-get update sudo apt-get install wireguardSource:www.lautturi.com
wg genkey | tee privatekey | wg pubkey > publickey
This will generate a private key for the server (stored in the privatekey
file) and a public key for the client (stored in the publickey
file).
/etc/wireguard/wg0.conf
with the following content:[Interface] PrivateKey = <server private key> ListenPort = 51820 [Peer] PublicKey = <client public key> AllowedIPs = 10.0.0.2/32
Replace <server private key>
with the private key for the server (generated in step 2) and <client public key>
with the public key for the client (also generated in step 2).