🛡️
Networking & Server

WireGuard VPN

Modern, fast VPN for secure remote access

🐧 Linux🍎 Mac🪟 Windows
Reviewed: Tested on: Kubernetes 1.29 · Terraform 1.8 · Ubuntu 22.04

What is this?

WireGuard creates an encrypted VPN tunnel so you can securely access private networks remotely.

📁

Config files for WireGuard VPN

Where to create or edit the main configuration — paths below match the setup steps.

  • /etc/wireguard/wg0.conf

    Location: VPN server or client

    Interface, keys, peers, and AllowedIPs

📥

Step 01

Install WireGuard

(01)Install

Linux
1sudo apt-get install -y wireguard
2# RHEL: sudo dnf install wireguard-tools
⚙️

Step 02

Configure VPN

(01)Server config

Linux
1# Generate keys
2wg genkey | tee privatekey | wg pubkey > publickey
3
4sudo nano /etc/wireguard/wg0.conf
5# [Interface]
6# Address = 10.0.0.1/24
7# PrivateKey = <server-private-key>
8# ListenPort = 51820
9# [Peer]
10# PublicKey = <client-public-key>
11# AllowedIPs = 10.0.0.2/32
12
13sudo systemctl enable wg-quick@wg0
14sudo systemctl start wg-quick@wg0

Step 03

Verify

(01)Status

Linux
1sudo wg show

Step 04

Manage

(01)Add peer

Linux
1sudo wg set wg0 peer <pubkey> allowed-ips 10.0.0.3/32