Pelicanux

Just A Few Random Words

OpenVPN on Android

How I installed and configure OpenVPN on my Android tablet

There is nothing much complicated, my Android version is 4.1.1; Most options are pushed on server-side. I have chosen the OpenVPN Connect Android application (version 1.1.14), which is the official OpenVPN application for Android and iPhone/Pad/craps. OpenVPN Connect expects its configuration in a .ovpn file, that’s all.

The modification done on server side lets you automatically process most steps described earlier:

1
2
3
4
client-to-client
push "redirect-gateway $Server_IP_Address"
push "redirect-gateway def1"
push "dhcp-option DNS $My_DNS"

On Android side:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
client
dev tun0
lport 1194

remote 5.39.82.22 1194 udp

ca "/sdcards/My Documents/ca.crt"
cert "/sdcards/My Documents/android.crt"
key "/sdcards/My Documents/android.key"

comp-lzo
persist-key
persist-tun

verb 5

pull

Some more options on Android side

  • OpenVPN Connect comes with an option called Seamless Tunnel, which cuts Internet connection when the tunnel can’t be establieshed. Whereas this option is not available for Android 4.4 to 4.4.2, it prevents you to connect directly when something went wrong with your tunnel.

  • It worthes notice that if the DNS option are not pushed by the server, Android will by default use Google DNS servers, which may not be what you want.

  • You can cat the certificate/keys/CA certificate all in the *.ovpn configuration file. This lets you manage only one file to be imported on Android side. OpenVPN Connect uses a XML-like syntax.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<ca>
-----BEGIN CERTIFICATE-----
....
</ca>
<cert>
-----BEGIN CERTIFICATE-----
...
</cert>
<key>
-----BEGIN RSA PRIVATE KEY
...
</key>
key-direction 1
<tls-auth>
----- BEGIN OpenVPN Static key V1-----
...
</key>