VPN setup on Android (Samsung Galaxy Ace GT-5830)

Finally, yay, finally I managed to setup VPN on my phone. I had rooted the phone (as mentioned in my previous post) which is required to use a vpn client. But there is one more thing, i.e. to have tun.ko linux kernel module. Without this module one cannot use the vpn client. This is only required if your vpn server is setup using Cisco technology (which is a non-standard method, I didn’t know that). If your VPN server is setup using the well known open technologies, you may be able to use the stock vpn client provided by Android os itself. Anyway, major hurdle was to compile the tun.ko for my running android kernel – which was 2.6.32.9-perf as I found it from adb shell. I had already downloaded the package from Samsung’s opensource website, but did not know how to build it. This package contains two things: 1) kernel 2) platform utilities (i.e. userspace programs and toolchains). The website mentions different packages for different phone models, and luckily my phone model was there, so I get the stock kernel in the package. But the kenrel configuration (i.e. .config file) will be different than my running kernel. But fortunately, the running kernel has its kernel configuration stored in /proc/config.gz which I got using adb utils and copied this config into the downloaded kenrel so that when I build the tun.ko, it get the exact same signature as of running kernel. Following are the steps:

* sudo ./adb kill-server
* sudo ./adb shell
* $ su
* # ls /proc/config.gz
* # exit
* sudo ./adb pull /proc/config.gz ~/
* gunzip ~/config.gz
* cp ~/config /kernel/.config
* cd /kernel/
* make oldconfig

By this point, the kernel is configured to as my running android kernel. Next step is to run make menuconfig, and select the Tunneling driver support.

* make menuconfig

Once the Tunneling driver support is enabled, just copy the ARM-eabi toolchain just one directory above the kernel.

* cp -r /opensrc/prebuilt/linux-x86/toolchain
* cd /kernel
* make drivers/net/tun.ko

Yoooooo, the tunneling kernel module tun.ko is ready. Just copy this module to your phone’s sd card, load it using insmod (via terminal app on phone or adb shell) and run the vpn client. Done!!

Mission accomplished :)

4 thoughts on “VPN setup on Android (Samsung Galaxy Ace GT-5830)

  1. Pingback: VPN und tun.ko - Android-Hilfe.de

Leave a comment