VPN-Tunnel für nur einen Benutzer einrichten

Einrichten des lokalen Netzes, Verbindung zu anderen Computern und Diensten.
Antworten
Offerus
Beiträge: 90
Registriert: 22.09.2012 13:04:29

VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von Offerus » 04.01.2018 22:01:08

Hallo zusammen,

ich möchte auf einem debian-System einen VPN-Tunnel so einrichten, dass der eine Benutzer durch den Tunnel kommuniziert, der andere aber nicht. Nur eben habe ich keine Ahnung, wie ich das anstellen soll :-)

Ich habe einen raspberry pi mit raspbian auf Basis von debian Stretch mit lxde Desktop und verwende ein VPN eines kommerziellen Anbieters mittels

Code: Alles auswählen

sudo openvpn CONFIGDATEI.ovpn
im Terminal. Die config Datei sieht etwa so aus:

Code: Alles auswählen

client
dev tun
proto tcp
remote GESCHWÄRZTE IP 443
resolv-retry infinite
remote-random
nobind
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
persist-key
persist-tun
ping 15
ping-restart 0
ping-timer-rem
reneg-sec 0

remote-cert-tls server

#mute 10000
auth-user-pass

comp-lzo
verb 3
pull
fast-io
cipher AES-256-CBC
auth SHA512

<ca>
-----BEGIN CERTIFICATE-----

GESCHWÄRZTES ZERTIFIKAT
-----END CERTIFICATE-----
</ca>
key-direction 1
<tls-auth>
#
# 2048 bit OpenVPN static key
#
-----BEGIN OpenVPN Static key V1-----

GESCHWÄRZTER SCHLÜSSEL
-----END OpenVPN Static key V1-----
</tls-auth>
Die VPN-Verbindung funktioniert hervorragend, nur eben gibt es auf dem Raspberry Pi noch einen zweiten Benutzer, auf dem eine Nextcloud läuft. Der Benutzer meldet per Skript regelmäßig die IP an einen dynamic DNS Provider, damit ich von außen auf die Nextcloud zugreifen kann. Ohne VPN funktioniert die Nextcloud super, mit VPN meldet der Firefox

"Fehler: Gesicherte Verbindung fehlgeschlagen. Die Verbindung zu NEXTCLOUDADRESSE wurde unterbrochen, während die Seite geladen wurde."

Ich suche also eine Möglichkeit, dass der eine Benutzer sicher über das VPN kommunizieren kann, während auf dem anderen Benutzer die Nextcloud funktioniert.

Habt ihr da eine Idee?

Beste Grüße,
Offerus

mat6937
Beiträge: 2927
Registriert: 09.12.2014 10:44:00

Re: VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von mat6937 » 04.01.2018 22:09:53

Offerus hat geschrieben: ↑ zum Beitrag ↑
04.01.2018 22:01:08

Der Benutzer meldet per Skript regelmäßig die IP an einen dynamic DNS Provider, damit ich von außen auf die Nextcloud zugreifen kann.
Dann solltest Du das schon richtig beschreiben. Kann es sein, dass Du mit VPN eine andere default route (bzw. externe IP-Adresse) hast, und das melden/updaten der IP an den ddns-Provider nicht funktioniert und Du deshlab auf die Nextcloud (von wo?) nicht zugreifen kannst?

Offerus
Beiträge: 90
Registriert: 22.09.2012 13:04:29

Re: VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von Offerus » 04.01.2018 22:20:27

Das ist korrekt. Momentan meldet das Skript die IP des VPN-Servers an den ddns-Provider, wodurch die Kommunikation natürlich schwierig wird. Aber wenn ich versuche im Browser direkt über die IP meines Routers auf die Nextcloud zuzugreifen kommt einfach keine Rückmeldung.

Mir ist übrigens gerade aufgefallen, dass die IP nicht per Skript übermittelt wird, sondern dass es sich um eine Binärdatei handelt, in die ich nicht rein schauen kann :/

mat6937
Beiträge: 2927
Registriert: 09.12.2014 10:44:00

Re: VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von mat6937 » 04.01.2018 22:26:40

Offerus hat geschrieben: ↑ zum Beitrag ↑
04.01.2018 22:20:27
Aber wenn ich versuche im Browser direkt über die IP meines Routers auf die Nextcloud zuzugreifen kommt einfach keine Rückmeldung.
Wie sind in diesem Fall, auf deinem PI, die Ausgaben von:

Code: Alles auswählen

iptables -nvx -L -t nat
route -n
?

Offerus
Beiträge: 90
Registriert: 22.09.2012 13:04:29

Re: VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von Offerus » 04.01.2018 22:31:37

Code: Alles auswählen

USER@raspberrypi:/usr/local/bin $ sudo iptables -nvx -L -t nat
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination         

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination 
und

Code: Alles auswählen

USER@raspberrypi:/usr/local/bin $ sudo route -n
Kernel-IP-Routentabelle
Ziel            Router          Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.7.7.1        128.0.0.0       UG    0      0        0 tun0
0.0.0.0         192.168.1.1     0.0.0.0         UG    202    0        0 eth0
10.7.7.0        0.0.0.0         255.255.255.0   U     0      0        0 tun0
88.237.184.236  192.168.1.1     255.255.255.255 UGH   0      0        0 eth0
128.0.0.0       10.7.7.1        128.0.0.0       UG    0      0        0 tun0
192.168.1.0     0.0.0.0         255.255.255.0   U     202    0        0 eth0


mat6937
Beiträge: 2927
Registriert: 09.12.2014 10:44:00

Re: VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von mat6937 » 04.01.2018 22:35:57

Offerus hat geschrieben: ↑ zum Beitrag ↑
04.01.2018 22:31:37

Code: Alles auswählen

Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination 
und

Code: Alles auswählen

USER@raspberrypi:/usr/local/bin $ sudo route -n
Kernel-IP-Routentabelle
Ziel            Router          Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.7.7.1        128.0.0.0       UG    0      0        0 tun0
0.0.0.0         192.168.1.1     0.0.0.0         UG    202    0        0 eth0
Konfiguriere mal eine Source-NAT (masquerading) Regel für die Pakete die über das eth0-Interface kommen, damit die Antworten nicht durch den VPN-Tunnel (tun0-Interface und bessere metric) gehen wollen.

Evtl. auch für das tun0-Interface eine geeignete Source-NAT-Regel konfigurieren.

Offerus
Beiträge: 90
Registriert: 22.09.2012 13:04:29

Re: VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von Offerus » 04.01.2018 22:38:40

Oh da weiß ich nicht, wie das geht. Hab mich mit Netzwerk nie so beschäftigt :( Kannst du mir sagen wie man das macht, oder hast du einen Link?

mat6937
Beiträge: 2927
Registriert: 09.12.2014 10:44:00

Re: VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von mat6937 » 04.01.2018 22:47:25

Offerus hat geschrieben: ↑ zum Beitrag ↑
04.01.2018 22:38:40
Oh da weiß ich nicht, wie das geht. ...
Versuch mal:

Code: Alles auswählen

iptables -t nat -I POSTROUTING 1 -o tun+ -j MASQUERADE
iptables -t nat -I POSTROUTING 2 -o eth0 -j MASQUERADE
Starte mal auf dem PI:

Code: Alles auswählen

tcpdump -c 40 -vvveni eth0 tcp port <lauschender-Port-Nextcloud>
(ohne spitze Klammern und mit dem richtigen Port) und schau ob deine Anfrage ankommt und von wo.

Offerus
Beiträge: 90
Registriert: 22.09.2012 13:04:29

Re: VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von Offerus » 04.01.2018 22:56:59

Hab ich so umgesetzt, aber es gibt mit https://meineip/nextcloud immer noch einen Timeout. Muss ich den Server neu starten?

mat6937
Beiträge: 2927
Registriert: 09.12.2014 10:44:00

Re: VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von mat6937 » 04.01.2018 23:01:09

Offerus hat geschrieben: ↑ zum Beitrag ↑
04.01.2018 22:56:59
Hab ich so umgesetzt, aber es gibt mit https://meineip/nextcloud immer noch einen Timeout.
Wie ist die Ausgabe von tcpdump?

Offerus
Beiträge: 90
Registriert: 22.09.2012 13:04:29

Re: VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von Offerus » 04.01.2018 23:04:03

tcpdump liefert einen endlosen Stream von

Code: Alles auswählen

23:03:14.095821 IP raspberrypi.ssh > unknown7e497942f57d.47654: Flags [.], seq 927596:929044, ack 505, win 312, options [nop,nop,TS val 26527204 ecr 803678553], length 1448
23:03:14.095983 IP unknown7e497942f57d.47654 > raspberrypi.ssh: Flags [.], ack 835668, win 2786, options [nop,nop,TS val 803678557 ecr 26527170], length 0
23:03:14.096155 IP raspberrypi.ssh > unknown7e497942f57d.47654: Flags [.], seq 929044:930492, ack 505, win 312, options [nop,nop,TS val 26527204 ecr 803678557], length 1448
23:03:14.095985 IP unknown7e497942f57d.47654 > raspberrypi.ssh: Flags [.], ack 840784, win 2786, options [nop,nop,TS val 803678557 ecr 26527170], length 0
23:03:14.095994 IP unknown7e497942f57d.47654 > raspberrypi.ssh: Flags [.], ack 842244, win 2786, options [nop,nop,TS val 803678557 ecr 26527171], length 0
23:03:14.095995 IP unknown7e497942f57d.47654 > raspberrypi.ssh: Flags [.], ack 844136, win 2786, options [nop,nop,TS val 803678557 ecr 26527171], length 0
23:03:14.095998 IP unknown7e497942f57d.47654 > raspberrypi.ssh: Flags [.], ack 844736, win 2786, options [nop,nop,TS val 803678557 ecr 26527172], length 0
23:03:14.095999 IP unknown7e497942f57d.47654 > raspberrypi.ssh: Flags [.], ack 848252, win 2786, options [nop,nop,TS val 803678557 ecr 26527172], length 0
23:03:14.096000 IP unknown7e497942f57d.47654 > raspberrypi.ssh: Flags [.], ack 852052, win 2786, options [nop,nop,TS val 803678558 ecr 26527172], length 0
23:03:14.096002 IP unknown7e497942f57d.37670 > raspberrypi.ssh: Flags [P.], seq 121:165, ack 19408, win 3021, options [nop,nop,TS val 803678558 ecr 26527181], length 44
23:03:14.097348 IP raspberrypi.ssh > unknown7e497942f57d.37670: Flags [.], ack 165, win 1332, options [nop,nop,TS val 26527204 ecr 803678558], length 0
23:03:14.096003 IP unknown7e497942f57d.47654 > raspberrypi.ssh: Flags [.], ack 853748, win 2786, options [nop,nop,TS val 803678566 ecr 26527172], length 0
23:03:14.096004 IP unknown7e497942f57d.47654 > raspberrypi.ssh: Flags [.], ack 859376, win 2786, options [nop,nop,TS val 803678566 ecr 26527172], length 0
23:03:14.096009 IP unknown7e497942f57d.47654 > raspberrypi.ssh: Flags [.], ack 862072, win 2786, options [nop,nop,TS val 803678571 ecr 26527173], length 0
23:03:14.096009 IP unknown7e497942f57d.47654 > raspberrypi.ssh: Flags [.], ack 867356, win 2786, options [nop,nop,TS val 803678572 ecr 26527173], length 0
23:03:14.098096 IP raspberrypi.ssh > unknown7e497942f57d.47654: Flags [.], seq 930492:931940, ack 505, win 312, options [nop,nop,TS val 26527205 ecr 803678572], length 1448
23:03:14.098323 IP 88.237.184.236.https > raspberrypi.40026: Flags [.], ack 1667521, win 52880, options [nop,nop,TS val 918069743 ecr 26527200], length 0
23:03:14.098376 IP raspberrypi.ssh > unknown7e497942f57d.47654: Flags [.], seq 931940:933388, ack 505, win 312, options [nop,nop,TS val 26527205 ecr 803678572], length 1448
23:03:14.098520 IP raspberrypi.40026 > 88.237.184.236.https: Flags [.], seq 1700641:1702081, ack 82427, win 40598, options [nop,nop,TS val 26527205 ecr 918069743], length 1440
23:03:14.098637 IP raspberrypi.40026 > 88.237.184.236.https: Flags [.], seq 1702081:1703521, ack 82427, win 40598, options [nop,nop,TS val 26527205 ecr 918069743], length 1440
23:03:14.098763 IP raspberrypi.ssh > unknown7e497942f57d.47654: Flags [.], seq 933388:934836, ack 505, win 312, options [nop,nop,TS val 26527205 ecr 803678572], length 1448
23:03:14.098913 IP raspberrypi.ssh > unknown7e497942f57d.47654: Flags [.], seq 934836:936284, ack 505, win 312, options [nop,nop,TS val 26527205 ecr 803678572], length 1448
23:03:14.099038 IP raspberrypi.ssh > unknown7e497942f57d.47654: Flags [.], seq 936284:937732, ack 505, win 312, options [nop,nop,TS val 26527205 ecr 803678572], length 1448
23:03:14.099189 IP raspberrypi.ssh > unknown7e497942f57d.47654: Flags [.], seq 937732:939180, ack 505, win 312, options [nop,nop,TS val 26527205 ecr 803678572], length 1448
...

mat6937
Beiträge: 2927
Registriert: 09.12.2014 10:44:00

Re: VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von mat6937 » 04.01.2018 23:05:51

Offerus hat geschrieben: ↑ zum Beitrag ↑
04.01.2018 23:04:03
tcpdump liefert einen endlosen Stream von
Hast Du den richtigen Filter gesetzt? ... so wie ich weiter oben empfohlen habe.

Offerus
Beiträge: 90
Registriert: 22.09.2012 13:04:29

Re: VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von Offerus » 05.01.2018 09:11:13

Ah, stimmt, hab ich vergessen. Hier die Ausgabe während ich versuche die Nextcloud zu erreichen:

Code: Alles auswählen

sudo tcpdump -c 40 -vvveni eth0 tcp port 443
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
09:06:36.078111 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 1400: (tos 0x0, ttl 54, id 4009, offset 0, flags [DF], proto TCP (6), length 1386)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [P.], cksum 0xd2a7 (correct), seq 4247251705:4247253039, ack 3823163299, win 52880, options [nop,nop,TS val 927120240 ecr 30147400], length 1334
09:06:36.078503 b8:27:eb:27:27:ee > a0:e4:cb:d8:20:bc, ethertype IPv4 (0x0800), length 145: (tos 0x0, ttl 64, id 22114, offset 0, flags [DF], proto TCP (6), length 131)
    192.168.1.4.42162 > 88.237.184.236.443: Flags [P.], cksum 0xd5fe (incorrect -> 0xbcbf), seq 1:80, ack 1334, win 40576, options [nop,nop,TS val 30147403 ecr 927120240], length 79
09:06:36.108097 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 951: (tos 0x0, ttl 54, id 4010, offset 0, flags [DF], proto TCP (6), length 937)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [P.], cksum 0xe2f9 (correct), seq 1334:2219, ack 80, win 52883, options [nop,nop,TS val 927120247 ecr 30147403], length 885
09:06:36.110835 b8:27:eb:27:27:ee > a0:e4:cb:d8:20:bc, ethertype IPv4 (0x0800), length 145: (tos 0x0, ttl 64, id 22115, offset 0, flags [DF], proto TCP (6), length 131)
    192.168.1.4.42162 > 88.237.184.236.443: Flags [P.], cksum 0xd5fe (incorrect -> 0xd122), seq 80:159, ack 2219, win 40576, options [nop,nop,TS val 30147406 ecr 927120247], length 79
09:06:36.112338 b8:27:eb:27:27:ee > a0:e4:cb:d8:20:bc, ethertype IPv4 (0x0800), length 1506: (tos 0x0, ttl 64, id 22116, offset 0, flags [DF], proto TCP (6), length 1492)
    192.168.1.4.42162 > 88.237.184.236.443: Flags [.], cksum 0xdb4f (incorrect -> 0x5648), seq 159:1599, ack 2219, win 40598, options [nop,nop,TS val 30147406 ecr 927120247], length 1440
09:06:36.112858 b8:27:eb:27:27:ee > a0:e4:cb:d8:20:bc, ethertype IPv4 (0x0800), length 1506: (tos 0x0, ttl 64, id 22117, offset 0, flags [DF], proto TCP (6), length 1492)
    192.168.1.4.42162 > 88.237.184.236.443: Flags [.], cksum 0xdb4f (incorrect -> 0xc390), seq 1599:3039, ack 2219, win 40598, options [nop,nop,TS val 30147406 ecr 927120247], length 1440
09:06:36.143154 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 54, id 4011, offset 0, flags [DF], proto TCP (6), length 52)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [.], cksum 0x81c6 (correct), seq 2219, ack 1599, win 52883, options [nop,nop,TS val 927120256 ecr 30147406], length 0
09:06:36.143560 b8:27:eb:27:27:ee > a0:e4:cb:d8:20:bc, ethertype IPv4 (0x0800), length 179: (tos 0x0, ttl 64, id 22118, offset 0, flags [DF], proto TCP (6), length 165)
    192.168.1.4.42162 > 88.237.184.236.443: Flags [P.], cksum 0xd620 (incorrect -> 0x58c4), seq 3039:3152, ack 2219, win 40598, options [nop,nop,TS val 30147409 ecr 927120256], length 113
09:06:36.173108 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 54, id 4012, offset 0, flags [DF], proto TCP (6), length 52)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [.], cksum 0x7bad (correct), seq 2219, ack 3152, win 52883, options [nop,nop,TS val 927120264 ecr 30147406], length 0
09:06:36.187658 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 1453: (tos 0x0, ttl 54, id 4013, offset 0, flags [DF], proto TCP (6), length 1439)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [P.], cksum 0xa0a1 (correct), seq 2219:3606, ack 3152, win 52883, options [nop,nop,TS val 927120267 ecr 30147406], length 1387
09:06:36.189134 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 1506: (tos 0x0, ttl 54, id 4014, offset 0, flags [DF], proto TCP (6), length 1492)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [.], cksum 0xd560 (correct), seq 3606:5046, ack 3152, win 52883, options [nop,nop,TS val 927120267 ecr 30147406], length 1440
09:06:36.189135 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 1506: (tos 0x0, ttl 54, id 4015, offset 0, flags [DF], proto TCP (6), length 1492)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [.], cksum 0x3cd1 (correct), seq 5046:6486, ack 3152, win 52883, options [nop,nop,TS val 927120267 ecr 30147406], length 1440
09:06:36.189137 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 1506: (tos 0x0, ttl 54, id 4016, offset 0, flags [DF], proto TCP (6), length 1492)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [.], cksum 0x0c4a (correct), seq 6486:7926, ack 3152, win 52883, options [nop,nop,TS val 927120267 ecr 30147406], length 1440
09:06:36.189141 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 1506: (tos 0x0, ttl 54, id 4017, offset 0, flags [DF], proto TCP (6), length 1492)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [.], cksum 0x2aaa (correct), seq 7926:9366, ack 3152, win 52883, options [nop,nop,TS val 927120267 ecr 30147406], length 1440
09:06:36.189142 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 1506: (tos 0x0, ttl 54, id 4018, offset 0, flags [DF], proto TCP (6), length 1492)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [.], cksum 0xefd5 (correct), seq 9366:10806, ack 3152, win 52883, options [nop,nop,TS val 927120267 ecr 30147406], length 1440
09:06:36.189143 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 1506: (tos 0x0, ttl 54, id 4019, offset 0, flags [DF], proto TCP (6), length 1492)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [.], cksum 0x5ced (correct), seq 10806:12246, ack 3152, win 52883, options [nop,nop,TS val 927120267 ecr 30147406], length 1440
09:06:36.189144 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 1506: (tos 0x0, ttl 54, id 4020, offset 0, flags [DF], proto TCP (6), length 1492)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [.], cksum 0x10ce (correct), seq 12246:13686, ack 3152, win 52883, options [nop,nop,TS val 927120267 ecr 30147406], length 1440
09:06:36.219670 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 1029: (tos 0x0, ttl 54, id 4022, offset 0, flags [DF], proto TCP (6), length 1015)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [P.], cksum 0xad2d (correct), seq 15126:16089, ack 3152, win 52883, options [nop,nop,TS val 927120275 ecr 30147414], length 963
09:06:36.222098 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 1506: (tos 0x0, ttl 54, id 4023, offset 0, flags [DF], proto TCP (6), length 1492)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [.], cksum 0x70b4 (correct), seq 16089:17529, ack 3231, win 52883, options [nop,nop,TS val 927120276 ecr 30147414], length 1440
09:06:36.222325 b8:27:eb:27:27:ee > a0:e4:cb:d8:20:bc, ethertype IPv4 (0x0800), length 777: (tos 0x0, ttl 64, id 22121, offset 0, flags [DF], proto TCP (6), length 763)
    192.168.1.4.42162 > 88.237.184.236.443: Flags [P.], cksum 0xd876 (incorrect -> 0xaeb6), seq 3231:3942, ack 17529, win 40576, options [nop,nop,TS val 30147417 ecr 927120275], length 711
09:06:36.227272 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 1506: (tos 0x0, ttl 54, id 4024, offset 0, flags [DF], proto TCP (6), length 1492)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [.], cksum 0xf911 (correct), seq 17529:18969, ack 3231, win 52883, options [nop,nop,TS val 927120277 ecr 30147414], length 1440
09:06:36.228239 b8:27:eb:27:27:ee > a0:e4:cb:d8:20:bc, ethertype IPv4 (0x0800), length 1506: (tos 0x0, ttl 64, id 22122, offset 0, flags [DF], proto TCP (6), length 1492)
    192.168.1.4.42162 > 88.237.184.236.443: Flags [.], cksum 0xdb4f (incorrect -> 0x9be5), seq 3942:5382, ack 18969, win 40598, options [nop,nop,TS val 30147418 ecr 927120277], length 1440
09:06:36.228589 b8:27:eb:27:27:ee > a0:e4:cb:d8:20:bc, ethertype IPv4 (0x0800), length 1506: (tos 0x0, ttl 64, id 22123, offset 0, flags [DF], proto TCP (6), length 1492)
    192.168.1.4.42162 > 88.237.184.236.443: Flags [.], cksum 0xdb4f (incorrect -> 0x9063), seq 5382:6822, ack 18969, win 40598, options [nop,nop,TS val 30147418 ecr 927120277], length 1440
09:06:36.251930 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 176: (tos 0x0, ttl 54, id 4025, offset 0, flags [DF], proto TCP (6), length 162)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [P.], cksum 0xff53 (correct), seq 18969:19079, ack 3942, win 52880, options [nop,nop,TS val 927120283 ecr 30147417], length 110
09:06:36.252183 b8:27:eb:27:27:ee > a0:e4:cb:d8:20:bc, ethertype IPv4 (0x0800), length 258: (tos 0x0, ttl 64, id 22124, offset 0, flags [DF], proto TCP (6), length 244)
    192.168.1.4.42162 > 88.237.184.236.443: Flags [P.], cksum 0xd66f (incorrect -> 0x15d0), seq 6822:7014, ack 19079, win 40576, options [nop,nop,TS val 30147420 ecr 927120283], length 192
09:06:36.253917 b8:27:eb:27:27:ee > a0:e4:cb:d8:20:bc, ethertype IPv4 (0x0800), length 1506: (tos 0x0, ttl 64, id 22125, offset 0, flags [DF], proto TCP (6), length 1492)
    192.168.1.4.42162 > 88.237.184.236.443: Flags [.], cksum 0xdb4f (incorrect -> 0x690e), seq 7014:8454, ack 19079, win 40598, options [nop,nop,TS val 30147420 ecr 927120283], length 1440
09:06:36.254231 b8:27:eb:27:27:ee > a0:e4:cb:d8:20:bc, ethertype IPv4 (0x0800), length 1506: (tos 0x0, ttl 64, id 22126, offset 0, flags [DF], proto TCP (6), length 1492)
    192.168.1.4.42162 > 88.237.184.236.443: Flags [.], cksum 0xdb4f (incorrect -> 0x33a0), seq 8454:9894, ack 19079, win 40598, options [nop,nop,TS val 30147420 ecr 927120283], length 1440
09:06:36.254511 b8:27:eb:27:27:ee > a0:e4:cb:d8:20:bc, ethertype IPv4 (0x0800), length 1506: (tos 0x0, ttl 64, id 22127, offset 0, flags [DF], proto TCP (6), length 1492)
    192.168.1.4.42162 > 88.237.184.236.443: Flags [.], cksum 0xdb4f (incorrect -> 0x0227), seq 9894:11334, ack 19079, win 40598, options [nop,nop,TS val 30147420 ecr 927120283], length 1440
09:06:36.254778 b8:27:eb:27:27:ee > a0:e4:cb:d8:20:bc, ethertype IPv4 (0x0800), length 1506: (tos 0x0, ttl 64, id 22128, offset 0, flags [DF], proto TCP (6), length 1492)
    192.168.1.4.42162 > 88.237.184.236.443: Flags [.], cksum 0xdb4f (incorrect -> 0xf5bc), seq 11334:12774, ack 19079, win 40598, options [nop,nop,TS val 30147420 ecr 927120283], length 1440
09:06:36.255048 b8:27:eb:27:27:ee > a0:e4:cb:d8:20:bc, ethertype IPv4 (0x0800), length 1506: (tos 0x0, ttl 64, id 22129, offset 0, flags [DF], proto TCP (6), length 1492)
    192.168.1.4.42162 > 88.237.184.236.443: Flags [.], cksum 0xdb4f (incorrect -> 0xab5e), seq 12774:14214, ack 19079, win 40598, options [nop,nop,TS val 30147420 ecr 927120283], length 1440
09:06:36.259913 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 54, id 4026, offset 0, flags [DF], proto TCP (6), length 52)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [.], cksum 0x2b5d (correct), seq 19079, ack 6822, win 52880, options [nop,nop,TS val 927120285 ecr 30147418], length 0
09:06:36.282028 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 879: (tos 0x0, ttl 54, id 4027, offset 0, flags [DF], proto TCP (6), length 865)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [P.], cksum 0xac70 (correct), seq 19079:19892, ack 7014, win 52880, options [nop,nop,TS val 927120291 ecr 30147420], length 813
09:06:36.282301 b8:27:eb:27:27:ee > a0:e4:cb:d8:20:bc, ethertype IPv4 (0x0800), length 151: (tos 0x0, ttl 64, id 22130, offset 0, flags [DF], proto TCP (6), length 137)
    192.168.1.4.42162 > 88.237.184.236.443: Flags [P.], cksum 0xd604 (incorrect -> 0x576a), seq 14214:14299, ack 19892, win 40576, options [nop,nop,TS val 30147423 ecr 927120291], length 85
09:06:36.285497 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 54, id 4028, offset 0, flags [DF], proto TCP (6), length 52)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [.], cksum 0x1c27 (correct), seq 19892, ack 9894, win 52880, options [nop,nop,TS val 927120292 ecr 30147420], length 0
09:06:36.287867 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 54, id 4029, offset 0, flags [DF], proto TCP (6), length 52)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [.], cksum 0x10e7 (correct), seq 19892, ack 12774, win 52880, options [nop,nop,TS val 927120292 ecr 30147420], length 0
09:06:36.311494 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 54, id 4030, offset 0, flags [DF], proto TCP (6), length 52)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [.], cksum 0x0ae9 (correct), seq 19892, ack 14299, win 52883, options [nop,nop,TS val 927120298 ecr 30147420], length 0
09:06:36.311717 b8:27:eb:27:27:ee > a0:e4:cb:d8:20:bc, ethertype IPv4 (0x0800), length 145: (tos 0x0, ttl 64, id 22131, offset 0, flags [DF], proto TCP (6), length 131)
    192.168.1.4.42162 > 88.237.184.236.443: Flags [P.], cksum 0xd5fe (incorrect -> 0x157d), seq 14299:14378, ack 19892, win 40598, options [nop,nop,TS val 30147426 ecr 927120298], length 79
09:06:36.384697 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 54, id 4031, offset 0, flags [DF], proto TCP (6), length 52)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [.], cksum 0x0a81 (correct), seq 19892, ack 14378, win 52883, options [nop,nop,TS val 927120317 ecr 30147426], length 0
09:06:36.433918 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 138: (tos 0x0, ttl 54, id 4032, offset 0, flags [DF], proto TCP (6), length 124)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [P.], cksum 0x7d2d (correct), seq 19892:19964, ack 14378, win 52883, options [nop,nop,TS val 927120329 ecr 30147426], length 72
09:06:36.434826 b8:27:eb:27:27:ee > a0:e4:cb:d8:20:bc, ethertype IPv4 (0x0800), length 1506: (tos 0x0, ttl 64, id 22132, offset 0, flags [DF], proto TCP (6), length 1492)
    192.168.1.4.42162 > 88.237.184.236.443: Flags [.], cksum 0xdb4f (incorrect -> 0xf5fe), seq 14378:15818, ack 19964, win 40598, options [nop,nop,TS val 30147438 ecr 927120329], length 1440
40 packets captured
46 packets received by filter
3 packets dropped by kernel


mat6937
Beiträge: 2927
Registriert: 09.12.2014 10:44:00

Re: VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von mat6937 » 05.01.2018 09:30:28

Offerus hat geschrieben: ↑ zum Beitrag ↑
05.01.2018 09:11:13

Code: Alles auswählen

sudo tcpdump -c 40 -vvveni eth0 tcp port 443
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
09:06:36.078111 a0:e4:cb:d8:20:bc > b8:27:eb:27:27:ee, ethertype IPv4 (0x0800), length 1400: (tos 0x0, ttl 54, id 4009, offset 0, flags [DF], proto TCP (6), length 1386)
    88.237.184.236.443 > 192.168.1.4.42162: Flags [P.], cksum 0xd2a7 (correct), seq 4247251705:4247253039, ack 3823163299, win 52880, options [nop,nop,TS val 927120240 ecr 30147400], length 1334
    
09:06:36.078503 b8:27:eb:27:27:ee > a0:e4:cb:d8:20:bc, ethertype IPv4 (0x0800), length 145: (tos 0x0, ttl 64, id 22114, offset 0, flags [DF], proto TCP (6), length 131)
    192.168.1.4.42162 > 88.237.184.236.443: Flags [P.], cksum 0xd5fe (incorrect -> 0xbcbf), seq 1:80, ack 1334, win 40576, options [nop,nop,TS val 30147403 ecr 927120240], length 79
Es wäre schön gewesen wenn Du tcpdump schon vor dem Zugriff gestartet hättest, damit man auch den Traffic mit den syn- und syn+ack-Flags sieht, aber egal man sieht auch so den Traffic durch das eth0-Interface in beide Richtungen.

Wo befindet sich z. Zt. das Gerät, von dem aus Du dich mit dem Server verbindest?

Offerus
Beiträge: 90
Registriert: 22.09.2012 13:04:29

Re: VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von Offerus » 05.01.2018 14:47:34

Der Raspberry Pi befindet sich im gleichen lokalen Netzwerk wie der PC von dem ich versuche darauf zuzugreifen (im regulären Betrieb greife ich auch mit dem Handy und von anderen Standorten darauf zu). Wenn ich mittels

Code: Alles auswählen

https://192.168.1.4/nextcloud
zugreife, funktioniert es (er möppert nur über ein unbekanntes Zertifikat). Mit

Code: Alles auswählen

https://MeineHeimIP/nextcloud
nicht.

mat6937
Beiträge: 2927
Registriert: 09.12.2014 10:44:00

Re: VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von mat6937 » 05.01.2018 14:55:10

Offerus hat geschrieben: ↑ zum Beitrag ↑
05.01.2018 14:47:34
Der Raspberry Pi befindet sich im gleichen lokalen Netzwerk wie der PC von dem ich versuche darauf zuzugreifen ... Mit

Code: Alles auswählen

https://MeineHeimIP/nextcloud
nicht.
Was meinst Du mit "MeineHeimIP"? Soll das auf deine externe/öffentliche IPv4-Adresse auflösen?

Hat das bei dir jemals funktioniert? Denn das geht aus dem lokalen Netzwerk mit der externen/öffentlichen IP-Adresse nur dann, wenn der Router "NAT-Loopback" (auch Hairpinning genannt) kann.

Welches OS hat dein Client? Denn wie bereits geschrieben, auf dem PI ist mit tcpdump eine Rückantwort durch das eth0-Interface zu sehen. Evtl. erwartet der Client, eine Antwort von einer anderen IP-Adresse und verwirft deshalb die Antwort. Das könnte man evtl. mit tcpdump (oder gleichwertig, je nach OS) auf dem Client feststellen/sehen.

EDIT:

Wie sind auf deinem jetzt benutzten Client, die Ausgaben von:

Code: Alles auswählen

route -n
iptables -nvx -L -t nat
(oder gleichwertig, je nach OS)?

Offerus
Beiträge: 90
Registriert: 22.09.2012 13:04:29

Re: VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von Offerus » 05.01.2018 22:50:49

Genau mit "MeineHeimIP" meine ich meine öffentliche IPv4-Adresse. Wo du es so sagst, weiß ich gar nicht, ob ich damit schon mal auf die Nextcloud zugreifen konnte, ich bin davon ausgegangen, dass das funktionieren müsste. Jedenfalls habe ich gerade meine öffentliche IP-Adresse per Hand beim ddns-Provider eingegeben und bei laufendem VPN auf dem Raspberry PI versucht über die URL und nicht über die IP auf die Nextcloud zuzugreifen. Da kommt dann auch ein Timeout.

Auf dem Client läuft debian testing/buster. Auf dem Client-PC:

Code: Alles auswählen

root@PC:~# route -n
Kernel-IP-Routentabelle
Ziel            Router          Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    600    0        0 wlp4s0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlp4s0
192.168.1.0     0.0.0.0         255.255.255.0   U     600    0        0 wlp4s0
und

Code: Alles auswählen

root@PC:~# iptables -nvx -L -t nat
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination         

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination  

mat6937
Beiträge: 2927
Registriert: 09.12.2014 10:44:00

Re: VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von mat6937 » 06.01.2018 09:47:36

Offerus hat geschrieben: ↑ zum Beitrag ↑
05.01.2018 22:50:49
... meine öffentliche IPv4-Adresse. Wo du es so sagst, weiß ich gar nicht, ob ich damit schon mal auf die Nextcloud zugreifen konnte, ich bin davon ausgegangen, dass das funktionieren müsste. Jedenfalls habe ich gerade meine öffentliche IP-Adresse per Hand beim ddns-Provider eingegeben und bei laufendem VPN auf dem Raspberry PI versucht über die URL und nicht über die IP auf die Nextcloud zuzugreifen. Da kommt dann auch ein Timeout.
Wie ich bereits geschrieben habe, das mit der öffentlichen IP und aus dem eigenen Subnetz funktioniert nur dann, wenn der Router NAT-Loopback (Hairpinning) kann. Z. B. die FritzBox kann das, der Speedport kann das nicht.
Welchen Router hast Du in deinem Subnetz (... evtl. ist die Frage hier im Thread schon gestellt bzw. beantwortet worden), da wo sich die Nextcloud befindet?

Offerus
Beiträge: 90
Registriert: 22.09.2012 13:04:29

Re: VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von Offerus » 06.01.2018 11:55:56

o2 HomeBox 6641 (Zyxel)
Firmware Version: 1.00(AAJG.0)D14b

Im Handbuch steht nur:

Routing/Bridging
• NAT/NATP
• PPPoE nach RFC 2516
• Internet Control Message Protocol
• PPP Internet Protocol Control Protocol (IPCP)
• IPv4 und IPv6 dual stack

Ich überlege gerade, ob der von tcpdump angezeigte Traffic durch das eth0-Interface mit Port 443 dadurch zustande kommt, dass ich den Befehl per ssh und der lokalen IP 192.168.1.X auf dem Raspberry Pi ausgeführt habe.

mat6937
Beiträge: 2927
Registriert: 09.12.2014 10:44:00

Re: VPN-Tunnel für nur einen Benutzer einrichten

Beitrag von mat6937 » 06.01.2018 12:34:41

Offerus hat geschrieben: ↑ zum Beitrag ↑
06.01.2018 11:55:56
o2 HomeBox 6641 (Zyxel)
Naja, in den Handbücher habe ich so einen Eintrag (betr. NAT-Loopback, ... auch bei der FB nicht), noch nicht gesehen/gelesen.

Aber gehen wir mal davon aus, dass die O2-HomeBox das nicht kann.

Antworten