Jump to content

Routing Problem VM mit Wireguard


Avenga
Go to solution Solved by Avenga,

Recommended Posts

Hallo,

ich habe heute meinen RPi4 gegen eine VM auf Unraid (größtenteils) ersetzt, so hatte ich es vor über einem Jahr in einem anderen Netzwerk auch schon getan, nur damals ist der RPi4 auf eine VM in einer Synology DS218 gezogen.

 

Ich verwende Ubuntu Server minimal 22.04.3 LTS (5.15.0-84-generic x86_64) auf beiden VM.

 

Beide Netzwerke sind seit Jahren miteinander verbunden über Wireguard, ohne Probleme.

 

Seit ein paar Wochen hatte ich eine zusätzliche Route in den FritzBoxen hinzugefügt, so dass ich vom Roadwarrior über Netzwerk 1 auch auf Netzwerk 2 zugreifen kann (und umgekehrt). Da Netzwerk 2 keine IPv4 besitzt, und ich so in Hotels dennoch auf beide Netzwerke Zugriff habe.

 

Seit ich heute "umgezogen" bin klappt das nur noch einseitig und ich finde den Fehler nicht.

 

1123.JPG.d66fae0b682e47a090cde6d5cf4e99bd.JPG

 

orange: kommt ins Netzwerk A und darüber ins Internet, aber nicht ins Netzwerk B.

grün: klappt, so wie vor dem Umzug.

 

Wireguard  Netzwerk A:

[Interface]
Address = 192.168.99.1/24, fd08::1/64
ListenPort = 51820
PrivateKey = xxx
MTU = 1412

PostUp = iptables -A FORWARD -i %i -j ACCEPT
PostUp = iptables -A FORWARD -o %i -j ACCEPT
PostUp = ip6tables -A FORWARD -i %i -j ACCEPT
PostUp = ip6tables -A FORWARD -o %i -j ACCEPT
PostUp = ip6tables -t nat -A POSTROUTING -o enp1s0 -j MASQUERADE

PostDown = iptables -D FORWARD -i %i -j ACCEPT
PostDown = iptables -D FORWARD -o %i -j ACCEPT
PostDown = ip6tables -D FORWARD -i %i -j ACCEPT
PostDown = ip6tables -D FORWARD -o %i -j ACCEPT
PostDown = ip6tables -t nat -D POSTROUTING -o enp1s0 -j MASQUERADE

[Peer]
PublicKey = xxx
AllowedIPs = 192.168.99.2/32, fd08::2/128
[Peer]
PublicKey = xxx
AllowedIPs = 192.168.99.3/32, fd08::3/128
[Peer]
PublicKey = xxx
AllowedIPs = 192.168.99.4/32, fd08::4/128
[Peer]
PublicKey = xxx
AllowedIPs = 192.168.99.5/32, fd08::5/128
[Peer]
PublicKey = xGZWFnT2tyO3+HqKBuc4BFtj/8T6RPjgXsp0k9kkny0=
AllowedIPs = 192.168.99.0/24, 192.168.74.0/24, fd08::/64, fd00:bbbb::/64
Endpoint = xxx.dynv6.net:51821
PersistentKeepalive = 25

 

Netzwerk B:

[Interface]
Address = 192.168.99.10/24, fd08::10/64
ListenPort = 51821
PrivateKey = xxx
MTU = 1412

PostUp = iptables -A FORWARD -i %i -j ACCEPT
PostUp = iptables -A FORWARD -o %i -j ACCEPT
# PostUp = iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE
PostUp = ip6tables -A FORWARD -i %i -j ACCEPT
PostUp = ip6tables -A FORWARD -o %i -j ACCEPT
PostUp = ip6tables -t nat -A POSTROUTING -o ens3 -j MASQUERADE

PostDown = iptables -D FORWARD -i %i -j ACCEPT
PostDown = iptables -D FORWARD -o %i -j ACCEPT
# PostDown = iptables -t nat -D POSTROUTING -o ens3 -j MASQUERADE
PostDown = ip6tables -D FORWARD -i %i -j ACCEPT
PostDown = ip6tables -D FORWARD -o %i -j ACCEPT
PostDown = ip6tables -t nat -D POSTROUTING -o ens3 -j MASQUERADE

[Peer]
PublicKey = xxx
AllowedIPs = 192.168.99.0/24, 192.168.168.0/24, fd08::/64, fd00:aaaa::/64
[Peer]
PublicKey = xxx
AllowedIPs = 192.168.99.11/32, fd08::11/128
[Peer]
PublicKey = xxx
AllowedIPs = 192.168.99.12/32, fd08::12/128
[Peer]
PublicKey = xxx
AllowedIPs = 192.168.99.13/32, fd08::13/128
[Peer]
PublicKey = xxx
AllowedIPs = 192.168.99.14/32, fd08::14/128
[Peer]
PublicKey = xxx
AllowedIPs = 192.168.99.15/32, fd08::15/128

 

Im alten RPi ist Wireguard aus und seine statische IP ist geändert.

 

In den FritzBoxen sind jeweils die Routen eingetragen

grafik.thumb.png.1a92d65674d6fddad992c099baa37258.png

 

Mit einer Routenverfolgung am Android komme ich leider auch nicht weiter.

 

Dachte erst es läge an Unraid, aber dann würde ich ja nicht vom Roadwarrior in die VM und von dort ins Internet kommen.

Neben der VM laufen noch ein paar Docker.

 

Für einen heißen Tipp wäre ich dankbar.

Link to comment

Hi,

welche Werte sind denn in den Wireguard VMs in der /etc/sysctl.conf gesetzt?

 

net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1

 

Anhand der Aussage "Client Orange kommt ins Netzwerk A und darüber ins Internet..." gehe ich davon aus, dass der gesamte Traffic (auch Internet) über den Tunnel geht, also unter AllowedIP 0.0.0.0/0 gesetzt ist?

Link to comment
  • Solution

Ich hatte den Fehler gefunden, man darf niemals in einer config unter zwei peers die gleiche allowed IPs stehen haben. (sieht man oben nicht)

 

Falls es Jemanden interessieren sollte, hier die funktionierende Konfig als Bild: Link

Edited by Avenga
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...