Project

General

Profile

Actions

Installation WireGuard unter Debian

Dokumentation/Anleitung

https://www.wireguard.com/

Pakete installieren

sudo apt install wireguard wireguard-tools

Konfiguration

Schlüsselpaar erzeugen

wg genkey | tee wg_priv_key | wg pubkey > wg_pub_key
chmod 600 wg_priv_key 
chmod 600 wg_pub_key 

oder

wg genkey | tee wg_priv_key | wg pubkey > wg_pub_key && chmod 600 wg_priv_key && chmod 600 wg_pub_key

Der private Schlüssel bleibt lokal, der öffentliche Schlüssel wird zum entfernten Partner übertragen.

Konfigurationsdatei lokal (Client, ausgehende Verbindung)

Die Konfigurationsdatei liegt in /etc/wireguard/wg0.conf, wobei anstelle der Null eine beliebige Zahl stehen darf. Dieser Name – im Beispiel wg0 – ist auch der Name der Netzwerkschnittstelle, die von WireGuard angelegt wird.

/etc/wireguard/wg0.conf

[Interface]
PrivateKey = <insert private key here>
Address = 172.16.4.8/24

[Peer]
PublicKey = <insert peer's public key here>
AllowedIPs = 172.16.4.0/24
Endpoint = puntodivista.ch:51820
PersistentKeepalive = 25

Konfigurationsdatei entfernt (Server, eingehende Verbindung)

/etc/wireguard/wg0.conf

[Interface]
Address = 172.16.4.1/24
PrivateKey = <insert private key here>
ListenPort = 51820

# Sample client
[Peer]
PublicKey = <insert peer's public key here>
AllowedIPs = 172.16.4.2

VPN manuell starten/stoppen

sudo wg-quick up wg0
sudo wg-quick down wg0

Automatischer Start über systemctl

sudo systemctl enable wg-quick@wg0
sudo systemctl start wg-quick@wg0

QR-Code der Konfigurationsdatei erstellen

qrencode -t ansiutf8 < wg8.conf

Updated by Michael Gunsch 5 months ago · 14 revisions