Android VPN – VPNC
29 June 2009I work in the IT department and we’re just rolling out Cisco VPN (with dongles) to replace our older ISA VPN. Seeing as my G1 is the first “smart” phone I’ve ever owned, I thought I’d get it setup to VPN in to work (So I could use the Android App Remote RDP). Unfortuantely it didn’t appear to be a simple app available to accomplish this feat. About two weeks ago, I stumbled upon this page which described how to configure vpn for Android. Using those directions (with help from the xda developer’s forum here) I was able to get VPN’ed into work, and RDP’ed to my workstation. Here’s what I did.
Requirements
- A rooted G1 with the tun module available (I used JF 1.51)
- JF’s Terminal Emulator (included with JF 1.51)
- Remote RDP
- Linux knowledge (optional)
Setup
- Download the Get-a-Robot VPNC bz2 file from google code
- Extract the archive (if on Linux you can use bunzip2, in Windows 7-zip works well) to a known folder. I extracted to c:\android-vpn\
- Note: I did the bulk of this on Windows, but if you’re smart you can translate this to Linux
- Open vpnc.conf located in ./data/data/org.codeandroid.vpnc/etc/vpnc/
- Edit the file with information from your Cisco .pcf file. Below is the mapping of variables for vpnc.conf to YourFile.pcf.
- IPSec gateway = Host
- IPSec ID =GroupName
- IPSec secret = GroupPwd (or if GroupPwd is blank, you’ll have to decrypt the enc_GroupPwd variable as shown below)
- Xauth username = Your login username
- Xauth password = Nothing. Leave this blank to have VPNC prompt you for your password every time.
My vpnc.conf file (sanitized and with the wrong username):
- Edit the vpnc-script and change the first line from #!/system/bin/bash to #!/system/bin/sh
- Open a command prompt and push the files using adb push x:\path\to\data /, copying the edited script and config file to the root of your G1.
- Mount the microSDHC card and create a new folder in its root called vpnc.
- Create two files: go and prep
go should contain this one line:
/data/data/org.codeandroid.vpnc/bin/vpnc /data/data/org.codeandroid.vpnc/etc/vpnc/vpnc.conf --script /data/data/org.codeandroid.vpnc/etc/vpnc/vpnc-script --pid-file /data/data/org.codeandroid.vpnc/etc/vpnc/vpnc-pid --no-detach --debug 1prep contains a few lines:
modprobe tun
lsmod
mkdir /dev/net
ln -s /dev/tun /dev/net/tun - Unmount the microSDHC card and then fire up terminal emulator – we need to chmod a few files to make things work.
chmod 777 /data/data/org.codeandroid.vpnc/bin/vpnc
chmod 777 /data/data/org.codeandroid.vpnc/etc/vpnc/vpnc-script
Starting the VPN
- In Terminal Emulator type su to get root access (Approve if it prompts you to grant permission)
- As root (designated by the “#” prompt) run cd /sdrom/vpnc
- Run sh prep (Note: this is only required once each time you reboot your phone)
- To start the VPN, run sh go. It will prompt your for your password, then attempt to connect:
- You can then click the back button to leave the vpn connection running and fire up Remote

- To close the VPN, reopen Terminal Emulator, and if it’s still up and running, send the interrupt (ctrl-c) by clicking and holding the mouse ball, then pressing ‘c’
- If the vpn is not still running, you can find the process ID number by running ps and looking for /data/data/org/codeandroid.vpnc/bin/vpnc.

- Kill the process by running kill -9 [pid], (in our example kill -9 1896)
Final Thoughts
Although this isn’t ideal for an extended VPN connection, if combinded with tethering (something I’m working on next), it could become quite powerful. For quick checks, this works quite well.
Sources:
xda-developer’s forum
Uber Geeky post
Get-A-Robot-VPNC Google Code Page
Submitting Comment, Give me a second...
Gday,
Heads up, new version with graphical user interface available at http://code.google.com/p/get-a-robot-vpnc/
Requires most of the same tools you have said, we are working on streamlining the process though.