linux:wireguard
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| linux:wireguard [2023/10/19 16:46] – created ms | linux:wireguard [2023/10/19 17:01] (current) – ms | ||
|---|---|---|---|
| Line 6: | Line 6: | ||
| </ | </ | ||
| + | Alles als root: | ||
| + | < | ||
| + | vi / | ||
| + | |||
| + | net.ipv4.ip_forward=1 | ||
| + | </ | ||
| + | < | ||
| + | sysctl -p | ||
| + | </ | ||
| + | < | ||
| + | cd / | ||
| + | |||
| + | umask 077; wg genkey | tee privatekey | wg pubkey > publickey | ||
| + | </ | ||
| + | < | ||
| + | cd / | ||
| + | |||
| + | vi wg0.conf | ||
| + | |||
| + | [Interface] | ||
| + | PrivateKey = < | ||
| + | Address = 172.31.0.1/ | ||
| + | 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 = < | ||
| + | AllowedIPs = 172.31.0.0/ | ||
| + | </ | ||
| + | |||
| + | ===== Client Seite ===== | ||
| + | === Nötige Pakete === | ||
| + | < | ||
| + | apt install wireguard iptables (nft) | ||
| + | </ | ||
| + | |||
| + | Alles als root: | ||
| + | < | ||
| + | vi / | ||
| + | |||
| + | net.ipv4.ip_forward=1 | ||
| + | </ | ||
| + | < | ||
| + | sysctl -p | ||
| + | </ | ||
| + | < | ||
| + | cd / | ||
| + | |||
| + | umask 077; wg genkey | tee privatekey | wg pubkey > publickey | ||
| + | </ | ||
| + | < | ||
| + | cd / | ||
| + | |||
| + | vi wg0.conf | ||
| + | |||
| + | [Interface] | ||
| + | PrivateKey = < | ||
| + | Address = 172.31.0.2/ | ||
| + | |||
| + | [Peer] | ||
| + | PublicKey = < | ||
| + | Endpoint = <physik. IP-Adresse vom Server>: | ||
| + | AllowedIPs = 0.0.0.0/0 | ||
| + | PersistentKeepalive = 25 | ||
| + | </ | ||
| + | |||
| + | ===== Auf beiden Seiten ===== | ||
| + | < | ||
| + | wg-quick up wg0 | ||
| + | |||
| + | wg-quick down wg0 | ||
| + | |||
| + | wg | ||
| + | |||
| + | wg showconf wg0 | ||
| + | </ | ||
linux/wireguard.1697726813.txt.gz · Last modified: 2023/10/19 16:46 by ms