Benutzer-Werkzeuge

Webseiten-Werkzeuge


notiz:wireguard

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.

Link zu der Vergleichsansicht

Beide Seiten, vorherige ÜberarbeitungVorherige Überarbeitung
Nächste Überarbeitung
Vorherige Überarbeitung
Letzte ÜberarbeitungBeide Seiten, nächste Überarbeitung
notiz:wireguard [2020/03/18 19:41] – [wg0.conf] clerienotiz:wireguard [2020/03/18 20:08] clerie
Zeile 30: Zeile 30:
 [Peer] [Peer]
 PublicKey = <public key of client 1> PublicKey = <public key of client 1>
-AllowedIPs = 192.168.123.12/32+AllowedIPs = 192.168.123.11/32
  
 # Client 2 # Client 2
 [Peer] [Peer]
 PublicKey = <public key of client 2> PublicKey = <public key of client 2>
-AllowedIPs = 192.168.123.11/32+AllowedIPs = 192.168.123.12/32
 </code> </code>
 +
 +  * **AllowedIPs** dient WireGuard zum routen von Paketen
  
 ===== Wireguard verwenden ===== ===== Wireguard verwenden =====
Zeile 63: Zeile 65:
 <code bash> <code bash>
 systemctl enable wg-quick@<interface name> systemctl enable wg-quick@<interface name>
 +</code>
 +
 +===== Beispiele =====
 +==== Client-Server-Client ====
 +=== Server ===
 +<code ini /etc/wireguard/wg-csc.conf>
 +[Interface]
 +Address = 192.168.123.1/24 # IP Adresse des Servers
 +PrivateKey = <private key of server>
 +ListenPort = 51820 # Port, auf dem der Server läuft
 +# Forwardingregeln, damit Clients untereinander reden können
 +PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; ip6tables -A FORWARD -i %i -j ACCEPT; ip6tables -A FORWARD -o %i -j ACCEPT;
 +PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; ip6tables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT;
 +
 +# Client 1
 +[Peer]
 +PublicKey = <public key of client 1>
 +AllowedIPs = 192.168.123.11/32 # IP des Client 1
 +
 +# Client 2
 +[Peer]
 +PublicKey = <public key of client 2>
 +AllowedIPs = 192.168.123.12/32 # IP des Client 2
 +</code>
 +
 +Wichtig ist an dieser Stelle, dass auf dem Server folgende Systemvariablen gesetzt sind:
 +<code>
 +net.ipv4.ip_forward=1
 +net.ipv6.conf.all.forwarding=1
 +</code>
 +
 +Herausfinden kann man das folgendermaßen:
 +<code bash>
 +sysctl net.ipv4.ip_forward
 +sysctl net.ipv6.conf.all.forwarding
 +</code>
 +
 +Dauerhaft aktivieren lässt sich das in der /etc/sysctl.conf
 +<code - /etc/sysctl.conf>
 +net.ipv4.ip_forward=1
 +net.ipv6.conf.all.forwarding=1
 +</code>
 +
 +**Achtung!** net.ipv6.conf.all.forwarding=1 verhinder IPv6 Autokonfig auf allen Interfaces. Aus diesem Grund sollte dies **vorher** statisch eingerichtet werden.
 +
 +=== Client 1 ===
 +<code ini /etc/wireguard/wg-csc.conf>
 +[Interface]
 +PrivateKey = <private key of client 1>
 +Address = 192.168.123.11/24 # IP Adresse des Client 1
 +
 +[Peer]
 +Endpoint = wireguard-1.clerie.de:51820 # Hostname und Port auf dem der Server lauscht
 +PublicKey = <public key of server>
 +AllowedIPS = 192.168.123.0/24 # IPs die über WireGuard getunnelt werden sollen
 +</code>
 +
 +=== Client 2 ===
 +<code ini /etc/wireguard/wg-csc.conf>
 +[Interface]
 +PrivateKey = <private key of client 2>
 +Address = 192.168.123.12/24 # IP Adresse des Client 2
 +
 +[Peer]
 +Endpoint = wireguard-1.clerie.de:51820 # Hostname und Port auf dem der Server lauscht
 +PublicKey = <public key of server>
 +AllowedIPS = 192.168.123.0/24 # IPs die über WireGuard getunnelt werden sollen
 </code> </code>
notiz/wireguard.txt · Zuletzt geändert: 2020/03/31 00:31 von clerie

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki