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 [2024/11/21 17:30] – add key generation julian.lemmerich | knowledge_base:useful_software:s2svpn_wg [2024/11/21 17:40] (aktuell) – add PSK julian.lemmerich | ||
---|---|---|---|
Zeile 37: | Zeile 37: | ||
</ | </ | ||
- | ==== enable ip forwarding | + | ===== Configuration ===== |
- | this has to be done on both server and client. | + | ==== " |
- | < | + | <file . / |
- | net.ipv4.ip_forward=1 | + | |
- | net.ipv6.conf.all.forwarding=1 | + | |
- | </ | + | |
- | + | ||
- | ==== server config ==== | + | |
- | + | ||
- | <file bash / | + | |
[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 61: | 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 76: | 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 88: | Zeile 83: | ||
==== always start wg ==== | ==== always start wg ==== | ||
- | |||
- | on both server and client | ||
< | < |