Skip to content

VPN with WireGuard

Connecting servers and admin machines through an encrypted tunnel: generating keys, setting up a server and clients, and reaching admin services only through the VPN.

Basics: How WireGuard works, what to install, a complete server and client setup and the firewall

Commands

  • wg


    Keys, tunnel state and peers.

  • wg-quick


    Bring tunnels up and down, start at boot.

From other chapters

  • ip


    ip address show wg0 and ip route show the tunnel interface and its routes. Covered in the chapter Network.

  • ufw


    Open UDP port 51820 and allow SSH only through wg0. Covered in the chapter Network.

  • ssh


    Connect to 10.8.0.1 through the tunnel once SSH is closed to the internet. Covered in the chapter SSH.

  • resolvectl


    Check which DNS server applies while the tunnel is up. Covered in the chapter Network.