Witam.
Odgrzewam trochę kotleta.
Zaktualizowałem na swoim WDR4300 CC do najnowszej wersji r48749 próbuję skonfigurować openvpn według opisu eko.one.pl/?p=openwrt-openvpntun
Niestety nie do końca działa.
Telefon z Androidem i aplikacją OpenVPN.
Logi z telefonu:
2016-03-17 11:14:54 SENT CONTROL [OpenWrt Server]: 'PUSH_REQUEST' (status=1)
2016-03-17 11:14:54 PUSH: Received control message: 'PUSH_REPLY,route 192.168.1.0 255.255.255.0,route 10.8.0.1,topology net30,ifconfig 10.8.0.6 10.8.0.5'
2016-03-17 11:14:54 OPTIONS IMPORT: --ifconfig/up options modified
2016-03-17 11:14:54 OPTIONS IMPORT: route options modified
2016-03-17 11:14:54 ROUTE_GATEWAY 127.100.103.119/255.0.0.0 IFACE=lo HWADDR=00:00:00:00:00:00
2016-03-17 11:14:54 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
2016-03-17 11:14:54 MANAGEMENT: >STATE:1458209694,ASSIGN_IP,,10.8.0.6,,,,
2016-03-17 11:14:54 MANAGEMENT: CMD 'needok 'IFCONFIG' ok'
2016-03-17 11:14:54 MANAGEMENT: >STATE:1458209694,ADD_ROUTES,,,,,,
2016-03-17 11:14:54 MANAGEMENT: CMD 'needok 'ROUTE' ok'
2016-03-17 11:14:54 MANAGEMENT: CMD 'needok 'ROUTE' ok'
2016-03-17 11:14:54 MANAGEMENT: CMD 'needok 'PERSIST_TUN_ACTION' NOACTION'
2016-03-17 11:14:54 Otwieram interfejs tun:
2016-03-17 11:14:54 Lokalne IPv4: 10.8.0.6/30 IPv6: null MTU: 1500
2016-03-17 11:14:54 Serwer DNS: , Domena: null
2016-03-17 11:14:54 Trasy: 10.8.0.1/32, 192.168.1.0/24
2016-03-17 11:14:54 Wykluczone trasy:
2016-03-17 11:14:54 VpnService dodano trasy: 10.8.0.1/32, 192.168.1.0/24
2016-03-17 11:14:54 Nie są używane żadne serwery DNS. Rozpoznawanie nazw może nie działać. Rozważ ustawienie własnych serwerów DNS. Miej również na uwadze, że Android nadal będzie korzystać z ustawień proxy Twojego połączenia mobilnego/Wi-Fi, nawet gdy opcje DNS nie są ustawione.
2016-03-17 11:14:54 MANAGEMENT: CMD 'needok 'OPENTUN' ok'
2016-03-17 11:14:54 Initialization Sequence Completed
2016-03-17 11:14:54 MANAGEMENT: >STATE:1458209694,CONNECTED,SUCCESS,10.8.0.6,MOJ_IP,1194,,
Tutaj następuje rozłączenie i wszystko od nowa
2016-03-17 11:16:54 [OpenWrt Server] Inactivity timeout (--ping-restart), restarting
2016-03-17 11:16:54 TCP/UDP: Closing socket
2016-03-17 11:16:54 Closing TUN/TAP interface
2016-03-17 11:16:54 SIGUSR1[soft,ping-restart] received, process restarting
2016-03-17 11:16:54 MANAGEMENT: >STATE:1458209814,RECONNECTING,ping-restart,,,,,
2016-03-17 11:16:55 MANAGEMENT: CMD 'hold release'
2016-03-17 11:16:55 MANAGEMENT: CMD 'bytecount 2'
2016-03-17 11:16:55 MANAGEMENT: CMD 'state on'
2016-03-17 11:16:55 MANAGEMENT: CMD 'proxy NONE'
2016-03-17 11:16:56 Control Channel MTU parms [ L:1557 D:1212 EF:38 EB:0 ET:0 EL:3 ]
2016-03-17 11:16:56 Data Channel MTU parms [ L:1557 D:1450 EF:57 EB:395 ET:0 EL:3 ]
2016-03-17 11:16:56 Local Options String (VER=V4): 'V4,dev-type tun,link-mtu 1557,tun-mtu 1500,proto UDPv4,cipher AES-256-CBC,auth SHA1,keysize 256,key-method 2,tls-client'
2016-03-17 11:16:56 Expected Remote Options String (VER=V4): 'V4,dev-type tun,link-mtu 1557,tun-mtu 1500,proto UDPv4,cipher AES-256-CBC,auth SHA1,keysize 256,key-method 2,tls-server'
2016-03-17 11:16:56 TCP/UDP: Preserving recently used remote address: [AF_INET]MOJ_IP:1194
2016-03-17 11:16:56 Socket Buffers: R=[163840->163840] S=[163840->163840]
2016-03-17 11:16:56 MANAGEMENT: CMD 'needok 'PROTECTFD' ok'
Zawartość pliku /etc/config/firewall
....
config zone
option name 'vpn'
option input 'ACCEPT'
option forward 'ACCEPT'
option output 'ACCEPT'
option network 'vpn'
option masq '1'
config forwarding
option src 'vpn'
option dest 'wan'
config rule
option name 'OpenVPN'
option target 'ACCEPT'
option src 'wan'
option proto 'udp'
option dest_port '1194'
config forwarding
option src 'vpn'
option dest 'lan'
Zawartość pliku /etc/config/network
....
config interface 'vpn'
option ifname 'tun0'
option proto 'none'
Zawartość pliku /etc/config/openvpn
config openvpn 'custom_config'
option enabled '0'
option config '/etc/openvpn/my-vpn.conf'
config openvpn 'sample_server'
option enabled '0'
option port '1194'
option proto 'udp'
option dev 'tun'
option ca '/etc/openvpn/ca.crt'
option cert '/etc/openvpn/server.crt'
option key '/etc/openvpn/server.key'
option dh '/etc/openvpn/dh1024.pem'
option server '10.8.0.0 255.255.255.0'
option ifconfig_pool_persist '/tmp/ipp.txt'
option keepalive '10 120'
option comp_lzo 'yes'
option persist_key '1'
option persist_tun '1'
option user 'nobody'
option status '/tmp/openvpn-status.log'
option verb '3'
config openvpn 'sample_client'
option enabled '0'
option client '1'
option dev 'tun'
option proto 'udp'
list remote 'my_server_1 1194'
option resolv_retry 'infinite'
option nobind '1'
option persist_key '1'
option persist_tun '1'
option user 'nobody'
option ca '/etc/openvpn/ca.crt'
option cert '/etc/openvpn/client.crt'
option key '/etc/openvpn/client.key'
option comp_lzo 'yes'
option verb '3'
config openvpn 'home'
option enabled '1'
option dev 'tun'
option port '1194'
option proto 'udp'
option log '/tmp/openvpn.log'
option verb '3'
option ca '/etc/openvpn/ca.crt'
option cert '/etc/openvpn/serwer.crt'
option key '/etc/openvpn/serwer.key'
option server '10.8.0.0 255.255.255.0'
option dh '/etc/openvpn/dh2048.pem'
list push 'route 192.168.1.0 255.255.255.0'
Zawartość pliku /tmp/openvpn.log
...
Thu Mar 17 11:43:17 2016 188.146.140.93:46642 TLS: Initial packet from [AF_INET]188.146.140.93:46642, sid=7a18f7e5 dc62eba4
Thu Mar 17 11:43:18 2016 188.146.140.93:46642 VERIFY OK: depth=1, C=PL, ST=Lodzkie, L=Lodz, O=Home, OU=Home, CN=OpenWrt Server, name=Router, emailAddress=ruter@test.pl
Thu Mar 17 11:43:18 2016 188.146.140.93:46642 VERIFY OK: depth=0, C=PL, ST=Lodzkie, L=Lodz, O=Home, OU=Home, CN=test, name=Router, emailAddress=test@gmail.com
Thu Mar 17 11:43:19 2016 188.146.140.93:46642 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Thu Mar 17 11:43:19 2016 188.146.140.93:46642 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Mar 17 11:43:19 2016 188.146.140.93:46642 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Thu Mar 17 11:43:19 2016 188.146.140.93:46642 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Mar 17 11:43:19 2016 188.146.140.93:46642 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 2048 bit RSA
Thu Mar 17 11:43:19 2016 188.146.140.93:46642 [test] Peer Connection Initiated with [AF_INET]188.146.140.93:46642
Thu Mar 17 11:43:19 2016 MULTI: new connection by client 'test' will cause previous active sessions by this client to be dropped. Remember to use the --duplicate-cn option if you want multiple clients using the same certificate or username to concurrently connect.
Thu Mar 17 11:43:19 2016 MULTI_sva: pool returned IPv4=10.8.0.6, IPv6=(Not enabled)
Thu Mar 17 11:43:19 2016 MULTI: Learn: 10.8.0.6 -> test/188.146.140.93:46642
Thu Mar 17 11:43:19 2016 MULTI: primary virtual IP for test/188.146.140.93:46642: 10.8.0.6
Thu Mar 17 11:43:20 2016 test/188.146.140.93:46642 PUSH: Received control message: 'PUSH_REQUEST'
Thu Mar 17 11:43:20 2016 test/188.146.140.93:46642 send_push_reply(): safe_cap=940
Thu Mar 17 11:43:20 2016 test/188.146.140.93:46642 SENT CONTROL [test]: 'PUSH_REPLY,route 192.168.1.0 255.255.255.0,route 10.8.0.1,topology net30,ifconfig 10.8.0.6 10.8.0.5' (status=1)
Thu Mar 17 11:45:22 2016 188.146.140.93:46593 TLS: Initial packet from [AF_INET]188.146.140.93:46593, sid=aee3188e be22cd23
Thu Mar 17 11:45:24 2016 188.146.140.93:46593 VERIFY OK: depth=1, C=PL, ST=Lodzkie, L=Lodz, O=Home, OU=Home, CN=OpenWrt Server, name=Router, emailAddress=ruter@test.pl
Thu Mar 17 11:45:24 2016 188.146.140.93:46593 VERIFY OK: depth=0, C=PL, ST=Lodzkie, L=Lodz, O=Home, OU=Home, CN=test, name=Router, emailAddress=test@gmail.com
Thu Mar 17 11:45:24 2016 188.146.140.93:46593 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Thu Mar 17 11:45:24 2016 188.146.140.93:46593 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Mar 17 11:45:24 2016 188.146.140.93:46593 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Thu Mar 17 11:45:24 2016 188.146.140.93:46593 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Mar 17 11:45:25 2016 188.146.140.93:46593 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 2048 bit RSA
Thu Mar 17 11:45:25 2016 188.146.140.93:46593 [test] Peer Connection Initiated with [AF_INET]188.146.140.93:46593
Thu Mar 17 11:45:25 2016 MULTI: new connection by client 'test' will cause previous active sessions by this client to be dropped. Remember to use the --duplicate-cn option if you want multiple clients using the same certificate or username to concurrently connect.
Thu Mar 17 11:45:25 2016 MULTI_sva: pool returned IPv4=10.8.0.6, IPv6=(Not enabled)
Thu Mar 17 11:45:25 2016 MULTI: Learn: 10.8.0.6 -> test/188.146.140.93:46593
Thu Mar 17 11:45:25 2016 MULTI: primary virtual IP for test/188.146.140.93:46593: 10.8.0.6
Thu Mar 17 11:45:26 2016 test/188.146.140.93:46593 PUSH: Received control message: 'PUSH_REQUEST'
Thu Mar 17 11:45:26 2016 test/188.146.140.93:46593 send_push_reply(): safe_cap=940
Thu Mar 17 11:45:26 2016 test/188.146.140.93:46593 SENT CONTROL [test]: 'PUSH_REPLY,route 192.168.1.0 255.255.255.0,route 10.8.0.1,topology net30,ifconfig 10.8.0.6 10.8.0.5' (status=1)
Do telefonu wrzuciłem certyfikaty:
ca.crt test.crt test.csr test.key test.p12
Oraz stworzyłem plik konfiguracyjny test.ovpn o zawartości:
client
remote MOJ_IP 1194
dev tun
proto udp
status current_status
resolv-retry infinite
ns-cert-type server
topology subnet
verb 3
cipher AES-256-CBC
ca ca.crt
cert test.crt
key test.key
comp-lzo
Sama aplikacja twierdzi że połączenie jest nawiązane lecz nie mogę niczego z sieci lan zapingować nie otwiera się też strona www rutera.
Oczywiście w całej konfiguracji podaję publiczny adres IP
| C2600 @ OpenWrt 21.02 / LuCi -> sieć gościnna, WINS serwer, VLAN, DLNA, multiwan
| WDR4300 @ OpenWrt 21.02 / LuCI -> extroot, sieć gościnna, WINS serwer
| MR3020 @ MiFi 17.01 -> E3372 HiLink
| WR842ND v2 @ Gargoyle PL 1.13.0 -> testy