Netzwerk hinter dem OpenVPN-Client

Netzwerk hinter dem OpenVPN-Client

Guten Tag, ich habe ein Problem mit dem OpenVPN-Netzwerk. Die Grundidee ist wie dargestellt: Remote-OpenVPN-Server, 2 Clients, MyPC und OpenWRT-Client mit eigenem Netzwerk mit Client_1 und Client_2. Ich muss Client_1 von MyPC aus erreichen können und umgekehrt. Es sieht nach einem Routing- oder Weiterleitungsproblem aus.


|-----------------------|           |-----------------------------------|
|Ubuntu 14.04           |           |OpenWRT router                     |
|OpenVPN Server         |  <----->  |Acts as OpenVPN client             |
|WAN 192.168.1.197      |           |LAN: 192.168.0.1, WAN:192.168.1.1  |
|OpenVPN IP: 172.20.2.1 |           |OpenVPN IP:172.20.1.100            |
|-----------------------|           |-----------------------------------|
            ^                               ^                   ^
            |                               |                   |
            |                               |                   |
            v                               v                   v
|-----------------------|           |-------------------| |------------------|
|MyPC, OpenVPN client   |   (1)     |Network client_1   | |Network client_2  |
|LAN: 192.168.1.205     | <-------> |LAN: 192.168.0.213 | |LAN: 192.168.1.101|
|OpenVPN IP:172.20.2.101|           |-------------------| |------------------|
|-----------------------|

Das Ping-Ergebnis

Ping MyPC -> OpenVPN-Server OK
Ping MeinPC -> OpenWRT OK
Ping MyPC -> client_1 Antwort von 192.168.1.205: Zielhost nicht erreichbar.

Ping OpenVPN-Server -> MyPC OK
Ping OpenVPN-Server -> OpenWRT OK
Ping OpenVPN-Server -> Client_1 Von 192.168.1.197 icmp_seq=1 Zielhost nicht erreichbar

Ping OpenWRT -> OpenVPN-Server OK
Ping OpenWRT -> MeinPC OK
Ping OpenWRT -> client_1 OK

Ping client_1 -> OpenVPN-Server von 192.168.0.1 icmp_seq=1 Zielport nicht erreichbar
Ping client_1 -> MyPC Von 192.168.0.1 icmp_seq=1 Zielport nicht erreichbar
Ping client_1 -> OpenWRT OK

OpenVPN-Konfigurationen, Server und Clients

======OpenVPN configuration ===================================================================
port 1198
proto udp
dev tap2
ca keys/remote_management/ca.crt
cert keys/remote_management/remote_man.crt
key keys/remote_management/remote_man.key
dh keys/remote_management/dh4096.pem
server-bridge 172.20.2.1 255.255.255.0 172.20.2.100 172.20.2.253 #@@ br1 eth2
crl-verify keys/remote_management/crl.pem
ifconfig-pool-persist servers/remote_man/logs/ipp.txt
tls-auth servers/remote_man/ta.key 0
cipher AES-128-CBC
user nobody
group nogroup
status servers/remote_man/logs/openvpn-status.log
log-append servers/remote_man/logs/openvpn.log
verb 2
mute 20
max-clients 10
management 127.0.0.1 7507
keepalive 10 120
client-config-dir /etc/openvpn/servers/remote_man/ccd
tls-server
client-to-client
comp-lzo
persist-key
persist-tun
ccd-exclusive
push "route 172.20.2.0 255.255.255.0"
route 192.168.0.0 255.255.255.0

======OpenVPN client MyPC configuration ======================================================
client
proto udp
dev tap
ca ca.crt
dh dh4096.pem
cert ***.crt
key ***.key
remote *** 1198
tls-auth ta.key 1
cipher AES-128-CBC
verb 2
mute 20
keepalive 10 120
comp-lzo
persist-key
persist-tun
float
resolv-retry infinite
nobind

======OpenVPN client OpenWRT configuration ===================================================
client
proto udp
dev tap
ca /etc/openvpn/sol102/ca.crt
dh /etc/openvpn/sol102/dh4096.pem
cert /etc/openvpn/sol102/sol102.crt
key /etc/openvpn/sol102/sol102.key
remote *** 1198
tls-auth /etc/openvpn/sol102/ta.key 1
cipher AES-128-CBC
verb 2
mute 20
keepalive 10 120
comp-lzo
persist-key
persist-tun
float
resolv-retry infinite
nobind

OpenWRT-Konfigurationen

======OpenWRT-Netzwerkkonfiguration============================================================
Konfigurationsschnittstelle 'Loopback'
        Option ifname 'lo'
        Option Proto 'statisch'
        Option ipaddr '127.0.0.1'
        Option Netzmaske '255.0.0.0'

Konfigurationsglobale „Globale“
        Option ula_prefix 'fdf2:d4ae:ecd5::/48'

Konfigurationsschnittstelle 'LAN'
        Option ifname 'eth0.1'
        Option force_link '1'
        Optionstyp „Brücke“
        Option Proto 'statisch'
        Option Netzmaske '255.255.255.0'
        Option ip6assign '60'
        Option IP-Adresse '192.168.0.1'

Konfigurationsschnittstelle „WAN“
        Option ifname 'eth0.2'
        Option Protokoll 'DHCP'

Konfigurationsschnittstelle „wan6“
        Option ifname '@wan'
        Option Protokoll 'dhcpv6'

Konfigurationsschalter
        Optionsname „switch0“
        Option zurücksetzen '1'
        Option enable_vlan '1'

Konfiguration switch_vlan
        Optionsgerät „switch0“
        Option VLAN '1'
        Optionsanschlüsse '1 2 3 4 5t'

Konfiguration switch_vlan
        Optionsgerät „switch0“
        Option VLAN '2'
        optionale Anschlüsse '0 5t'

Konfigurationsschnittstelle „OVPN“
        Option Proto „keine“
        Option Delegat '0'
        Option ifname 'tap0'

======OpenWRT-Firewall-Konfiguration===========================================================
Konfigurationsvorgaben
        Option syn_flood '1'
        Optionseingabe 'ACCEPT'
        Option Ausgabe 'ACCEPT'
        Option vorwärts 'ABLEHNEN'

Konfigurationszone
        Optionsname „lan“
        Optionseingabe 'ACCEPT'
        Option Ausgabe 'ACCEPT'
        Option vorwärts 'ABLEHNEN'
        Option Netzwerk 'LAN'

Konfigurationszone
        Optionsname „wan“
        Optionseingabe 'ABLEHNEN'
        Option Ausgabe 'ACCEPT'
        Option vorwärts 'ABLEHNEN'
        Option masq '1'
        Option Netzwerk 'wan wan6'

Konfigurationsregel
        Optionsname „Allow-DHCP-Renew“
        Option src 'wan'
        Option Protokoll 'udp'
        Option Zielport '68'
        Optionsziel 'ACCEPT'
        Optionsfamilie „IPv4“

Konfigurationsregel
        Optionsname „Allow-Ping“
        Option src 'wan'
        Option Protokoll 'icmp'
        Option icmp_type 'Echo-Anforderung'
        Optionsfamilie „IPv4“
        Optionsziel 'ACCEPT'

Konfigurationsregel
        Optionsname „Allow-DHCPv6“
        Option src 'wan'
        Option Protokoll 'udp'
        Option src_ip 'fe80::/10'
        Option src_port '547'
        Option Ziel-IP 'fe80::/10'
        Option Zielport '546'
        Optionsfamilie „IPv6“
        Optionsziel 'ACCEPT'

Konfigurationsregel
        Optionsname „Allow-ICMPv6-Input“
        Option src 'wan'
        Option Protokoll 'icmp'
        Liste icmp_type 'Echo-Anforderung'
        Liste icmp_type 'echo-reply'
        Liste icmp_type 'Ziel nicht erreichbar'
        Liste icmp_type 'Paket zu groß'
        Liste ICMP_Typ „Zeit überschritten“
        Liste icmp_type 'bad-header'
        Liste icmp_type 'unbekannter Header-Typ'
        Liste ICMP_Typ „Router-Anfrage“
        Liste ICMP_Typ 'Nachbarschaftswerbung'
        Liste icmp_type 'Router-Werbung'
        Liste icmp_type 'Nachbarwerbung'
        Optionslimit „1000/Sek.“
        Optionsfamilie „IPv6“
        Optionsziel 'ACCEPT'

Konfigurationsregel
        Optionsname „Allow-ICMPv6-Forward“
        Option src 'wan'
        Option Ziel '*'
        Option Protokoll 'icmp'
        Liste icmp_type 'Echo-Anforderung'
        Liste icmp_type 'echo-reply'
        Liste icmp_type 'Ziel nicht erreichbar'
        Liste icmp_type 'Paket zu groß'
        Liste ICMP_Typ „Zeit überschritten“
        Liste icmp_type 'bad-header'
        Liste icmp_type 'unbekannter Header-Typ'
        Optionslimit „1000/Sek.“
        Optionsfamilie „IPv6“
        Optionsziel 'ACCEPT'

Konfigurations-Include
        Optionspfad „/etc/firewall.user“

Konfigurationszone
        Option Ausgabe 'ACCEPT'
        Optionsname „OVPN_FW“
        Option masq '1'
        Optionseingabe 'ACCEPT'
        Option vorwärts 'ABLEHNEN'
        Optionsnetzwerk „OVPN“
        Option mtu_fix '1'

Konfigurationsweiterleitung
        Option Ziel 'OVPN_FW'
        Option src 'lan'

Konfigurationsweiterleitung
        Option Ziel 'wan'
        Option src 'lan'

Konfigurationsweiterleitung
        Option Ziel 'lan'
        Option src 'OVPN_FW'

Ich habe einige tcpdump

======OpenVPN server tcpdump icmp filtered ====================================================  
12:46:11.654580 IP 172.20.2.101 > 192.168.0.213: ICMP echo request, id 1, seq 83, length 40
12:46:11.654580 IP 172.20.2.101 > 192.168.0.213: ICMP echo request, id 1, seq 83, length 40
12:46:14.652217 IP 172.20.2.1 > 172.20.2.101: ICMP host 192.168.0.213 unreachable, length 68
12:46:14.652244 IP 172.20.2.1 > 172.20.2.101: ICMP host 192.168.0.213 unreachable, length 68
12:46:14.657835 IP 172.20.2.101 > 192.168.0.213: ICMP echo request, id 1, seq 84, length 40
12:46:14.657835 IP 172.20.2.101 > 192.168.0.213: ICMP echo request, id 1, seq 84, length 40
12:46:17.656214 IP 172.20.2.1 > 172.20.2.101: ICMP host 192.168.0.213 unreachable, length 68
12:46:17.656241 IP 172.20.2.1 > 172.20.2.101: ICMP host 192.168.0.213 unreachable, length 68
12:46:17.661768 IP 172.20.2.101 > 192.168.0.213: ICMP echo request, id 1, seq 85, length 40
12:46:17.661768 IP 172.20.2.101 > 192.168.0.213: ICMP echo request, id 1, seq 85, length 40
12:46:20.660206 IP 172.20.2.1 > 172.20.2.101: ICMP host 192.168.0.213 unreachable, length 68
12:46:20.660233 IP 172.20.2.1 > 172.20.2.101: ICMP host 192.168.0.213 unreachable, length 68
12:46:20.665362 IP 172.20.2.101 > 192.168.0.213: ICMP echo request, id 1, seq 86, length 40
12:46:20.665362 IP 172.20.2.101 > 192.168.0.213: ICMP echo request, id 1, seq 86, length 40
12:46:23.666797 IP 172.20.2.1 > 172.20.2.101: ICMP host 192.168.0.213 unreachable, length 68
12:46:23.666824 IP 172.20.2.1 > 172.20.2.101: ICMP host 192.168.0.213 unreachable, length 68


======OpenWRT client tcpdump icmp filtered ==================================================== 
12:44:17.299404 IP 172.20.2.1 > 172.20.2.100: ICMP redirect 172.20.2.101 to host 172.20.2.101, length 48
12:44:18.461809 IP 172.20.2.1 > 172.20.2.100: ICMP redirect 172.20.2.101 to host 172.20.2.101, length 196
12:44:19.464258 IP 172.20.2.1 > 172.20.2.100: ICMP redirect 172.20.2.101 to host 172.20.2.101, length 196
12:44:20.466652 IP 172.20.2.1 > 172.20.2.100: ICMP redirect 172.20.2.101 to host 172.20.2.101, length 196
12:44:20.944332 IP 172.20.2.1 > 172.20.2.100: ICMP redirect 172.20.2.101 to host 172.20.2.101, length 48
12:44:32.311732 IP 172.20.2.1 > 172.20.2.100: ICMP redirect 172.20.2.101 to host 172.20.2.101, length 308

Edit: Ich kann nicht so viel Code einfügen, alsohttp://pastebin.com/ThgqBUgM(Link ist nicht mehr gültig)

Antwort1

Ihr Problem ist wahrscheinlich das Routing. Der Ubuntu-Server muss wissen, wo 192.168.0.0/24 - zu finden ist route add -net 192.168.0.0/24 gw 172.20.1.100. Andernfalls stimmt diese Route mit dem Standard-Gateway überein und Pakete werden über die falsche Schnittstelle geroutet. Jedes Gerät, das Pakete weiterleitet (OpenWRT und Ubuntu), muss 3 Netzwerke kennen: 192.168.0.0/24, 192.168.1.0/24und 172.20.1.0/24.

verwandte Informationen