Inst wireguard » History » Revision 11
Revision 10 (Michael Gunsch, 09/25/2023 04:23 PM) → Revision 11/14 (Michael Gunsch, 11/15/2023 06:36 PM)
h1. Installation WireGuard unter Debian h2. Dokumentation/Anleitung https://www.wireguard.com/ h2. Pakete installieren <pre> sudo apt install wireguard wireguard-tools </pre> h2. Konfiguration h3. Schlüsselpaar erzeugen <pre> wg genkey | tee wg_priv_key | wg pubkey > wg_pub_key chmod 600 wg_priv_key chmod 600 wg_pub_key </pre> oder <pre> wg genkey | tee wg_priv_key | wg pubkey > wg_pub_key && chmod 600 wg_priv_key && chmod 600 wg_pub_key </pre> Der private Schlüssel bleibt lokal, der öffentliche Schlüssel wird zum entfernten Partner übertragen. h3. Konfigurationsdatei lokal 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 <pre> [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 </pre> h3. Konfigurationsdatei entfernt /etc/wireguard/wg0.conf <pre> [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 </pre> h3. VPN manuell starten/stoppen <pre> sudo wg-quick up wg0 sudo wg-quick down wg0 </pre> h3. Automatischer Start über @systemctl@ <pre> sudo systemctl enable wg-quick@wg0 sudo systemctl start wg-quick@wg0 </pre>