How to install and configure Wireguard client on Ubuntu 20.04 - nomorespice/ubuntu20.04-howto GitHub Wiki

WireGuard is a free and open-source software application and communication protocol that implements virtual private network (VPN) techniques to create secure point-to-point connections in routed or bridged configurations. This procedure will guide you through the installation and configuration.

This document assumes that:

  • you installed the Ubuntu 20.04 Operating System
  • you installed the Wireguard server on RHEL 8 according to How to install and configure Wireguard on RHEL 8
  • you are performing these tasks as root
  • you are performing these tasks in order, as some tasks require others to be completed first

Install required software

apt install wireguard wireguard-tools wireguard-dkms resolvconf
modprobe wireguard

Configure Wireguard

Be sure to replace the KEYS and the endpoint IP address in /etc/wireguard/wg0.conf

wg genkey | tee /etc/wireguard/privatekey | wg pubkey | tee /etc/wireguard/publickey

/bin/cat <<\EOT >/etc/wireguard/wg0.conf
[Interface]
Address = 192.168.99.2/24
PrivateKey = PRIVKEY
DNS = 8.8.8.8,search.domain

[Peer]
PublicKey = PUBKEY
PresharedKey = PSKEY
AllowedIPs = 192.168.99.1/32
Endpoint = IPADDRESS/32:31337
PersistentKeepalive = 15
EOT

chmod 600 /etc/wireguard/{privatekey,wg0.conf}

systemctl start wg-quick@wg0
⚠️ **GitHub.com Fallback** ⚠️