This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| technical:vpn:wireguard [2022/08/10 12:28] – created jc | technical:vpn:wireguard [2024/12/14 09:37] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== WireGuard VPN ====== | ====== WireGuard VPN ====== | ||
| + | < | ||
| + | # Install | ||
| + | ``` | ||
| + | sudo pacman -S wireguard-tools | ||
| + | ``` | ||
| + | |||
| + | # Generate Keys | ||
| + | ``` | ||
| + | wg genkey | tee privatekey | wg pubkey > publickey | ||
| + | wg genpsk | ||
| + | ``` | ||
| + | |||
| + | # Config | ||
| + | ##Edit WireGuard Config | ||
| + | ``` | ||
| + | vim / | ||
| + | ``` | ||
| + | |||
| + | ## Add the Local Address/ | ||
| + | ``` | ||
| + | [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, | ||
| + | Endpoint = $peer_public_ip: | ||
| + | PresharedKey = $prehared_key | ||
| + | ``` | ||
| + | |||
| + | # Startup | ||
| + | ``` | ||
| + | wg-quick up $interface | ||
| + | ``` | ||
| + | |||
| + | # Shell Script | ||
| + | </ | ||
| + | |||