OpenWRT OpenVPN LAN-Zugriff

OpenWRT OpenVPN LAN-Zugriff

Mein Ziel ist es, einen PC vom Internet aus mit einem lokalen VPN bei mir zu Hause zu verbinden und dann auf meine Computer im lokalen LAN zuzugreifen.

Erläuterung:

******             **************        ******************         *********
* PC * ----------> * ISP-ROUTER * -----> * OPENWRT ROUTER * ------> * My PC *
******  INTERNET   **************  DMZ   ******************  WLAN   *********

Der OpenWRT-Router ist über den LAN-Port und nicht den WAN-Port verbunden, da der ISP-Router bereits LAN bereitstellt.

Auf dem OpenWRT-Router läuft OpenVPN. Ich kann mich mit dem „globalen PC“ mit meinem VPN verbinden, aber dann kann ich „Meinen PC“ nicht anpingen.

Ich habe alles versucht, was ich im Internet gefunden habe, aber ich bekomme immer das gleiche Ergebnis. Der OpenWRT-Router ist ein Netgear WDNR3700 mit OpenWRT 12.04.

Hier ist meine Konfiguration, die ich ausprobiert habe, aber kein positives Ergebnis erhalten habe:

/etc/config/openvpn

port 1194
proto udp
dev tun
ca /etc/openvpn/ca.crt
cert /etc/openvpn/server.crt
key /etc/openvpn/server.key
dh /etc/openvpn/dh1024.pem
server 10.8.0.0 255.255.255.0
push "route 10.0.0.0 255.255.255.0"
client-to-client
duplicate-cn
keepalive 10 120
comp-lzo
persist-key
persist-tun
status /tmp/openvpn-status.log
verb 3

/etc/config/netzwerk

config interface 'loopback'
    option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'

config interface 'lan'
    option type 'bridge'
    option proto 'static'
    option netmask '255.255.255.0'
    option ipaddr '10.0.0.5'
    option gateway '10.0.0.4'
    option broadcast '10.0.0.255'
    option dns '8.8.8.8'
    option ifname 'eth0.1 wlan0 radio1.network1'
    option bridge 'true'

config interface 'wan'
    option ifname 'eth1'
    option proto 'dhcp'

config switch
    option name 'rtl8366s'
    option reset '1'
    option enable_vlan '1'
    option blinkrate '2'

config switch_vlan
    option device 'rtl8366s'
    option vlan '1'
    option ports '0 1 2 3 5t'

config switch_port
    option device 'rtl8366s'
    option port '1'
    option led '6'

config switch_port
    option device 'rtl8366s'
    option port '2'
    option led '9'

config switch_port
    option device 'rtl8366s'
    option port '5'
    option led '2'

config interface 'vpn'
    option proto 'none'
    option ifname 'tun0-00'`

/etc/config/firewall

config defaults
    option syn_flood '1'
    option input 'ACCEPT'
    option output 'ACCEPT'
    option forward 'REJECT'

config zone
    option name 'lan'
    option network 'lan'
    option input 'ACCEPT'
    option output 'ACCEPT'
    option forward 'REJECT'

config zone
    option name 'wan'
    option network 'wan'
    option input 'REJECT'
    option output 'ACCEPT'
    option forward 'REJECT'
    option masq '1'
    option mtu_fix '1'

config zone
    option name 'vpn'
    option input 'ACCEPT'
    option output 'ACCEPT'
    option forward 'ACCEPT'
    option masq '1'
    option network 'vpn'

config forwarding
    option src 'lan'
    option dest 'wan'

config forwarding
    option src 'vpn'
    option dest 'lan'

config forwarding
    option src 'lan'
    option dest 'vpn'

config rule
    option name 'Allow-DHCP-Renew'
    option src 'wan'
    option proto 'udp'
    option dest_port '68'
    option target 'ACCEPT'
    option family 'ipv4'

config rule
    option name 'Allow-Ping'
    option src 'wan'
    option proto 'icmp'
    option icmp_type 'echo-request'
    option family 'ipv4'
    option target 'ACCEPT'

config rule
    option name 'Allow-DHCPv6'
    option src 'wan'
    option proto 'udp'
    option src_ip 'fe80::/10'
    option src_port '547'
    option dest_ip 'fe80::/10'
    option dest_port '546'
    option family 'ipv6'
    option target 'ACCEPT'

config rule
    option name 'Allow-ICMPv6-Input'
    option src 'wan'
    option proto 'icmp'
    list icmp_type 'echo-request'
    list icmp_type 'echo-reply'
    list icmp_type 'destination-unreachable'
    list icmp_type 'packet-too-big'
    list icmp_type 'time-exceeded'
    list icmp_type 'bad-header'
    list icmp_type 'unknown-header-type'
    list icmp_type 'router-solicitation'
    list icmp_type 'neighbour-solicitation'
    list icmp_type 'router-advertisement'
    list icmp_type 'neighbour-advertisement'
    option limit '1000/sec'
    option family 'ipv6'
    option target 'ACCEPT'

config rule
    option name 'Allow-ICMPv6-Forward'
    option src 'wan'
    option dest '*'
    option proto 'icmp'
    list icmp_type 'echo-request'
    list icmp_type 'echo-reply'
    list icmp_type 'destination-unreachable'
    list icmp_type 'packet-too-big'
    list icmp_type 'time-exceeded'
    list icmp_type 'bad-header'
    list icmp_type 'unknown-header-type'
    option limit '1000/sec'
    option family 'ipv6'
    option target 'ACCEPT'

config include
    option path '/etc/firewall.user'

config rule
    option src 'vpn'
    option target 'ACCEPT'
    option name 'VPN'
    option dest_port '1194'
    option proto 'tcpudp'
    option family 'ipv4'

config rule
    option target 'ACCEPT'
    option proto 'tcp'
    option dest_port '9100'
    option name 'Printer 0'
    option src 'lan'

Alles, was ich versuchte, führte immer zum gleichen Ergebnis: Verbindung zum VPN problemlos, Ping des lokalen PCs funktioniert nicht. Ich kann nicht einmal die interne IP des Routers anpingen.

Hoffentlich könnt ihr mir helfen. Danke im Voraus.

Antwort1

Gemäß diesem Beitrag habe ich das Problem gefunden: So verbinden Sie mehrere Netzwerke kostengünstig über das Internet

In meiner Konfiguration habe ich die Routeninformationen an den Client gesendet, aber nicht an den Server selbst. Also habe ich diese Zeile hinzugefügt: route 10.0.0.0 255.255.255.0und alles funktioniert einwandfrei.

Neue Konfigurationsdatei:

port 1194
proto udp
dev tun
ca /etc/openvpn/ca.crt
cert /etc/openvpn/server.crt
key /etc/openvpn/server.key
dh /etc/openvpn/dh1024.pem
server 10.8.0.0 255.255.255.0
route 10.0.0.0 255.255.255.0
push "route 10.0.0.0 255.255.255.0"
client-to-client
duplicate-cn
keepalive 10 120
comp-lzo
persist-key
persist-tun
status /tmp/openvpn-status.log
verb 3

verwandte Informationen