User Tools

Site Tools


technical:vpn:wireguard

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
technical:vpn:wireguard [2022/08/10 12:28] – created jctechnical:vpn:wireguard [2024/12/14 09:37] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== WireGuard VPN ====== ====== WireGuard VPN ======
 +<markdown>
 +# 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
 +</markdown>
 +
  
technical/vpn/wireguard.1660148903.txt.gz · Last modified: 2022/08/10 12:28 by jc