User Tools

Site Tools


linux:wireguard

This is an old revision of the document!


Client zum Server

Server Seite

Nötige Pakete

apt install wireguard iptables (nft)

Alles als root:

vi /etc/sysctl.conf

net.ipv4.ip_forward=1   # soll nich auskommentiert ein
sysctl -p
cd /etc/wireguard

umask 077; wg genkey | tee privatekey | wg pubkey > publickey
cd /etc/wireguard

vi wg0.conf

[Interface] 
PrivateKey = <PrivatKey vom Server>
Address = 172.31.0.1/32
SaveConfig = true 
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o ens3 -j MASQUERADE
ListenPort = 51820

[Peer]
PublicKey = <PublicKey vom Client>
AllowedIPs = 172.31.0.0/24
linux/wireguard.1697727161.txt.gz · Last modified: 2023/10/19 16:52 by ms

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki