Hallo zusammen,
ich hoffe ihr könnt mir bei meinem Problem helfen. Ich bin so langsam ratlos und am Verzweifeln.
Ausgangslage:
Ich hänge an einem Glasfaser Anschluss mit CGNAT. Ich betreibe ein Unfi Gateway, dass direkt am ONT anschlossen ist. Um das CGNAT Problem zu umgehen habe ich mir bei IONOS einen VPS gemietet. Auf dem Server habe ich Docker mit Portainer installiert. Mit Docker habe ich mir WG-Easy inkl. Wireguard bereitgestellt.
Damit möchte damit mit diversen Peers (in diesem Fall ein iPhone) auf mein Heimnetzwerk zugreifen. Ein Exponieren von selbst gehosteten Diensten ist nicht geplant.
Mein Heimnetz hat aktuell folgende Netze:
10.0.10.0/24
(10.0.20.0/24) kommt bald dazu – wird bei der weiteren Problembeschreibung erst einmal nicht berücksichtig
Das Wireguard VPN Netz hat den Netzbereich 10.0.66.0/24.
- VPS Wireguard Server 10.0.66.1
- iPhone 10.0.66.2
- Unifi Gateway 10.0.66.3
Das Problem:
Das Unfi Gateway sowie mein iPhone können sich erfolgreich mit dem Wireguard Server verbinden. Ich kann mit einem tcpdump am Unifi Gateway sehen, dass der Ping auf die IP 10.0.66.3 vom iPhone ankommt. Ein Ping von meinem PC im Heimnetzwerk (10.0.10.124) zum iPhone ist auch erfolgreich und kommt an. Wenn ich allerdings versuche vom iPhone ein System im Heimnetz zu erreichen (zum Bespiel mit der IP 10.0.10.40) kommen keine Datenpakete beim Unfi Gateway an. Tcpdump schweigt in diesem Fall.
Irgendwo habe ich ein Routing Problem und sehe es nicht.
Hier die Config der Docker Compose:
volumes:
etc_wireguard:
services:
wg-easy:
environment:
# Change Language:
# (Supports: en, ua, ru, tr, no, pl, fr, de, ca, es, ko, vi, nl, is, pt, chs, cht, it, th, hi, ja, si)
- LANG=de
# ⚠️ Required:
# Change this to your host's public address
- WG_HOST=<öffentliche Server IP>
# Optional:
# - PORT=51821
- WG_PORT=51820
# - WG_CONFIG_PORT=92820
- WG_DEFAULT_ADDRESS=10.0.66.x
- WG_DEFAULT_DNS=1.1.1.1
- WG_MTU=1420
- WG_ALLOWED_IPS=10.0.66.0/24,10.0.10.0/24
- WG_PERSISTENT_KEEPALIVE=25
# - WG_PRE_UP=echo "Pre Up" > /etc/wireguard/pre-up.txt
- WG_POST_UP=ip route add 10.0.10.0/24 via 10.0.66.3
# - WG_PRE_DOWN=echo "Pre Down" > /etc/wireguard/pre-down.txt
- WG_POST_DOWN=ip route del 10.0.10.0/24 via 10.0.66.3
# - UI_TRAFFIC_STATS=true
# - UI_CHART_TYPE=0 # (0 Charts disabled, 1 # Line chart, 2 # Area chart, 3 # Bar chart)
# - WG_ENABLE_ONE_TIME_LINKS=true
# - UI_ENABLE_SORT_CLIENTS=true
# - WG_ENABLE_EXPIRES_TIME=true
# - ENABLE_PROMETHEUS_METRICS=false
image: ghcr.io/wg-easy/wg-easy
container_name: wg-easy
volumes:
- etc_wireguard:/etc/wireguard
ports:
- "51820:51820/udp"
- "51821:51821/tcp"
restart: unless-stopped
cap_add:
- NET_ADMIN
- SYS_MODULE
# - NET_RAW # ⚠️ Uncomment if using Podman
sysctls:
- net.ipv4.ip_forward=1
- net.ipv4.conf.all.src_valid_mark=1
Die Wireguard Server wg0.conf sieht wie folgt aus:
# Note: Do not edit this file directly.
# Your changes will be overwritten!
# Server
[Interface]
PrivateKey = xx
Address = 10.0.66.1/24
ListenPort = 51820
PreUp =
PostUp = ip route add 10.0.10.0/24 via 10.0.66.3
PreDown =
PostDown = ip route del 10.0.10.0/24 via 10.0.66.3
# Client: iPhone (xx)
[Peer]
PublicKey = xx
PresharedKey = xx
AllowedIPs = 10.0.66.2/32
# Client: UnifiGateway (xx)
[Peer]
PublicKey = xx
PresharedKey = xx
AllowedIPs = 10.0.66.3/32
Die iPhone Config:
[Interface]
PrivateKey = xx
Address = 10.0.66.2/24
DNS = 1.1.1.1
MTU = 1420
[Peer]
PublicKey = xx
PresharedKey = xx
AllowedIPs = 10.0.66.0/24,10.0.10.0/24
PersistentKeepalive = 25
Endpoint = <öffentliche Server IP>:51820
Die Unfi Gateway Config:
[Interface]
PrivateKey = xx
Address = 10.0.66.3/24
DNS = 1.1.1.1
MTU = 1420
[Peer]
PublicKey = xx
PresharedKey = xx
AllowedIPs = 10.0.66.0/24,10.0.10.0/24
PersistentKeepalive = 25
Endpoint = <öffentliche Server IP>:51820
Hat jemand von euch eine Idee, warum ich nicht vom Peer aus in das Heimnetz komme? Ich sehe den Wald vor lauter Bäumen nicht mehr.
Grüße