How to install and configure openvpn on Samsung AT&T Captivate froyo Android 2.2 mobile

 

 

Who doesn’t run openVPN server? I run one at my home to access my home computers. You may be accessing an openvpn service somewhere on internet for security reasons.

I too needed my AT&T Captivate to connect to it. I searched through the amazing XDA-Developer website and found tons of  information on it and even a wonderful youtube video demonstrating how to do it.  But it didnt work for me because of several problems:

 

1) wrong version of openvpn binary

2) incorrect tun.ko module (provides the tun/tap device needed to run Openvpn)

3) incorrect links for route/ifconfig commands

 

Most of the installation work was done by two apps from the Market “OpenVPN Installer” and “OpenVPN Settings”. I then installed OpenVPN binary etc using the installer App, in /system/xbin. It placed a version of openvpn which could not push the routes from openvpn server to the device and I could not get the IP. So i had to use a different version of the OpenVPN binary.

So its going to be a little tricky. Stay with me and it will work!!
first use following basic adb usage tutorial I found. you will need to transfer files and get logs from phone :
http://www.londatiga.net/it/how-to-use-android-adb-command-line-tool/

 

Summary will look like this:

1) Install openvpn two packages from market – “OpenVPN Installer” and “OpenVPN Settings”

2) install the Openvpn binary using the installer app to the location /system/xbin (it will ask).

3) Setup openVPN App setings to:

  1. check load tun kernel module using ‘insmod’ and not ‘modprobe’ in Tun module settings (linux guys know what I am talking about-dont worry if you dont)
  2. path to configurations – /sdcard/openvpn
  3. path to openvpn binary – /system/xbin/openvpn
  4. keep the openVPN checked in the main menu of the settings app.

4) reboot the phone

5) Your existing config of openvpn would mostly work just fine( i had to make no changes to it at all once i used the openVPN binary version I mentioned below).
6) copy all configs and CERTS to the folder  /sdcard/openvpn and they should look like:

-rwxrwxr-x system   sdcard_rw     1188 2010-10-14 00:49 ca.crt
-rwxrwxr-x system   sdcard_rw     3467 2011-05-21 20:46 user23.crt
-rwxrwxr-x system   sdcard_rw      668 2011-05-21 20:46 user23.csr
-rwxrwxr-x system   sdcard_rw      887 2011-05-21 20:46 user23.key
-rwxrwxr-x system   sdcard_rw      993 2011-05-25 01:38 user23.ovpn

7) copied android22tun.ko from the .zip package attached HERE

8) reboot the phone

using openvpn installer on phone,
1.) install binaries to /system/xbin
2.) select path to ifconfig and route -> /system/xbin/bb

The link below allows for ifconfig and route commands to run after connection

make a link to xbin -> “ln -s /system/xbin /system/xbin/bb” using adb shell using adb tutorials.

remember , to run the ln command or any write activity to your /system folder, you will first need to remount this silesystem in rw mode using following command:


mount -o remount,rw /dev/block/stl6 /system

 

This is how your /system/xbin folder looked like for the related files:

-rwxrwxr-x root     root       903648 2011-05-25 01:28 openvpn
-rwxrwxr-x root     root       197193 2011-05-23 23:20 android22tun.ko
lrwxrwxrwx root     root              2011-05-25 00:42 bb -> /system/xbin

I don’t think that matters but still wanted to mention, I used superOneClick to root my phone.

This openvpn binary doesn’t work with busybox version that got installed when I rooted my phone(below):
http://github.com/downloads/fries/android-external-openvpn/openvpn-static-2.1.1.bz2

However this does work, so download it:
http://github.com/downloads/fries/android-external-openvpn/openvpn-static.bz2

overwrite the openvpn file using adb tools in /system/xbin/ as shown in the listing above.

<><><><><>

and here is the demo on a connected system!!!

 

c:\AC_SWM\&gt; adb shell
$ su
su
# /system/xbin/route
/system/xbin/route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.72.13  *               255.255.255.255 UH    0      0        0 tun0
192.168.72.0   192.168.72.13  255.255.255.128 UG    0      0        0 tun0
10.213.28.0    *               255.255.255.0   U     0      0        0 pdp0
192.168.12.0    192.168.72.13  255.255.255.0   UG    3      0        0 tun0
default         10.213.28.1    0.0.0.0         UG    0      0        0 pdp0
 
# /system/xbin/traceroute 192.168.12.1
/system/xbin/traceroute 192.168.12.1
traceroute to 192.168.12.1 (192.168.12.1), 30 hops max, 38 byte packets
1  192.168.72.1 (192.168.72.1)  842.641 ms  513.170 ms  1269.157 ms
2  192.168.12.1 (192.168.12.1)  743.758 ms  856.957 ms  637.559 ms
# /system/xbin/traceroute 192.168.12.13
/system/xbin/traceroute 192.168.12.13
traceroute to 192.168.12.13 (192.168.12.13), 30 hops max, 38 byte packets
1  192.168.72.1 (192.168.72.1)  585.472 ms  677.018 ms  565.116 ms
2  192.168.12.13 (192.168.12.13)  578.847 ms  863.204 ms  646.821 ms
#
 
# /system/xbin/ifconfig
/system/xbin/ifconfig
lo        Link encap:Local Loopback
inet addr:127.0.0.1  Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING  MTU:16436  Metric:1
RX packets:1273 errors:0 dropped:0 overruns:0 frame:0
TX packets:1273 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:62120 (60.6 KiB)  TX bytes:62120 (60.6 KiB)
 
pdp0      Link encap:Point-to-Point Protocol
inet addr:10.213.28.91  P-t-P:10.213.28.91  Mask:255.255.255.0
UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
RX packets:1012 errors:0 dropped:0 overruns:0 frame:0
TX packets:1141 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:705711 (689.1 KiB)  TX bytes:87133 (85.0 KiB)
 
svnet0    Link encap:UNSPEC  HWaddr A0-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP POINTOPOINT RUNNING NOARP  MTU:65541  Metric:1
RX packets:531 errors:0 dropped:0 overruns:0 frame:0
TX packets:297 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:14493 (14.1 KiB)  TX bytes:7291 (7.1 KiB)
 
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:192.168.72.14  P-t-P:192.168.72.13  Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
RX packets:20 errors:0 dropped:0 overruns:0 frame:0
TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:1404 (1.3 KiB)  TX bytes:1128 (1.1 KiB)

 

All the credit goes to OpenVPN guys for making such a wonderful ‘Home’ VPN and XDA-Developers for all this information.

and here are some pictures:

This article is still incomplete, please come back later until you see this line. You are encouraged to Post a comment if you have a question and I will get back to you.

About

View all posts by

4 thoughts on “How to install and configure openvpn on Samsung AT&T Captivate froyo Android 2.2 mobile

  1. Thanks for the detailed guide, however, you say…

    7) copied android22tun.xo from the .zip package attached HERE

    … where???

  2. Pingback: max

Leave a Reply

Your email address will not be published. Required fields are marked *