OPNsense Wireguard: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
 
(12 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 82: Zeile 82:
 
| Destination || This Firewall
 
| Destination || This Firewall
 
|-
 
|-
| Destination Port (from) || 51820
+
| Destination Port (from) || 55555
 
|-
 
|-
| Destination Port (to) || 51820
+
| Destination Port (to) || 55555
 
|-
 
|-
 
| Log || Nein
 
| Log || Nein
 
|}
 
|}
 +
 
==WireGuard (Group)==
 
==WireGuard (Group)==
 
*Rules
 
*Rules
 
**WireGuard (Group)
 
**WireGuard (Group)
 
***+
 
***+
[[Datei:Opnsense-wg05.png]]
+
{| class="wikitable"
 +
! Parameter !! Wert
 +
|-
 +
| Action || Pass
 +
|-
 +
| Disabled || Nein
 +
|-
 +
| Quick || Ja
 +
|-
 +
| Interface || WireGuard (Group)
 +
|-
 +
| Direction || in
 +
|-
 +
| TCP/IP Version || IPv4
 +
|-
 +
| Protocol || any
 +
|-
 +
| Source || any
 +
|-
 +
| Destination || any
 +
|-
 +
| Destination Port (from) || any
 +
|-
 +
| Destination Port (to) || any
 +
|}
  
=An einem Linux System=
 
*PUBKEY_SERVER=XbO5anN/a6S6fR40N6xn+lqkctdAZK4yudaVAUtVmh8=
 
*PRIVKEY=$(wg genkey)
 
*PUBKEY=$(echo $PRIVKEY | wg pubkey)
 
  
*cat<<HERE > client1.conf
 
<pre>
 
[Interface]
 
Address =  172.30.32.101/24
 
PrivateKey = $PRIVKEY
 
#PUBKEY = $PUBKEY
 
DNS = 8.8.8.8
 
  
[Peer]
+
[[Kategorie:OPNsense]]
PublicKey = $PUBKEY_SERVER
+
 
AllowedIPs = 0.0.0.0/0
+
=Peer Generator=
Endpoint = opns-zw.ix.de:55555
+
*VPN
HERE
+
**Wireguard:
</pre>
+
***Peer Generator
 +
== WireGuard Peer – client01 ==
 +
{| class="wikitable"
 +
! Parameter !! Wert
 +
|-
 +
| Instance || WG
 +
|-
 +
| Endpoint || opnsense.it213.xinmen.de:55555
 +
|-
 +
| Name || client01
 +
|-
 +
| Public key || 85X0PniiIqGxXLqrXwFsGy36uMFaVicvq+0uCFe3X...
 +
|-
 +
| Private key || APmUQ0ys0PcHfU0x4aTm+66fs0Z4iYSWOE7hLASPRG8=
 +
|-
 +
| Address || 172.30.32.4/32
 +
|-
 +
| Pre-shared key || rppkqNldvezugnZaVNclK4XDPBvZPg+O1dSJVU6VG8=
 +
|-
 +
| Allowed IPs || 0.0.0.0/0, ::/0
 +
|-
 +
| Keepalive interval || 10
 +
|-
 +
| DNS Servers || -
 +
|-
 +
| Store and generate next || '''Wichtig erst Inhalt der Konfig kopieren und dann Apply'''
 +
|-
 +
| Enable WireGuard || Ja
 +
|}
  
=generate the qrcode=
+
==Die Konfiguration==
*qrencode -t utf8 < client1.conf
 
=Peer hinzufügen=
 
[[Datei:Opnsense-wg06.png]]
 
[[Kategorie:OPNsense]]
 
=Auf Linux System=
 
;Wireguard installieren
 
*sudo apt install wireguard
 
;Konfigurationsdatei der Opnsense einfügen
 
*sudo vi /etc/wireguard/wg0.conf
 
 
<pre>
 
<pre>
 
[Interface]
 
[Interface]
PrivateKey = uNBjRjmVjfut59L8cAMxRGhcPdXi/BxtidSrDU+EWXU=
+
PrivateKey = APmUQ0ys0PcHfU0x4aTm+66fs0Z4iYSWOE7hLASPRG8=
Address = 172.30.32.2/32
+
Address = 172.30.32.4/32
  
 
[Peer]
 
[Peer]
 
PublicKey = DaPF7JvnRYpNuXiFgo4Uqu/Yq9dmz0Gu8mijd4h622E=
 
PublicKey = DaPF7JvnRYpNuXiFgo4Uqu/Yq9dmz0Gu8mijd4h622E=
PresharedKey = 8/sxyen2B/1PeNsSe+KfgNuUJgF5F0y2RWcHZMtbXEU=
+
PresharedKey = rppkqNldvezugnZaVNclK4XDPBvZPg+O1dSJVU6VG8=
 
Endpoint = opnsense.it213.xinmen.de:55555
 
Endpoint = opnsense.it213.xinmen.de:55555
AllowedIPs = 0.0.0.0/0,::/0
+
AllowedIPs = 0.0.0.0/0, ::/0
 
PersistentKeepalive = 10
 
PersistentKeepalive = 10
 
</pre>
 
</pre>
 +
=Auf dem Linux System=
 +
;Installation
 +
*sudo apt instal wireguard
 +
;Anlegen der Konfiguration
 +
*sudo vi /etc/wireguard/wg0.conf
 +
;Hier kommt die Konfiguration rein.
 +
 
=Wireguard start=
 
=Wireguard start=
 
*sudo wg-quick up wg0
 
*sudo wg-quick up wg0

Aktuelle Version vom 18. Februar 2026, 13:47 Uhr

Konfiguration

  • VPN
    • WireGuard
      • Settings => General
Bereich Einstellung Wert
VPN → WireGuard → Settings Enable WireGuard aktiviert
VPN → WireGuard → Settings Status Enabled
VPN → WireGuard → Settings Aktion Apply

WireGuard Instance – WG

  • VPN
    • WireGuard
      • Settings
        • Instances
          • +
Parameter Wert
Enabled Ja
Name WG
Instance 0
Public key DaPF7JvnRYpNuXiFgo4Uqu/Yq9dmz0Gu8mijd4h...
Private key gDvRj18foAvOVGTvZR6ca2ewRQBstGlg/I5cdPUA...
Listen port 55555
Tunnel address 172.30.32.1/24
Depend on (CARP) None
Peers
Disable routes Nein
Debug log Nein

Interfaces

  • Assignments
Feld Wert
Device wg1 (WireGuard - WG)
Description WG
Aktion Add

Firewall

WAN

  • Rules
    • WAN
      • +
Parameter Wert
Action Pass
Disabled Nein
Quick Ja
Interface WAN
Direction in
TCP/IP Version IPv4
Protocol UDP
Source any
Destination This Firewall
Destination Port (from) 55555
Destination Port (to) 55555
Log Nein

WireGuard (Group)

  • Rules
    • WireGuard (Group)
      • +
Parameter Wert
Action Pass
Disabled Nein
Quick Ja
Interface WireGuard (Group)
Direction in
TCP/IP Version IPv4
Protocol any
Source any
Destination any
Destination Port (from) any
Destination Port (to) any

Peer Generator

  • VPN
    • Wireguard:
      • Peer Generator

WireGuard Peer – client01

Parameter Wert
Instance WG
Endpoint opnsense.it213.xinmen.de:55555
Name client01
Public key 85X0PniiIqGxXLqrXwFsGy36uMFaVicvq+0uCFe3X...
Private key APmUQ0ys0PcHfU0x4aTm+66fs0Z4iYSWOE7hLASPRG8=
Address 172.30.32.4/32
Pre-shared key rppkqNldvezugnZaVNclK4XDPBvZPg+O1dSJVU6VG8=
Allowed IPs 0.0.0.0/0, ::/0
Keepalive interval 10
DNS Servers -
Store and generate next Wichtig erst Inhalt der Konfig kopieren und dann Apply
Enable WireGuard Ja

Die Konfiguration

[Interface]
PrivateKey = APmUQ0ys0PcHfU0x4aTm+66fs0Z4iYSWOE7hLASPRG8=
Address = 172.30.32.4/32

[Peer]
PublicKey = DaPF7JvnRYpNuXiFgo4Uqu/Yq9dmz0Gu8mijd4h622E=
PresharedKey = rppkqNldvezugnZaVNclK4XDPBvZPg+O1dSJVU6VG8=
Endpoint = opnsense.it213.xinmen.de:55555
AllowedIPs = 0.0.0.0/0, ::/0
PersistentKeepalive = 10

Auf dem Linux System

Installation
  • sudo apt instal wireguard
Anlegen der Konfiguration
  • sudo vi /etc/wireguard/wg0.conf
Hier kommt die Konfiguration rein.

Wireguard start

  • sudo wg-quick up wg0

Wireguard stop

  • sudo wg-quick down wg0

Wireguard show

  • sudo wg show

Webseite