schlamp
Goto Top

Openvpn client Netz ereichbar machen

Guten Tag ich bin neu hier!
Habe des öfteren schon hier im Forum mitgelesen und bin begeistert.
Jetzt möchte ich mich mit einen Problem direkt an Euch wenden!
Ich verwende für unsere Familie Openvpn damit wir auf unsere Daten von überall zugreifen könnten.
Ich habe in meiner Wohnung eine Nas die ich gerne auch zu unseren openvpn Netz ankoppeln möchte.
Leider ist diese nas nicht Openvpn tauglich. Da dachte ich mir ich nehme einen Raspberry und nutze diesen als biligen Stromsparenden Adabter.
Nun habe ich zwar zugriff auf Raspberry aber nicht auf das Netzwerk wo auch die Nas sitzt.
Ich habe im CCD File mit iroute das Netzwerk dem Openvpn Server mitgeteilt und mit route auf dem Server Das clientnetz auch eingetragen.

Fakt ist ich kann von jeder beliebigen Client einen Ping auf den Raspberry machen(client Netz) jedoch nicht zur Nas!

Mein verdacht ist das ich auf dem Raspberry irgend eine config noch fehlt

Was sagt ihr? Was mache ich falsch?

Lg

Content-Key: 312555

Url: https://administrator.de/contentid/312555

Printed on: April 16, 2024 at 23:04 o'clock

Mitglied: 129813
129813 Aug 13, 2016 updated at 12:56:41 (UTC)
Goto Top
Hi
as simple as adding a static route to the OpenVPN network on your default gateway of your LAN (router).
Network : 10.0.8.x/24 (replace with your OVPN Network and Mask)
Gateway : 192.168.?.? (LAN IP of your raspberry)
Otherwise the packets don't find it's way back to the VPN-Clients!

Also be sure that IP-Forwarding is enabled on your raspi.
For running system
sudo echo 1 >/proc/sys/net/ipv4/ip_forward
For permanent activation
sudo nano /etc/sysctl.conf

# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1

Alternative for this is to masquerade (SRC-NAT) traffic on the OpenVPN-Server which leaves the tunnel, but routing should always be preferred if possible.

Regards
Member: schlamp
schlamp Aug 13, 2016 at 12:58:03 (UTC)
Goto Top
Also die IP von meinem OPENVPN Server ist 10.98.0.1 die VPN Ip des Raspberry ist 10.98.113.1 und die Ip im localem Netz ist 192.168.20.16
Also muss ich in meinem Router (Netgear D500) folgendes einstellen

Destination IP Address 	192.168.20.16
IP Subnet Mask 	                255.255.255.0
Gateway IP Address 	        10.98.0.1
Metric 	                                        10

ist das richtig?

Lg
Mitglied: 129813
129813 Aug 13, 2016 updated at 13:02:59 (UTC)
Goto Top
Zitat von @schlamp:

Also die IP von meinem OPENVPN Server ist 10.98.0.1 die VPN Ip des Raspberry ist 10.98.113.1 und die Ip im localem Netz ist 192.168.20.16
Also muss ich in meinem Router (Netgear D500) folgendes einstellen

> Destination IP Address 	192.168.20.16
> IP Subnet Mask 	                255.255.255.0
> Gateway IP Address 	        10.98.0.1
> Metric 	                                        10
> 

ist das richtig?
No it's not, target (destination) network is the internal OpenVPN Network (10.98.0.0/24) and the GW IP is the 192.168.20.16(Raspi in your LAN)

Be sure to enter a network address as destination, not a single host ip !!
Member: schlamp
schlamp Aug 13, 2016 at 13:04:13 (UTC)
Goto Top
Zitat von @129813:

No it's not, target (destination) network is the internal OpenVPN Network (10.98.0.0/24) and the GW IP is the 192.168.20.16(Raspi in your LAN)
Endschuldige ich verstehe den Satz nicht richtigface-sad

Du meinst also umgekehrt?
Destination IP Address 10.98.0.1
Gateway IP Address 192.168.20.16
Lg
Mitglied: 129813
129813 Aug 13, 2016 updated at 13:09:39 (UTC)
Goto Top
Du meinst also umgekehrt?
Correct, but enter a network address! .0 at the end for the destination:
Destination Network : 10.98.0.0
Netmask: 255.255.255.0
Gateway: 192.168.20.16

the clients in your net don't know anything about your VPN network so this route makes sure that your router knows where to find this network -> on your raspberry face-wink, so that the packets find their way back to the VPN, simple routing knowledge.
Member: schlamp
schlamp Aug 13, 2016 at 13:09:35 (UTC)
Goto Top
Sorry aber mein Router erlaubt die einstellung so rum nicht! Was mache ich falsch?
Bin unter Static Routes!!
Lg
Mitglied: 129813
129813 Aug 13, 2016 updated at 13:15:34 (UTC)
Goto Top
Then you are telling us something wrong ...

Destination is always your internal OpenVPN Network-Address and the gateway is the host where the OpenVPN-Server is located in your LAN!!! Works a 100%.

Draw us a picture what is what please ...
Member: schlamp
schlamp Aug 13, 2016 at 13:16:13 (UTC)
Goto Top
Der Router nimmt die einstellung der IP Adresse des Openvpn Servers nicht an!
Was mache ich falsch
Mitglied: 129813
129813 Aug 13, 2016 updated at 13:18:20 (UTC)
Goto Top
Draw us a picture of your network with the IPs of your devices please!

You're not using the right terms for your devices and we cannot see your infrastructure face-sad
Mitglied: 129813
129813 Aug 13, 2016 updated at 13:24:11 (UTC)
Goto Top
And please read the basics to understand what you're doing:
OpenVPN Server installieren auf pfSense Firewall, Mikrotik. DD-WRT oder GL.inet Router

You simply have to make sure that packets in the target LAN find its way back, so the LAN where the OpenVPN Server resides needs a static route on the gateway which points to the OpenVPN-Server. if you understand this you know what to do and why the static route is needed !!!
Member: schlamp
schlamp Aug 13, 2016 at 13:22:48 (UTC)
Goto Top
moment das BILD kommtface-smile
Member: schlamp
schlamp Aug 13, 2016 at 13:27:19 (UTC)
Goto Top
Member: schlamp
schlamp Aug 13, 2016 at 13:30:34 (UTC)
Goto Top
Ich habe das mit der Rückroute schon verstanden aber mein Router will davon nichts wissenface-sad
Lg
Mitglied: 129813
129813 Aug 13, 2016 updated at 13:35:02 (UTC)
Goto Top
It's like I said above. Otherwise your router is configured incorrectly has a Bug or you are on the wrong page...or entering false information.
Mitglied: 129813
129813 Aug 13, 2016 updated at 13:40:14 (UTC)
Goto Top
ehh, your OpenVPN IP network is not the one you told us ....on the picture it's 10.99.113.0 ?????
And your router and Raspi have the same IP??? that doesn't work face-smile
Member: schlamp
schlamp Aug 13, 2016 at 13:40:58 (UTC)
Goto Top
Router

In diesem Bild sieht man die Einstellseite meines Routers!
Danke Lg
Member: schlamp
schlamp Aug 13, 2016 at 13:47:39 (UTC)
Goto Top
Im Bild ist mir ein Fehler passiertface-sad Der Raspberry hat 192.168.20.16!
Und Seine OPENVPN Adresse ist 10.98.113.1!
Diese weiße ich dem Raspberry mittels CCD file zu!
ifconfig-push 10.99.113.1 10.99.113.2 #Raspberry
Lg
Mitglied: 129813
129813 Aug 13, 2016 updated at 14:05:06 (UTC)
Goto Top
Like I said your openVPN network IPs on your first picture and on this thread doesn't match ???
Second: if the router doesn't accept such a static route, it has a bug (Netgear: really no wonder ...), go and get a better one, or directly enter the route on your NAS

Otherwise take the alternative with masquerading on the raspi in my first post.
See the tutorial posted above.

Good luck.
Bye
Member: schlamp
schlamp Aug 13, 2016 updated at 14:19:23 (UTC)
Goto Top
Ordentliches Bild meines Netzwerkes
So habe noch ein besseres Bild angefertigt.
Kann es wirklich sein das mein Netgear Router einen Bug hat?
Lg

Ps tue mir mit Englisch etwas schwerface-smile Hoffe das ich alles richtig verstanden habe!
Mitglied: 129813
129813 Aug 13, 2016 updated at 14:45:25 (UTC)
Goto Top
OK so you are instead using a 255.255.0.0 mask in your OpenVPN network (why?) when the IPs are correct
so
Destination 10.98.0.0
Mask 255.255.0.0
Gateway 192.168.20.16
If this is not accepted by your router i have an idea, perhaps this old hardware uses and forces the old private subnet class model where the 10.x.x.x net was a CLASS C network with a mask of 255.0.0.0.
If this would be the case try these settings, to route the whole 10.x.x.x net to the raspi:
Destination 10.0.0.0
Mask 255.0.0.0
Gateway 192.168.20.16
If this is also not accepted it definitely has a bug !!

If you only want to reach the NAS , you could also put the static route directly onto the NAS itself.
Member: Pjordorf
Pjordorf Aug 13, 2016 at 14:54:35 (UTC)
Goto Top
Hallo,

Zitat von @schlamp:
Ordentliches Bild meines Netzwerkes]
Poste deine Bilder bitte direkt hier ins Forum Das Icon links neben deiner Kommentare ist doch nicht zu übersehen. Formatting instructions in the posts
kamerasymbol
Kann es wirklich sein das mein Netgear Router einen Bug hat?
Selbst NetGear weiß das Routen immer zu Netzen - selten zu IPs gemacht werden. Daher hinterfrage warum dort (NetGear Menü) nur ein IP zulässig erscheint (aber nicht zwingend ist). Seite 75 deines Handbuchs hat auch ein valides Beispiel: http://www.downloads.netgear.com/files/GDC/D500/D500-D1500_UM_22Aug2014 ...
Destination IP: dein Ziel Netz (Netze haben immer eine 0 am ende) 10.98.0.0
Subnet Mask: deine gwählte Maske 255.255.255.0
Gateway: Dein Raspberry 192.168.20.3
Warum dein Raspberry PI nicht selbst dein VPN Server macht wird uns wohl ein Rätsel bleiben. Viel Komplizierter geht es kaum.

Gruß,
Peter
Member: schlamp
schlamp Aug 13, 2016 at 15:05:35 (UTC)
Goto Top
Ich habe im Netgear Menu einen Fehler gemacht. Habe ja ursprünglich die IP falsch ruhm eingegegebenface-sad Dann aber immer mit edit versucht meinen Fehler zu korrigieren. Mit Löschen und neu eintragen geht die Eingabe. Leider aber nicht der Zugang zu meiner Nasface-sad

Müsste ich vielleicht die Adresse meiner andern Vpn Clients auch in die statischen Routen eintragen?


Zitat von @Pjordorf:

Hallo,

Zitat von @schlamp:

Warum dein Raspberry PI nicht selbst dein VPN Server macht wird uns wohl ein Rätsel bleiben. Viel Komplizierter geht es kaum.

Gruß,
Peter

Mein Server im Internet hat eine Statische Ip und macht auch andere Sachen!
Mitglied: 129813
129813 Aug 13, 2016 updated at 16:44:32 (UTC)
Goto Top
Have you read my other comments in my very first post ?

IP-Forwarding on your raspberry must be enabled and your OpenVPN-Server also needs to know where the 20.x Subnet is reachable so it must have a route to the raspberry.
Member: aqui
aqui Aug 13, 2016 at 16:52:48 (UTC)
Goto Top
Man muss sich wirklich manchmal fragen wie groß die Tomaten sein müssen auf den Augen um die Bilder Upload Funktion hier zu übersehen. Jeder Erstklässler erkennt das anstatt sinnlose Extraklicks auf Google zu erzwingen... face-sad
Zurück zum Thema.
Du kannst das nur lösen mit einer LAN zu LAN Kopplung des RasPi sprich indem du dem Server ein ip route Kommando konfigurierst auf das 192.168.20.0er Netz, so das Clients im VPN Netz wissen das Pakete für dieses Netz auch in den Tunnel geroutet werden.
route print zeigt dir an ob es richtig konfiguriert ist.
Zusätzlich natürlich die statische Route in deine Netgear Router.
Mit der Distribution der 192.168.20er Route im VPN Netz klappt das dann auch Anhieb.
Member: schlamp
schlamp Aug 14, 2016 at 07:45:49 (UTC)
Goto Top
Zitat von @aqui:

Man muss sich wirklich manchmal fragen wie groß die Tomaten sein müssen auf den Augen um die Bilder Upload Funktion hier zu übersehen. Jeder Erstklässler erkennt das anstatt sinnlose Extraklicks auf Google zu erzwingen... face-sad
Sorry wusste nicht das das so ein großes Verbrechen ist!!!!

Zurück zum Thema.
Du kannst das nur lösen mit einer LAN zu LAN Kopplung des RasPi sprich indem du dem Server ein ip route Kommando konfigurierst auf das 192.168.20.0er Netz, so das Clients im VPN Netz wissen das Pakete für dieses Netz auch in den Tunnel geroutet werden.
route print zeigt dir an ob es richtig konfiguriert ist.
Das habe ich schon vorher so gehabt!
Zusätzlich natürlich die statische Route in deine Netgear Router.
Da habe ich den entscheidenden Fehler gemacht! Ich muß ein Statische Route in den Adressbereich von jedem der VPN IPs der Clients die die Nas erreichen wollen anlegen! Die Statische Route zum VPN Server hat gar nicht gebracht!
Mit der Distribution der 192.168.20er Route im VPN Netz klappt das dann auch Anhieb.

Danke für Eure Hilfe!
Mitglied: 129813
129813 Aug 14, 2016 updated at 08:34:21 (UTC)
Goto Top
Zitat von @schlamp:
Die Statische Route zum VPN Server hat gar nicht gebracht!
We never told you this ! I told you to create a static route to your raspi (which is the local gateway to your VPN network) with the subnet the VPN Clients are using internally.

Wireshark, or a little bit thinking how the packets are traveling, would have told you this too face-wink
Member: schlamp
schlamp Aug 14, 2016 at 09:19:58 (UTC)
Goto Top
Zitat von @129813:

Zitat von @schlamp:
Die Statische Route zum VPN Server hat gar nicht gebracht!
We never told you this ! I told you to create a static route to your raspi (which is the local gateway to your VPN network) with the subnet the VPN Clients are using internally.

Wireshark, or a little bit thinking how the packets are traveling, would have told you this too face-wink

Leider verstehe ich nur einen Bruchteil von dem was du schreibst! (google translate ist für solche spezifischen sachen zu schwach)
Trotzdem Danke
Member: aqui
aqui Aug 14, 2016 updated at 09:45:56 (UTC)
Goto Top
Ziemlich traurig, denn Englisch ist in der IT ja nun mal die Lingua Franca wie jeder weiß und das zu verstehen sollten die Grundschulkenntnisse reichen, die ja nun mal jeder haben sollte.. ! face-sad
Was will man erwarten wenn schon das Erkennen eines Kamerasymbols zum Problem wird. (Man kann das übrigens noch nachträglich anpassen mitt ... und Bearbeiten) Aber egal...andere Baustelle ! Zurück zum Thema.
Letztlich steht dadrin das du sowohl die statische Route im Router auf das RasPi VPN Netzdefinieren musst als auch die Route aus dem Client Netz mit dem zusätzlichen iroute... oder route Kommando im OVPN Setup distribuieren musst !!
route 192.168.20.0/24 in der Server Konfig solte reichen.
Wie gesagt sieh dir immer die Routing Tabelle im Client UND im Server an damit du weisst wo und wie diese Routen bekannt sind.
Bei unixoiden OS ist das netstat -r -n bzw. auch ip route show und bei Winblows route print.
Das sagt dir ob diese Zielnetze auf der einen oder anderen Seite bekannt sind.
Member: Pjordorf
Pjordorf Aug 14, 2016 at 09:49:47 (UTC)
Goto Top
Hallo,

Zitat von @schlamp:
Leider verstehe ich nur einen Bruchteil von dem was du schreibst! (google translate ist für solche spezifischen sachen zu schwach)
Schon mal andere Übersetzer versucht? Und ja, alleine schon der erste Satz lässt google translate schwach aussehenface-smile
Meine übersetzung:
Wir haben dir dies niemals gesagt! Ich sagte dir du sollst eine Statische Route zu dein Raspi (welches das Lokale Gateway zu dein VPN Netzwerk darstellt) mit dem Subnetz welche deine internen VPN Clients nutzen erstellen.
Wireshark, oder ein wenig nachdenken wie die Pakete laufen, hätten dir es ebenfalls gesagt.

Ich hoffe es korrekt wiedergegeben habe face-smile

Hättest du einen VPN Server auf dein Raspi gemacht, hättest du diese Probleme nicht gehabt nur um an dein NAS im Lokalen LAN zu kommen...

Gruß,
Peter
Member: schlamp
schlamp Aug 14, 2016 at 10:04:03 (UTC)
Goto Top
Zitat von @aqui:

Ziemlich traurig, denn Englisch ist in der IT ja nun mal die Lingua Franca wie jeder weiß und das zu verstehen sollten die Grundschulkenntnisse reichen, die ja nun mal jeder haben sollte.. ! face-sad
Was will man erwarten wenn schon das Erkennen eines Kamerasymbols zum Problem wird. (Man kann das übrigens noch nachträglich anpassen mitt ... und Bearbeiten)

Danke für die Kritik!!!
Wie ich schon in meinem Eingangspost geschrieben habe bin ich nicht Professionell unterwegs sondern nur für die Familie!
Und durch Eurer Hilfe habe ich ja die Lösung erarbeitet.
Sogar den Fehler selbst gefundenface-wink den die beschriebene Route hat ja mein Problem nicht gelöstface-wink

Ps Normalerweise wird man in Foren begrüßtface-wink
Member: schlamp
schlamp Aug 14, 2016 at 10:07:01 (UTC)
Goto Top
Zitat von @Pjordorf:

Hättest du einen VPN Server auf dein Raspi gemacht, hättest du diese Probleme nicht gehabt nur um an dein NAS im Lokalen LAN zu kommen...

Gruß,
Peter

Da aber alle meine Familien Mitglieder auch eine Nas haben und man ja nicht ständig auf andere Vpn Netze einloggen will ist das aus meiner Sicht die bessere Lösung!

Danke
Member: Pjordorf
Pjordorf Aug 14, 2016 updated at 10:40:54 (UTC)
Goto Top
Hallo,

Zitat von @schlamp:
Da aber alle meine Familien Mitglieder auch eine Nas haben und man ja nicht ständig auf andere Vpn Netze einloggen will ist das aus meiner Sicht die bessere Lösung!
Es gibt auch Benutzernamen und Passwörter um das zu regeln....

[1/2 OT]
Ps Normalerweise wird man in Foren begrüßt
Nett gebrüllt kitty, dann solltest du aber erst noch deine Bilder hier direkt ins Forum reinstellen und am ende noch einen grünen Balken spenden. Die von dir durchgelesenen und zugestimmten Forenregeln sind ja schließlich in Deutsch face-smile

Bilder: Formatting instructions in the posts
Grüner Balken: How can I mark a post as solved?
[End 1/2 OT]

Gruß,
Peter
Member: schlamp
schlamp Aug 14, 2016 at 13:21:59 (UTC)
Goto Top
Zitat von @Pjordorf:

Es gibt auch Benutzernamen und Passwörter um das zu regeln....

Gruß,
Peter
Wir leben aber nicht in der selben Stadt! Außerdem haben wir einen Gemeinsamen Webserver!
Lg