Schritt A: VLANs nicht mehr an Horus routen (NAT-Modell).
OPNsense-Peer nur 10.1.1.22/32 + 10.100.2/24; OPNsense-NAT-Checkliste ergänzt. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -18,7 +18,9 @@ Configs inkl. Private Keys: **privates Repo** — siehe Dateien in diesem Ordner
|
|||||||
| **`10.2.2.0/24`** (docbr0) | **VM** | VM → docbr0; OPNsense nur `→ 192.168.10.10` im LAN |
|
| **`10.2.2.0/24`** (docbr0) | **VM** | VM → docbr0; OPNsense nur `→ 192.168.10.10` im LAN |
|
||||||
| `10.1.1.22/32` | OPNsense | OPNsense-WG-Tunnel |
|
| `10.1.1.22/32` | OPNsense | OPNsense-WG-Tunnel |
|
||||||
| `10.100.2.0/24` (Services pve2) | OPNsense | OPNsense opt7 |
|
| `10.100.2.0/24` (Services pve2) | OPNsense | OPNsense opt7 |
|
||||||
| `192.168.10–60.0/24` (VLANs) | OPNsense | OPNsense (ggf. NAT statt Export) |
|
| `192.168.10–60.0/24` (VLANs) | — (nicht auf Horus) | OPNsense **NAT** → Horus sieht nur `10.1.1.22` |
|
||||||
|
|
||||||
|
**Schritt A (NAT):** Horus ✅ · OPNsense → [opnsense-step-a-nat.md](opnsense-step-a-nat.md)
|
||||||
|
|
||||||
**Nicht:** `10.2.0.0/16` auf VM-Peer — war zu groß; nur **`10.2.2.0/24`**.
|
**Nicht:** `10.2.0.0/16` auf VM-Peer — war zu groß; nur **`10.2.2.0/24`**.
|
||||||
|
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
[Peer]
|
[Peer]
|
||||||
PublicKey = walbWTYXAGOD1mOxPK+NwKT6qUhLyY0qieWBeTIbdXU=
|
PublicKey = walbWTYXAGOD1mOxPK+NwKT6qUhLyY0qieWBeTIbdXU=
|
||||||
PresharedKey = z4VXyOG41/+4JbiUdkb055Bpyxlte+ecW7Bzdvb1s+w=
|
PresharedKey = z4VXyOG41/+4JbiUdkb055Bpyxlte+ecW7Bzdvb1s+w=
|
||||||
AllowedIPs = 10.1.1.22/32, 192.168.10.0/24, 192.168.20.0/24, 192.168.30.0/24, 192.168.40.0/24, 192.168.50.0/24, 192.168.60.0/24, 10.100.2.0/24
|
AllowedIPs = 10.1.1.22/32, 10.100.2.0/24
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
# Schritt A — VLANs → Horus per NAT (OPNsense)
|
||||||
|
|
||||||
|
**Ziel:** LAN/VLANs erreichen Horus, aber Horus kennt **keine** `192.168.x`-Subnetze (kein Routing zurück ins Heimnetz).
|
||||||
|
|
||||||
|
| Richtung | Verhalten |
|
||||||
|
|----------|-----------|
|
||||||
|
| VLAN → Horus | ✅ NAT (Quelle wird `10.1.1.22`) |
|
||||||
|
| Horus → VLAN | ❌ nicht möglich (Horus kennt VLANs nicht) |
|
||||||
|
| Horus ↔ `10.100.2.0/24` | ✅ bidirektional (Services, OPNsense-Peer) |
|
||||||
|
| Horus ↔ `10.2.2.0/24` | ✅ über **VM-Peer** (`10.1.1.5`), nicht OPNsense |
|
||||||
|
|
||||||
|
**Horus-Seite:** erledigt — OPNsense-Peer `AllowedIPs` = `10.1.1.22/32`, `10.100.2.0/24` only.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## OPNsense — Checkliste
|
||||||
|
|
||||||
|
### 1. WireGuard Peer „horus“ (unverändert sinnvoll)
|
||||||
|
|
||||||
|
Peer **Allowed IPs** (Horus-Netze, outbound vom Router):
|
||||||
|
|
||||||
|
`10.1.1.0/24, 10.1.2.0/24, 10.1.3.0/24, 10.1.4.0/24, 10.8.0.0/24`
|
||||||
|
|
||||||
|
Local Instance: Tunnel `10.1.1.22/32`, Keys aus [opnsense-client.conf](opnsense-client.conf).
|
||||||
|
|
||||||
|
### 2. Outbound NAT
|
||||||
|
|
||||||
|
**Firewall → NAT → Outbound**
|
||||||
|
|
||||||
|
Modus: **Hybrid** (oder Manual), damit eine explizite Regel greift.
|
||||||
|
|
||||||
|
Neue Regel (oben):
|
||||||
|
|
||||||
|
| Feld | Wert |
|
||||||
|
|------|------|
|
||||||
|
| Interface | `horusopnsense` (WG) |
|
||||||
|
| TCP/IP Version | IPv4 |
|
||||||
|
| Source | Alias z. B. `RFC1918` oder einzeln: `192.168.10.0/24`, `.20`, `.30`, `.40`, `.50`, `.60` |
|
||||||
|
| Destination | `10.1.1.0/24`, `10.1.2.0/24`, `10.1.3.0/24`, `10.1.4.0/24`, `10.8.0.0/24` (Alias `HORUS_WG`) |
|
||||||
|
| Translation / Target | **Interface address** (`10.1.1.22`) |
|
||||||
|
|
||||||
|
Nicht NATen: Traffic zu `10.2.2.0/24`, `10.100.2.0/24` (bleiben intern geroutet, kein Horus-WG).
|
||||||
|
|
||||||
|
### 3. Firewall
|
||||||
|
|
||||||
|
**LAN / VLAN10 / VLAN20 / … → Horus**
|
||||||
|
|
||||||
|
| Source | Destination | Action |
|
||||||
|
|--------|-------------|--------|
|
||||||
|
| VLAN-Subnetz | Alias `HORUS_WG` | Pass |
|
||||||
|
|
||||||
|
**WG `horusopnsense` → LAN**
|
||||||
|
|
||||||
|
| Source | Destination | Action |
|
||||||
|
|--------|-------------|--------|
|
||||||
|
| `10.1.1.0/24` (Horus) | RFC1918 / VLANs | **Block** (Defense in depth; Horus routet dorthin ohnehin nicht) |
|
||||||
|
|
||||||
|
Ausnahme Services: Horus → `10.100.2.0/24` läuft über OPNsense-Routing (kein NAT nötig für initiierte Verbindungen von Horus, wenn gewünscht — ggf. separate Pass-Regel WG → `10.100.2.0/24`).
|
||||||
|
|
||||||
|
### 4. Static Routes prüfen
|
||||||
|
|
||||||
|
**System → Routes**
|
||||||
|
|
||||||
|
- Kein Eintrag `10.1.1.0/24` via `192.168.178.1` o. ä.
|
||||||
|
- `10.2.2.0/24` → `192.168.10.10` (VM) — **bleibt**
|
||||||
|
- `10.100.2.0/24` → opt7 — **bleibt**
|
||||||
|
|
||||||
|
### 5. Test
|
||||||
|
|
||||||
|
Vom PC (VLAN20):
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
tracert 10.1.1.1 # Hop 1 OPNsense, danach Horus (kein 192.168.178.x)
|
||||||
|
ping 10.1.1.1
|
||||||
|
ssh root@10.1.1.1
|
||||||
|
```
|
||||||
|
|
||||||
|
Auf Horus (via VM):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ssh jean@192.168.10.10 'ssh root@10.1.1.1 wg show wg0 | grep -A5 walbWTYX'
|
||||||
|
# allowed ips: nur 10.1.1.22/32, 10.100.2.0/24
|
||||||
|
```
|
||||||
|
|
||||||
|
Horus sollte eingehende SSH/Ping von **`10.1.1.22`** sehen (NAT), nicht von `192.168.20.x`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Referenz Horus
|
||||||
|
|
||||||
|
[horus-server-peer-opnsense.conf](horus-server-peer-opnsense.conf) · [wg0-opnsense-routes.sh](wg0-opnsense-routes.sh)
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Horus: Routes für OPNsense-Peer — wg syncconf legt AllowedIPs-Routen nicht an
|
# Horus: Routes für OPNsense-Peer — wg syncconf legt AllowedIPs-Routen nicht an
|
||||||
# Deploy: /usr/local/sbin/wg0-opnsense-routes.sh + systemd wg0-opnsense-routes.service
|
# Schritt A: nur Tunnel-IP + Services-Netz (keine VLANs)
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
ip link show wg0 &>/dev/null || exit 0
|
ip link show wg0 &>/dev/null || exit 0
|
||||||
for net in \
|
for net in 10.1.1.22/32 10.100.2.0/24; do
|
||||||
10.1.1.22/32 \
|
|
||||||
192.168.10.0/24 192.168.20.0/24 192.168.30.0/24 \
|
|
||||||
192.168.40.0/24 192.168.50.0/24 192.168.60.0/24 \
|
|
||||||
10.100.2.0/24; do
|
|
||||||
ip route replace "$net" dev wg0
|
ip route replace "$net" dev wg0
|
||||||
done
|
done
|
||||||
|
for net in 192.168.10.0/24 192.168.20.0/24 192.168.30.0/24 \
|
||||||
|
192.168.40.0/24 192.168.50.0/24 192.168.60.0/24; do
|
||||||
|
ip route del "$net" dev wg0 2>/dev/null || true
|
||||||
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user