I've installed openvpn on a debian VPS & configured it as you see below:
port 1194
proto udp
dev tun
ifconfig 10.0.2.21 10.0.2.22
ifconfig-noexec
route-noexec
keepalive 10 120
persist-key
persist-tun
comp-lzo
verb 3
#fragment 1200
mssfix 1200
#reneg-sec 0
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
tls-server
tls-auth static.key 0
ca RastakCA.crt
cert ovpn.crt
key ovpn.key
dh ovpn_dh2048.pem
cipher BF-CBC # Blowfish (default)
cipher AES-128-CBC # AES
cipher DES-EDE3-CBC # Triple-DES
status openvpn-status.log
log openvpn.log
;log-append openvpn.log
& here is the client config:
client
dev tun
proto udp
remote a.b.c.d
ifconfig 10.0.2.22 10.0.2.21
redirect-gateway def1
tls-client
tls-auth static.key 1
ca CA.crt
cert ovpn_client.crt
key ovpn_client.key
cipher BF-CBC # Blowfish (default)
cipher AES-128-CBC # AES
cipher DES-EDE3-CBC # Triple-DES
comp-lzo
#fragment 1200
#reneg-sec 0
mssfix 1200
verb 3
now when I connect to it on windows (with openvpn-gui client) everything is OK, but when I use same client config to connect in an android device (using openvpn connect), I get following warning at server side:
Sat Jan 10 22:23:53 2015 WARNING: 'ifconfig' is present in local config but missing in remote config, local='ifconfig 10.0.2.21 10.0.2.22'
& also following error at client side:
Tun interface setup failed: tun_builder_error: one of ifconfig or ifconfig-ipv6 must be specified
I added following line to server config file & I succeed to connect using both windows and android clinets:
push "ifconfig 10.0.2.22 10.0.2.21"
but there is still another problem: when I disconnect manually in android device, server process dies with these lines of log:
Sat Jan 10 23:30:44 2015 TCP/UDP: Closing socket
Sat Jan 10 23:30:44 2015 Closing TUN/TAP interface
Sat Jan 10 23:30:44 2015 SIGTERM[soft,remote-exit] received, process exiting
& I have to restart server daemon again (in the windows client I've no problem after disconnecting manually & also I've no problem with android device when connection loses without disconnecting).
Any solution?
I didn't find the reason of closing TUN by the server, but I could fix the problem by adding following line of code in server configuration file:
It automatically restarts server each time it goes down.