Benutzer-Werkzeuge

Webseiten-Werkzeuge


en:howtos:wireguard

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

en:howtos:wireguard [2022/02/18 08:09] – Externe Bearbeitung 127.0.0.1en:howtos:wireguard [2022/02/18 08:23] (aktuell) morquai
Zeile 1: Zeile 1:
-====== Wireguard Installation und Konfiguration ====== +====== Wireguard installation and configuration ====== 
-Die Frage, wozu man ein [[https://de.wikipedia.org/wiki/Virtual_Private_Network|VPN]] benötigt ist einfach zu beantwortener bietet die Möglichkeit die eigenen Infrastruktur auch unterwegs sinnvoll zu nutzenKonkrete Beispiele+The question why you need a [[https://de.wikipedia.org/wiki/Virtual_Private_Network|VPN]] is easy to answerit offers the possibility to use your own infrastructure sensibly on the goConcrete examples
-  * Sicheres Nutzen des Internets auch in öffentlichen HotSpots +  * Secure use of the Internet in public HotSpots 
-  * Zugriff auf die heimische Netzwerkfestplatte +  * Access to the home network hard drive 
-PiVPN hat vor einiger Zeit als Standard von OpenVPN zu Wireguard gewechseltDie wesentlich bessere Performance von Wireguard hat diesen Schritt begründetIch beschreibe hier kurz, wie Wireguard installiert und für den Hausgebrauch konfiguriert wird.\\ +PiVPN switched from OpenVPN to Wireguard as the default some time agoThe significantly better performance of Wireguard justified this stepHere I briefly describe how to install Wireguard and configure it for home use.\\ 
-Als Server dient uns ein Raspberry Pi 4 mit [[https://www.raspberrypi.com/software/operating-systems/|Raspberry Pi OS]]. Ich gehe im folgenden davon ausdas die Aktionen mit den User root durchgeführt werdendas erspart mir die Mühe vor jedem Command "sudo" zu schreiben.\\ +Our server is a Raspberry Pi 4 with [[https://www.raspberrypi.com/software/operating-systems/|Raspberry Pi OS]]. In the followingI assume that the actions are carried out with the user root, which saves me the trouble of writing "sudo" before each command.\\ 
-Raspberry Pi OS liefert einen Kernel mit, der mit Wireguard kompatibel istEin Kernel älter als 5.6 wird ausdrücklich nicht empfohlenAchwelchen Kernel habe ich denn?\\+Raspberry Pi OS ships with a kernel compatible with Wireguard. A kernel older than 5.6 is expressly not recommendedOhwhat kernel do I have?\\
   uname -a | cut -d" " -f3   uname -a | cut -d" " -f3
-liefert die gewünschte Information+provides the desired information
 ===== Installation ===== ===== Installation =====
   apt install wireguard   apt install wireguard
-Jadas war es auch schon :-) Wireguard ist nun installiert und kann benutzt werdenDie Konfiguration findet im Verzeichnis /etc/wireguard statt und besteht aus einer einzigen Datei mit der Endung .conf (z.B. wg0.conf)\\ +Yesthat's about it :-) Wireguard is now installed and ready to useThe configuration takes place in the directory /etc/wireguard and consists of a single file with the extension .conf (e.g. wg0.conf)\\ 
-===== Konfiguration ===== +===== Configuration ===== 
-Sowohl Client als auch Server benötigen eine Konfigurationsdatei. \\ +Both client and server require a configuration file. \\ 
-Server und Client authentifizieren sich gegenseitig mittels eines private/puclic Key PaaresDiese Keys können wie auf der [[https://www.wireguard.com/quickstart/#key-generation|Wireguard Webseite]] beschrieben erzeugt werden.  +Server and client authenticate each other using a private/public key pairThese keys can be generated as described on the [[https://www.wireguard.com/quickstart/#key-generation|Wireguard website]]. 
-Hier kurze Beispiele, in denen der Server immer die erste IP Adress hat und die Clients beginnend mit "2" durchnummeriert werden\\ +Here are short examples in which the server always has the first IP address and the clients are numbered starting with "2"\\ 
-**Server Konfiguration**, dieser stellt zu einen eine Verbindung in unser Heimnetz (in diesem Fall 192.168.178.0/24) und ins Internet zur Verfügung+**Server configuration**, this provides a connection to our home network (in this case 192.168.178.0/24) and to the Internet
   /etc/wireguard/zuhause.conf:   /etc/wireguard/zuhause.conf:
   [Interface]   [Interface]
-  # Server zuhause+  # Home servers
   Address = 10.8.10.1/24   Address = 10.8.10.1/24
   SaveConfig = false   SaveConfig = false
   ListenPort = 51196   ListenPort = 51196
-  PrivateKey = <Private Key des Servers>+  PrivateKey = <Server's private key>
   [Peer]   [Peer]
-  # Client cli2_zuhause +  # Client cli2_home 
-  PublicKey = <Public key des Client 2>+  PublicKey = <Public key of client 2>
   AllowedIPs = 10.8.10.2/32   AllowedIPs = 10.8.10.2/32
   [Peer]   [Peer]
-  # Client cli3_zuhause +  # Client cli3_home 
-  PublicKey = <Public key des Client 3>+  PublicKey = <Public key of client 3>
   AllowedIPs = 10.8.10.3/32   AllowedIPs = 10.8.10.3/32
      
-**Client 2 Konfiguration**, dieser Client nutzt den VPN nur zum Zugriff auf das heimische Netzwerk:+**Client 2 configuration**, this client only uses the VPN to access the home network:
   [Interface]   [Interface]
-  # Client cli2_zuhause +  # Client cli2_home 
-  PrivateKey = <Private Key des Client 2>+  PrivateKey = <private key of client 2>
   Address = 10.8.10.2/24   Address = 10.8.10.2/24
   # DNS = 9.9.9.9   # DNS = 9.9.9.9
   [Peer]   [Peer]
-  # Server zuhause +  # Home servers 
-  PublicKey = <Public Key des Servers+  PublicKey = <public key of the server
-  AllowedIPs = 10.8.10.0/24,192.168.178.0/24 +  AllowedIPs = 10.8.10.0/24.192.168.178.0/24 
-  Endpoint = dein.dyndns.de:51196+  Endpoint = your.dyndns.de:51196
   PersistentKeepalive = 30   PersistentKeepalive = 30
  
-**Client 3 Konfiguration**, dieser Client nutzt den VPN für sämtlichen Netzwerk Traffic:+**Client 3 configuration**, this client uses the VPN for all network traffic:
   [Interface]   [Interface]
-  # Client cli3_zuhause +  # Client cli3_home 
-  PrivateKey = <Private Key des Client 3>+  PrivateKey = <Client 3's private key>
   Address = 10.8.10.3/24   Address = 10.8.10.3/24
   DNS = 9.9.9.9   DNS = 9.9.9.9
   [Peer]   [Peer]
-  # Server zuhause +  # Home servers 
-  PublicKey = <Public Key des Servers+  PublicKey = <public key of the server
-  AllowedIPs = 10.8.10.0/24,192.168.178.0/24,0.0.0.0/0 +  AllowedIPs = 10.8.10.0/24.192.168.178.0/24.0.0.0.0/0 
-  Endpoint = dein.dyndns.de:51196+  Endpoint = your.dyndns.de:51196
   PersistentKeepalive = 30   PersistentKeepalive = 30
  
-Der Parameter "Endpoint =" in der Client Konfiguration nennt den (Dyn)DNS Namen oder die öffentliche IP Adresse eures Routers.\\ +The parameter "Endpoint =" in the client configuration specifies the (Dyn)DNS name or the public IP address of your router.\\ 
-Wenn sämtlicher Traffic (Client 3) über den VPN gejagt wird ist die Angabe eines DNS erforderlichDies kann euer Router (i.d.R. die erste IP in eurem lokalen Heimnetzim Beispiel also 192.168.178.1) oder ein öffentlicher DNS wie 9.9.9.9 seinOhne DNS Eintrag funktioniert zwar der VPNaber eine Namensauflösung findet nicht stattEin ping nach 9.9.9.9 wird also funktionerenein ping nach dns9.quad9.net aber nichtdenn der Name kann nicht aufgelöst werden.\\ +If all traffic (client 3) is chased via the VPN, a DNS must be specifiedThis can be your router (usually the first IP in your local home networkin the example 192.168.178.1) or a public DNS such as 9.9.9.9. The VPN works without a DNS entrybut name resolution does not take placeping to 9.9.9.9 will workbut a ping to dns9.quad9.net will notbecause the name cannot be resolved.\\ 
-Der Wireguard Server Prozess wird gestartet mit +The Wireguard server process is started with 
-  systemctl start wg-quick@zuhause +  systemctl start wg-quick@home 
- Soll der Server im Rahmen des Raspberry Pi boot automatisch gestartet werdengeht dies so+ If the server is to be started automatically as part of the Raspberry Pi boot, this is how it works
-  systemctl enable wg-quick@zuhause +  systemctl enable wg-quick@home 
-"zuhauseist der erste Teil des Namens der /etc/wireguard/zuhause.conf Datei\\ +"homeis the first part of the name of the /etc/wireguard/home.conf file\\ 
-===== Das geht auch einfacher ===== +===== There is an easier way ===== 
-Wer keine Lust hatsich die Konfigurationsdateiendie Keys etc selbst zu bastelnkann dies auch per Script auf den Raspberry Pi erledigen lassenIhr findet meine Lösung auf [[https://gitlab.com/onkelhartwig/wireguard-vpn-for-home-use/-/tree/main|Gitlab]].\\ +If you don't feel like making the configuration filesthe keys, etc. yourselfyou can also have this done using a script on the Raspberry Pi. You can find my solution on [[https://gitlab.com/onkelhartwig/wireguard-vpn-for-home-use/-/tree/main|Gitlab]].\\ 
-Das Tool stellt ein Verzeichnis mit allen nötigen Dateien und ein paar Hilfsdateien, die das Leben erleichtern, zur Verfügung+The tool provides a directory with all the necessary files and a few auxiliary files that make life easier
-  * Private und Public Keys für Server und Clients +  * Private and public keys for servers and clients 
-  * Für jeden Client einen QR Codeder mit der Wireguard App auf dem Client einfach gescannt werden kann +  * QR code for each clientwhich can be easily scanned with the Wireguard app on the client 
-  * Eine .csv Datei, die es erleichtert sich zu merken (und zu verwaltenwelcher Person man für welches Geräte einen Client zur Verfügung stellt.+  * .csv file that makes it easy to remember (and managewhich person you're providing a client for which device.
  
-Viel Spass+Have fun
  
 ===== Ein wenig Technik dazu? ===== ===== Ein wenig Technik dazu? =====
Zeile 79: Zeile 79:
   * Route ist nicht gleich Route. Routen werden normalerweise mit einem Ziel und einem Gateway konfiguriert, Dabei ist das Gateway die IP Adresse eines einzelnen Routers, während das Ziel ein einzelner Rechner oder ein Netzwerk sein kann. Eine andere Art des Routings findet ohne spezifisches Gateway statt und überlässt das Auffinden eines passenden Routers Anderen. Diese Interface Routen werden von der Wireguard Software unterstützt da Wireguard die Netzverbindungen aller Clients kennt.\\   * Route ist nicht gleich Route. Routen werden normalerweise mit einem Ziel und einem Gateway konfiguriert, Dabei ist das Gateway die IP Adresse eines einzelnen Routers, während das Ziel ein einzelner Rechner oder ein Netzwerk sein kann. Eine andere Art des Routings findet ohne spezifisches Gateway statt und überlässt das Auffinden eines passenden Routers Anderen. Diese Interface Routen werden von der Wireguard Software unterstützt da Wireguard die Netzverbindungen aller Clients kennt.\\
   * Wireguard unterstützt im Gegensatz nur das UPD Protokoll, TCP kann nicht verwendet werden. Ein "Verstecken" des VPN hinter Port "443", wie bei OpenVPN, ist nicht möglich.\\   * Wireguard unterstützt im Gegensatz nur das UPD Protokoll, TCP kann nicht verwendet werden. Ein "Verstecken" des VPN hinter Port "443", wie bei OpenVPN, ist nicht möglich.\\
 +===== A bit of technology? ===== 
 +There are always stumbling blocks. The routing in particular is a frequently misconfigured stumbling block when using a VPN. If in doubt, no Internet access works anymore. Here are a few thoughts:\\ 
 +  * The server provides the clients with access to the home network on the one hand and to the Internet on the other. "AllowedIPs" is only needed on the server to tell the clients apart. If you fiddle around here, which can make sense if a client has access to another private network without knowing what he is doing, there is a high probability that he will lose network access to his Raspberry Pi.\\ 
 +  * Route is not always the same route. Routes are typically configured with a destination and a gateway, where the gateway is the IP address of a single router, while the destination can be a single machine or a network. Another type of routing takes place without a specific gateway and leaves finding a suitable router to others. These interface routes are supported by the Wireguard software because Wireguard knows the network connections of all clients.\\ 
 +  * In contrast, Wireguard only supports the UPD protocol, TCP cannot be used. It is not possible to "hide" the VPN behind port "443", as with OpenVPN.\\ 
  
  
en/howtos/wireguard.1645171796.txt.gz · Zuletzt geändert: 2022/02/18 08:09 von 127.0.0.1