Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.
Beide Seiten, vorherige ÜberarbeitungVorherige ÜberarbeitungNächste Überarbeitung | Vorherige Überarbeitung | ||
knowledge_base:useful_software:s2svpn_wg [2021/09/11 20:25] – [server config] - corrected error julian.lemmerich | knowledge_base:useful_software:s2svpn_wg [2024/11/21 17:40] (aktuell) – add PSK julian.lemmerich | ||
---|---|---|---|
Zeile 18: | Zeile 18: | ||
<code bash> | <code bash> | ||
- | apt install wireguard | + | apt install wireguard-tools |
</ | </ | ||
- | https:// | + | Benötigt Linux Kernel 5.6 oder höher. |
- | ==== enable ip forwarding | + | ===== Generating Keys ===== |
- | ((https:// | + | Beide seiten benötigen unabhängige Keys. |
- | this has to be done on both server and client. | + | < |
+ | wg genkey | tee >(wg pubkey) | ||
+ | </ | ||
- | <file bash /etc/sysctl.conf> | + | Für Post-Quanten-Sicheres stuff kann man auch einen PSK generieren. Dieser muss auf beiden Seiten dann identisch sein. |
- | # Uncomment the next line to enable packet forwarding for IPv4 | + | |
- | net.ipv4.ip_forward=1 | + | |
- | # Uncomment the next line to enable packet forwarding for IPv6 | + | < |
- | # Enabling this option disables Stateless Address Autoconfiguration | + | wg genpsk |
- | # based on Router Advertisements for this host | + | </code> |
- | net.ipv6.conf.all.forwarding=1 | + | |
- | </file> | + | |
- | ==== server config | + | ===== Configuration ===== |
- | < | + | ==== " |
+ | |||
+ | < | ||
[Interface] | [Interface] | ||
Address = 10.99.x.1/ | Address = 10.99.x.1/ | ||
- | ListenPort = 31037 # this port is the physical | + | ListenPort = 31037 # this port is the port that should be listened on. |
PrivateKey = 6GcJf56i5dY30t7tyuGExlJFl/ | PrivateKey = 6GcJf56i5dY30t7tyuGExlJFl/ | ||
- | SaveConfig | + | # PresharedKey |
- | PostUp = iptables -A FORWARD -i %i -j ACCEPT | + | PostUp = iptables -A FORWARD -i %i -j ACCEPT |
PostDown = iptables -D FORWARD -i %i -j ACCEPT | PostDown = iptables -D FORWARD -i %i -j ACCEPT | ||
Zeile 54: | Zeile 54: | ||
#Name = XY | #Name = XY | ||
PublicKey = KSODnmNkJG+ASAirrpmZJhEHwnCNoa7fIhvBS/ | PublicKey = KSODnmNkJG+ASAirrpmZJhEHwnCNoa7fIhvBS/ | ||
- | AllowedIPs = 192.168.10.0/ | + | AllowedIPs = 192.168.11.0/ |
</ | </ | ||
- | ==== client | + | ==== " |
- | < | + | < |
[Interface] | [Interface] | ||
Address = 10.99.x.2/ | Address = 10.99.x.2/ | ||
+ | #ListenPort = 51820 # If ListenPort is not set, a random port is chosen. For example for a Client behind NAT this is not needed | ||
PrivateKey = qEX8Ag5QmckFHRGX8Cg308N1XXzfp3VXE2MKYPlA2Eo= | PrivateKey = qEX8Ag5QmckFHRGX8Cg308N1XXzfp3VXE2MKYPlA2Eo= | ||
+ | # | ||
PostUp = iptables -A FORWARD -i %i -j ACCEPT | PostUp = iptables -A FORWARD -i %i -j ACCEPT | ||
Zeile 69: | Zeile 71: | ||
[Peer] | [Peer] | ||
PublicKey = 28b1ickTXZiU5XtZbsj6YJuzhkcJXrNP145C3MGBQS0= | PublicKey = 28b1ickTXZiU5XtZbsj6YJuzhkcJXrNP145C3MGBQS0= | ||
- | AllowedIPs = 192.168.8.0/ | + | AllowedIPs = 0.0.0.0/ |
- | Endpoint = 130.83.6.100: | + | Endpoint = 130.83.6.100: |
- | PersistentKeepalive = 2 | + | PersistentKeepalive = 25 # Send a keepalive packet every 25s |
</ | </ | ||
Zeile 81: | Zeile 83: | ||
==== always start wg ==== | ==== always start wg ==== | ||
- | |||
- | on both server and client | ||
< | < |