Horus WG-Routen-Fix dokumentieren und Route-Service ins Repo.

wg syncconf legt keine AllowedIPs-Routen an; OPNsense Static-Route
192.168.178.1 als häufige Fehlerquelle für LAN→Horus ergänzt.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
root
2026-06-28 12:27:55 +02:00
parent 830f1f4fdd
commit 26dcf96475
3 changed files with 55 additions and 3 deletions
+31 -3
View File
@@ -87,14 +87,41 @@ Siehe [horus-server-peer-opnsense.conf](horus-server-peer-opnsense.conf) — ber
## Test ## Test
```bash ```bash
# Handshake auf Horus (nach OPNsense-Aktivierung): # Handshake auf Horus:
ssh jean@192.168.10.10 'ssh root@10.1.1.1 wg show wg0 | grep -A5 walbWTYX' ssh jean@192.168.10.10 'ssh root@10.1.1.1 wg show wg0 | grep -A6 walbWTYX'
# Von LAN-PC: # Von LAN-PC:
ping 10.1.1.1 ping 10.1.1.1
ssh root@10.1.1.1 # Keys: ../ssh/assembled/horus-root.pub ssh root@10.1.1.1
``` ```
## Horus: fehlende WG-Routen (wichtig)
`wg syncconf` auf Horus legt **keine Kernel-Routen** für die OPNsense-`AllowedIPs` an. Ohne Fix gehen Antworten von Horus zu euren LANs über **eth0/Internet** statt **wg0**.
Symptom auf Horus: `ip route get 192.168.20.2` zeigt `via 207.180.222.1 dev eth0` statt `dev wg0`.
**Fix (auf Horus, persistent):**
```bash
/usr/local/sbin/wg0-opnsense-routes.sh # siehe wg0-opnsense-routes.sh in diesem Ordner
systemctl enable --now wg0-opnsense-routes.service
```
**iptables/ufw:** wg0 ist offen (61951/udp, `Anywhere on wg0` IN + FWD). Kein IP-spezifischer Block für 10.1.1.22.
## OPNsense: falsche Route (LAN → Horus)
Wenn der Tunnel steht, aber vom LAN nichts ankommt: oft eine **alte Static Route** auf OPNsense.
Traceroute von intern sollte sein: `… → OPNsense → 10.1.1.1` (via WG).
Falsch (beobachtet): Hop 2 = `192.168.178.1` — Traffic geht zur alten Fritz/VM-Route statt WireGuard.
**Prüfen:** System → Routes → Einträge für `10.1.1.0/24` / `10.8.0.0/24` — muss über **WireGuard-Gateway** (`horusopnsense`), nicht `192.168.178.1`.
**Firewall:** VLAN20 → Destination `10.1.1.0/24` → Pass.
## VM 101 (optional später) ## VM 101 (optional später)
VM 101 nutzt **10.1.1.5** ([vm101-client.conf](vm101-client.conf)) und advertised u.a. `10.2.0.0/16` an Horus. VM 101 nutzt **10.1.1.5** ([vm101-client.conf](vm101-client.conf)) und advertised u.a. `10.2.0.0/16` an Horus.
@@ -111,5 +138,6 @@ Nicht beides parallel dieselben Subnetze an Horus announcen.
| Thema | Doc | | Thema | Doc |
|-------|-----| |-------|-----|
| Horus SSH-Keys | [../ssh/README.md](../ssh/README.md#horus-vps-wireguard) | | Horus SSH-Keys | [../ssh/README.md](../ssh/README.md#horus-vps-wireguard) |
| Route-Skript | [wg0-opnsense-routes.sh](wg0-opnsense-routes.sh) |
| docbr0 / 10.2.2.0/24 | [../../pve1/guests/vm101-ubuntu/docbr0-opnsense-routing.md](../../pve1/guests/vm101-ubuntu/docbr0-opnsense-routing.md) | | docbr0 / 10.2.2.0/24 | [../../pve1/guests/vm101-ubuntu/docbr0-opnsense-routing.md](../../pve1/guests/vm101-ubuntu/docbr0-opnsense-routing.md) |
| VLAN-Übersicht | [../infrastruktur-netzwerk.md](../infrastruktur-netzwerk.md) | | VLAN-Übersicht | [../infrastruktur-netzwerk.md](../infrastruktur-netzwerk.md) |
@@ -0,0 +1,12 @@
[Unit]
Description=WireGuard wg0 routes for OPNsense peer (Horus)
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/local/sbin/wg0-opnsense-routes.sh
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,12 @@
#!/bin/bash
# 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
set -euo pipefail
ip link show wg0 &>/dev/null || exit 0
for net in \
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.2.2.0/24; do
ip route replace "$net" dev wg0
done