Temat: OpenVPN - Przekierowanie portów
Potrzebuję mieć dostęp do kamery w magazynie, mam tam router z OpenWrt CC.
Na routerze jako WAN będzie modem 3G, kupiłem serwer VPS na Debianie i postawiłem tam OpenVPN. Skopiowałem kluczę i certyfikaty na Windows i z Windows bez problemu łącze się do VPN. Czyli serwer działa ok.
Mam jedynie problem z konfiguracją OpenWrt, skonfigurowałem go jako OpenVPN client, log:
Thu Feb 23 20:02:44 2017 daemon.notice openvpn(sample_client)[1473]: OpenVPN 2.3.6 mipsel-openwrt-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [MH] [IPv6] built on Jan 31 2016
Thu Feb 23 20:02:44 2017 daemon.notice openvpn(sample_client)[1473]: library versions: OpenSSL 1.0.2g 1 Mar 2016, LZO 2.08
Thu Feb 23 20:02:44 2017 daemon.warn openvpn(sample_client)[1473]: WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.
Thu Feb 23 20:02:45 2017 daemon.warn openvpn(sample_client)[1473]: WARNING: file '/lib/uci/upload/cbid.openvpn.sample_client.key' is group or others accessible
Thu Feb 23 20:02:45 2017 daemon.notice openvpn(sample_client)[1473]: Socket Buffers: R=[163840->131072] S=[163840->131072]
Thu Feb 23 20:02:45 2017 daemon.notice openvpn(sample_client)[1473]: NOTE: UID/GID downgrade will be delayed because of --client, --pull, or --up-delay
Thu Feb 23 20:02:45 2017 daemon.notice openvpn(sample_client)[1473]: UDPv4 link local: [undef]
Thu Feb 23 20:02:45 2017 daemon.notice openvpn(sample_client)[1473]: UDPv4 link remote: [AF_INET]86.105.53.236:1194
Thu Feb 23 20:02:45 2017 daemon.notice openvpn(sample_client)[1473]: TLS: Initial packet from [AF_INET]86.105.53.236:1194, sid=88d05200 e056db85
Thu Feb 23 20:02:45 2017 daemon.notice openvpn(sample_client)[1473]: VERIFY OK: depth=1, C=PL, ST=Lodzkie, L=Lodz, O=NA, OU=NA, CN=NA CA, name=server, emailAddress=me@myhost.mydomain
Thu Feb 23 20:02:45 2017 daemon.notice openvpn(sample_client)[1473]: VERIFY OK: depth=0, C=PL, ST=Lodzkie, L=Lodz, O=NA, OU=NA, CN=server, name=server, emailAddress=me@myhost.mydomain
Thu Feb 23 20:02:47 2017 daemon.notice openvpn(sample_client)[1473]: Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Thu Feb 23 20:02:47 2017 daemon.notice openvpn(sample_client)[1473]: Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Feb 23 20:02:47 2017 daemon.notice openvpn(sample_client)[1473]: Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Thu Feb 23 20:02:47 2017 daemon.notice openvpn(sample_client)[1473]: Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Feb 23 20:02:47 2017 daemon.notice openvpn(sample_client)[1473]: Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 2048 bit RSA
Thu Feb 23 20:02:47 2017 daemon.notice openvpn(sample_client)[1473]: [server] Peer Connection Initiated with [AF_INET]86.105.53.236:1194
Thu Feb 23 20:02:49 2017 daemon.notice openvpn(sample_client)[1473]: SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
Thu Feb 23 20:02:49 2017 daemon.notice openvpn(sample_client)[1473]: PUSH: Received control message: 'PUSH_REPLY,redirect-gateway def1 bypass-dhcp,dhcp-option DNS 208.67.222.222,dhcp-option DNS 208.67.220.220,route 10.8.0.1,topology net30,ping 10,ping-restart 120,ifconfig 10.8.0.6 10.8.0.5'
Thu Feb 23 20:02:49 2017 daemon.notice openvpn(sample_client)[1473]: OPTIONS IMPORT: timers and/or timeouts modified
Thu Feb 23 20:02:49 2017 daemon.notice openvpn(sample_client)[1473]: OPTIONS IMPORT: --ifconfig/up options modified
Thu Feb 23 20:02:49 2017 daemon.notice openvpn(sample_client)[1473]: OPTIONS IMPORT: route options modified
Thu Feb 23 20:02:49 2017 daemon.notice openvpn(sample_client)[1473]: OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modified
Thu Feb 23 20:02:49 2017 daemon.notice openvpn(sample_client)[1473]: TUN/TAP device tun0 opened
Thu Feb 23 20:02:49 2017 daemon.notice openvpn(sample_client)[1473]: TUN/TAP TX queue length set to 100
Thu Feb 23 20:02:49 2017 daemon.notice openvpn(sample_client)[1473]: do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Thu Feb 23 20:02:49 2017 daemon.notice openvpn(sample_client)[1473]: /sbin/ifconfig tun0 10.8.0.6 pointopoint 10.8.0.5 mtu 1500
Thu Feb 23 20:02:49 2017 daemon.notice openvpn(sample_client)[1473]: /sbin/route add -net 86.105.53.236 netmask 255.255.255.255 gw 192.168.120.1
Thu Feb 23 20:02:49 2017 daemon.notice openvpn(sample_client)[1473]: /sbin/route add -net 0.0.0.0 netmask 128.0.0.0 gw 10.8.0.5
Thu Feb 23 20:02:49 2017 daemon.notice openvpn(sample_client)[1473]: /sbin/route add -net 128.0.0.0 netmask 128.0.0.0 gw 10.8.0.5
Thu Feb 23 20:02:49 2017 daemon.notice openvpn(sample_client)[1473]: /sbin/route add -net 10.8.0.1 netmask 255.255.255.255 gw 10.8.0.5
Thu Feb 23 20:02:49 2017 daemon.notice openvpn(sample_client)[1473]: UID set to nobody
Thu Feb 23 20:02:49 2017 daemon.notice openvpn(sample_client)[1473]: Initialization Sequence CompletedNiestety na kliencie LAN, podłaczonym do routera nie mam neta:
C:\WINDOWS\system32>ping 8.8.8.8
Pinging 8.8.8.8 with 32 bytes of data:
Reply from 192.168.2.1: Destination port unreachable.
Reply from 192.168.2.1: Destination port unreachable.Na VPS, otworzyłem port 8112:
root@OpenVPN:~# ufw status
Status: active
To Action From
-- ------ ----
22 ALLOW Anywhere
1194/udp ALLOW Anywhere
8112/tcp ALLOW Anywhere
22 ALLOW Anywhere (v6)
1194/udp ALLOW Anywhere (v6)
8112/tcp ALLOW Anywhere (v6)Jak teraz ustawić OpenWrt żeby przekierowywał ten port 8112 z serwera OpenVPN na adres LAN: 192.168.2.20:8112?.
Proszę o pomoc bo siedzę na tym pół dnia ale coś mi nie wychodzi...