Ubuntu 20.04 set up WireGuard VPN server

Ubuntu 20.04 set up WireGuard VPN server

To set up a WireGuard VPN server on Ubuntu 20.04, you can use the following steps:

  1. Install the wireguard package from the official Ubuntu repositories:
sudo apt-get update
sudo apt-get install wireguard
Source:‮‬www.lautturi.com
  1. Generate a private key for the server and a public key for the client:
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).

  1. Create a configuration file for the server. For example, you can create a file named /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).

Created Time:2017-10-30 14:27:24  Author:lautturi