Doku: OPNsense-Routing für docbr0 (10.2.2.0/24).

Separates Dokument mit Route, Firewall, Tests und Fehlerbildern.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
root
2026-06-28 11:10:10 +02:00
parent 5a4f7a7333
commit f3409ec675
6 changed files with 190 additions and 0 deletions
+1
View File
@@ -34,6 +34,7 @@ docu/
| [shared/git-und-repos.md](shared/git-und-repos.md) | Gitea, Tokens, Clone-Pfade | | [shared/git-und-repos.md](shared/git-und-repos.md) | Gitea, Tokens, Clone-Pfade |
| [migration/nextcloud-optimierung-und-updates.md](migration/nextcloud-optimierung-und-updates.md) | Nextcloud VM 101: Updates, Tuning, notify_push | | [migration/nextcloud-optimierung-und-updates.md](migration/nextcloud-optimierung-und-updates.md) | Nextcloud VM 101: Updates, Tuning, notify_push |
| [guests/](guests/) | Docker-Stacks pro Gast (Compose, ohne Volumes/Daten) | | [guests/](guests/) | Docker-Stacks pro Gast (Compose, ohne Volumes/Daten) |
| [guests/vm101-ubuntu/docbr0-opnsense-routing.md](guests/vm101-ubuntu/docbr0-opnsense-routing.md) | OPNsense: 10.2.2.0/24 erreichbar machen |
## Code-Repos (separat von dieser Doku) ## Code-Repos (separat von dieser Doku)
+4
View File
@@ -10,6 +10,10 @@ Compose-Dateien und stack-relevante Konfiguration **ohne** Volumes, Datenbanken,
Passwörter in den Repo-Dateien sind durch `REDACTED` ersetzt. Live-Werte nur auf dem jeweiligen Gast. Passwörter in den Repo-Dateien sind durch `REDACTED` ersetzt. Live-Werte nur auf dem jeweiligen Gast.
| Gast | Routing / OPNsense |
|------|-------------------|
| [vm101-ubuntu](vm101-ubuntu/) | [docbr0-opnsense-routing.md](vm101-ubuntu/docbr0-opnsense-routing.md) |
**Sync vom Gast (Beispiel VM 101):** **Sync vom Gast (Beispiel VM 101):**
```bash ```bash
+2
View File
@@ -12,6 +12,8 @@
Externes Docker-Netz für Container mit **festen IPs** (`10.2.2.0/24`). Externes Docker-Netz für Container mit **festen IPs** (`10.2.2.0/24`).
**Erreichbarkeit aus LAN/VLANs:** [docbr0-opnsense-routing.md](docbr0-opnsense-routing.md)
| Stack / Service | Container | IP (docbr0) | | Stack / Service | Container | IP (docbr0) |
|-----------------|-----------|-------------| |-----------------|-----------|-------------|
| phpipam | phpipam-web | 10.2.2.19 | | phpipam | phpipam-web | 10.2.2.19 |
@@ -0,0 +1,180 @@
# docbr0 (10.2.2.0/24) — Routing & OPNsense
**Zweck:** Container mit festen IPs auf VM 101 aus dem lokalen Netz (LAN/VLANs) erreichbar machen.
**Stand:** 2026-06-28
**Betrifft:** OPNsense · VM 101 `ubuntu` (192.168.10.10) · Docker-Netz `docbr0`
---
## Kurzfassung
| Was | Wo |
|-----|-----|
| Docker-Netz | `10.2.2.0/24` (`docbr0`, extern) |
| Gateway für Container | **10.2.2.1** = VM 101 (Docker-Bridge auf dem Host) |
| VM Management-IP | **192.168.10.10** (VLAN 10 / 192.168.10.0/24) |
| OPNsense | Statische Route **10.2.2.0/24 → 192.168.10.10** + Firewall Pass |
`10.2.2.1` ist **kein OPNsense-Interface** — nur die Bridge auf der VM.
---
## Topologie
```
Client (z.B. 192.168.10.50 oder 192.168.40.x)
OPNsense (192.168.10.1)
│ Route: 10.2.2.0/24 via 192.168.10.10
│ Firewall: Pass (Quell-VLAN → 10.2.2.0/24)
VM 101 (192.168.10.10 eth0 + 10.2.2.1 docbr0)
│ ip_forward=1, FORWARD ACCEPT
Docker-Container (10.2.2.x)
├── 10.2.2.254 NPM
├── 10.2.2.253 Nextcloud
├── 10.2.2.22 Gitea (git2)
└── … siehe [README.md](README.md)
```
**Rückweg:** Container → Gateway 10.2.2.1 → VM → eth0 → OPNsense → Client.
Kein NAT nötig (intern → intern).
---
## OPNsense einrichten
### 1. Gateway (falls noch nicht vorhanden)
**System → Gateways → Configuration → Single → +**
| Feld | Wert |
|------|------|
| Name | `VM101_DOCKER` |
| Interface | LAN / VLAN10 (`192.168.10.0/24`) |
| IP address | **192.168.10.10** |
| Disable Gateway Monitoring | optional an (Host pingt evtl. nicht als GW) |
| Description | Docker docbr0 VM 101 |
### 2. Statische Route
**System → Routes → Configuration → +**
| Feld | Wert |
|------|------|
| Network | **10.2.2.0/24** |
| Gateway | **VM101_DOCKER** (192.168.10.10) |
| Description | Docker docbr0 VM101 |
**Apply Changes.**
### 3. Firewall-Regeln
**Firewall → Aliases → +** (optional, übersichtlicher)
| Name | Type | Content |
|------|------|---------|
| `DOCKER_DOCBR0` | Network | `10.2.2.0/24` |
**Firewall → Rules →** Interface der **Quelle** (z.B. **LAN** für 192.168.10.0/24):
| Feld | Wert |
|------|------|
| Action | Pass |
| Interface | LAN (bzw. VLAN10) |
| Protocol | any |
| Source | LAN net (oder spezifisches VLAN) |
| Destination | `DOCKER_DOCBR0` / `10.2.2.0/24` |
| Description | Allow → Docker docbr0 VM101 |
**Weitere VLANs:** dieselbe Logik auf **jedem** Interface, von dem aus Clients kommen (z.B. IoT `192.168.40.0/24`), sonst blockiert Inter-VLAN-Firewall.
Regel **oben** platzieren (vor generischen Block-Regeln).
**Apply Changes.**
---
## Was bewusst nicht auf OPNsense
| Maßnahme | Grund |
|----------|--------|
| Interface/VLAN `10.2.2.0/24` auf OPNsense | Netz existiert nur auf VM 101 |
| Outbound NAT intern → 10.2.2.x | Routing reicht |
| Port-Forward von WAN auf 10.2.2.x | Normaler Weg: DNS → NPM (10.2.2.254) |
---
## VM 101 (Docker-Host)
Bereits vorhanden / relevant:
| Check | Erwartung |
|-------|-----------|
| Bridge | `10.2.2.1/24` auf `docbr0` / `br-0362a13fe302` |
| `ip_forward` | `1` |
| FORWARD | policy ACCEPT |
| Docker | `"iptables": false` — Fest-IPs auf docbr0 bleiben stabil |
| Container-Internet | manuelles NAT → [../../pve1/scripts/vm101-docker-nat-rules.sh](../../pve1/scripts/vm101-docker-nat-rules.sh) |
```bash
# Auf VM 101
ip route | grep 10.2.2
ping -c1 10.2.2.253
ping -c1 10.2.2.254
sudo docker network inspect docbr0 --format '{{range .IPAM.Config}}{{.Subnet}}{{end}}'
```
---
## Tests
### Vom Client (lokal / VLAN)
```bash
traceroute 10.2.2.253 # erwartet Hop über 192.168.10.10
ping 10.2.2.254
curl -sI http://10.2.2.253/status.php
curl -sI http://10.2.2.254
```
### Von OPNsense (Diagnostics → Ping)
- Ziel `192.168.10.10` → OK
- Ziel `10.2.2.253` → OK (wenn Route + VM-Forward stimmen)
---
## Fehlerbilder
| Symptom | Wahrscheinliche Ursache |
|---------|-------------------------|
| Timeout, kein Hop zu .10 | Statische Route fehlt oder falscher Gateway |
| Hop zu .10, dann Timeout | VM: Forwarding / Bridge; Container down |
| Ping OK, HTTP nein | Container-Port / Dienst; nicht OPNsense |
| Nur aus einem VLAN | Firewall-Regel fehlt auf Quell-Interface |
| WAN-Zugriff gewünscht | Separat: DNS + NPM, nicht direkte 10.2.2-Route |
---
## Alltag vs. Admin-Zugriff
| Zugriff | Empfehlung |
|---------|------------|
| **Benutzer** | Hostname (`cloud.jeanavril.com`) → NPM (10.2.2.254) → Backend |
| **Admin / Debug** | Direkt `10.2.2.x` nach Route (Dockge, Container-Logs, Bypass NPM) |
Split-DNS oder lokaler DNS-Eintrag für interne Namen ist unabhängig von der statischen Route — beides kann parallel existieren.
---
## Referenzen
| Dokument | Inhalt |
|----------|--------|
| [README.md](README.md) | Stack-Liste, docbr0-IP-Tabelle |
| [../../pve1/06_ubuntu-vm-nextcloud.md](../../pve1/06_ubuntu-vm-nextcloud.md) | Nextcloud, NPM, notify_push |
| [../../shared/infrastruktur-netzwerk.md](../../shared/infrastruktur-netzwerk.md) | VLANs, Proxmox-Hosts |
| [../../pve1/scripts/vm101-docker-nat-rules.sh](../../pve1/scripts/vm101-docker-nat-rules.sh) | Container-Internet (NAT) |
+1
View File
@@ -17,6 +17,7 @@
| 06 | [06_ubuntu-vm-nextcloud.md](06_ubuntu-vm-nextcloud.md) | VM 101 ubuntu, Nextcloud Status & Optimierung | | 06 | [06_ubuntu-vm-nextcloud.md](06_ubuntu-vm-nextcloud.md) | VM 101 ubuntu, Nextcloud Status & Optimierung |
| — | [scripts/](scripts/) | VM-101-Skripte (NAT, Wartungs-Cron, crontab) | | — | [scripts/](scripts/) | VM-101-Skripte (NAT, Wartungs-Cron, crontab) |
| — | [../guests/vm101-ubuntu/](../guests/vm101-ubuntu/) | VM 101 Docker-Stacks (Compose, ohne Daten) | | — | [../guests/vm101-ubuntu/](../guests/vm101-ubuntu/) | VM 101 Docker-Stacks (Compose, ohne Daten) |
| — | [../guests/vm101-ubuntu/docbr0-opnsense-routing.md](../guests/vm101-ubuntu/docbr0-opnsense-routing.md) | OPNsense: Route/Firewall für 10.2.2.0/24 |
## Shared ## Shared
+2
View File
@@ -34,6 +34,8 @@ Schema: VLAN-ID oft = drittes Oktett (`192.168.40.0/24` = VLAN 40)
Details CT/VM-Netze: siehe Host-Doku unter `pve1/` bzw. `pve2/`. Details CT/VM-Netze: siehe Host-Doku unter `pve1/` bzw. `pve2/`.
**Docker docbr0 auf VM 101 (10.2.2.0/24):** OPNsense-Route + Firewall → [guests/vm101-ubuntu/docbr0-opnsense-routing.md](../guests/vm101-ubuntu/docbr0-opnsense-routing.md)
## Rollen ## Rollen
- **pve2:** Produktiv, OPNsense VM 104, Home Assistant VM 106, Docker/Frigate CT 101, GPU-Host - **pve2:** Produktiv, OPNsense VM 104, Home Assistant VM 106, Docker/Frigate CT 101, GPU-Host