User Tools

Site Tools


technical:vpn:wireguard

WireGuard VPN

Install

sudo pacman -S wireguard-tools 

Generate Keys

wg genkey | tee privatekey | wg pubkey > publickey
wg genpsk

Config

Edit WireGuard Config

vim /etc/wireguard/wg0.conf

Add the Local Address/Port/Key/Scripts and Peer

[Interface]
Address = $wireguard_address
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o $interface -j MASQUERADE;
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o $interface -j MASQUERADE;
ListenPort = $port
PrivateKey = $key

[Peer]
PublicKey = $peer_public_key
AllowedIPs = $peer_wireguard_address, $remote_subnet
Endpoint = $peer_public_ip:$peer_port
PresharedKey = $prehared_key

Startup

wg-quick up $interface

Shell Script

technical/vpn/wireguard.txt · Last modified: 2024/12/14 09:37 by 127.0.0.1