OpenVPN on Android

Monday, September 13th, 2010

I have really enjoyed having a VPN so that I could remote into work. The other day though, I had to skip out on fishing because we had some computer issues and I didn’t have my laptop. It made me think, wouldn’t it be sweet if I could just use my super duper android phone to VPN into work. This is what I did. First off, an assumtion is made that you have a rooted device.

What you need is to have both busybox, and the tunnel device kernel driver, tun.ko. I am running Cyanogenmod 6 which has busybox already installed. For some reason this version of Cyanogenmod doesn’t have the tun.ko, and ones that I downloaded would not insert into the kernel. So, I installed a ChevyNO1 kernel that comes with the tun.ko driver, and we are to the races on that part. This may sound intimidating, but ROM Manager from the market makes this very easy.

Next thing to just make life easy is to install OpenVPN Installer and OpenVPN settings. They are in the market, go ahead, download it them. I will wait. OpenVPN Installer gives you the option to install all the openvpn stuff. Go ahead and run that. Unfortunately, at the time of this writing, openvpn won’t work still. The problem is a bug in the shipped OpenVPN binary noted here: http://code.google.com/p/android-openvpn-settings/issues/detail?id=26 . There is a link to get the OpenVPN binary that would work.

Once you have that use the OpenVPN Settings to establish connections. It will ask where your key files are and once it knows that and your server, you are up and going. Now I can really get to work wherever I am. Wait a second, maybe I don’t want to do that …

Laptop to an AP

Monday, July 19th, 2010

So, the other day I was at a location that has a wired internet connection but no wireless and no switch. I didn’t have switch and wireless with me and so, I decided to take on the task of making my laptop a wireless access point with WPA2 security. The guide that I followed the most is here, and much thanks to the author, although I did find that I had to do more to get it to work than the guide provided.

Very first you will need to have installed the following packages:

wireless-tools
iw
linux kernel 2.6.30 or later (I am using 2.6.31-21 ubuntu generic)
hostapd
dhcp-server

My hardware: Macbook Pro 3,1 running Ubuntu Linux (9.10 Karmic). This laptop has a wireless card that uses the atheros ath9k driver.

The rest of this article assumes that you already have a good working WIFI card, my point is not to troubleshoot why your wifi card doesn’t work. Also I assume that you know how to set up a DHCP server, know how to edit files, etc.

First, after making sure that my wireless card would even do it I set the static IP on my wirless card.

ifconfig wlan0 192.168.10.1 netmask 255.255.255.0

Next, I set up DHCP on the wireless interface only with my dhcpd.conf looking like this.

subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.10 192.168.10.49;
option routers 192.168.10.1;
option ip-forwarding off;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.10.255;
option domain-name-servers 4.2.2.2, 4.2.2.1;
}
Then I set up my hastapd.conf file thusly.
interface=wlan0
driver=nl80211
ssid=YourSSID
channel=6
hw_mode=g
auth_algs=1
wpa=3
wpa_passphrase=12345678 (Change this, obviously)
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP
Lastly, run the thing.
#hostapd -d hostapd.conf
Some other caveats. I did have to change some iptables stuff to allow routing through the eth0 interface and allow access to the DHCP server through port 67. My rule set looked like this:
-A POSTROUTING -o eth0 -j MASQUERADE
-A INPUT -p tcp -m tcp –dport 67 -j ACCEPT
-A INPUT -p udp -m udp –dport 67 -j ACCEPT
-A FORWARD -i wlan0 -j ACCEPT
Otherwise, that was all there really was to it. My brother-in-law could connect to the web through my laptop and I could use it with the wired. The world was right as rain.

WICD let me down

Thursday, March 18th, 2010

I blogged a while back about WICD, the wireless manager that I had switched to a because it seemed to do better than network-manager. All that has changed.

There have been several little issues.

First, I was dissappointed that wicd would let me use the wireless or wired. Not both. I realize there is not often when I need to do that, but when you need to test a wired network for connectivity and still having internet. When trying to avoid wicd and just using the command line for a quick ‘eth0 up; dhclient3′ wicd would disconnect the wireless.

Second, when coming from resume there would be occasions where wicd reported no wireless AP’s. I wrote a little script to get me wireless back which stopped the wicd daemon, removed the wireless driver module, modprobed the wireless driver and then started the wicd daemon. After doing this I could get back on the web.

The last one though was to much. I have a Motorola DROID and love it as a smart phone. I have rooted the phone to give me tethering capability. When you do that the Droid sets up an ad-hoc wireless network which bridges to the 3G connection in the phone. The problem lies in the fact that wicd won’t connect to  ad-hoc networks. I google searched and even the mighty google only said “wicd won’t let you”.

So much disappointment there. All three of those issues are solved with network-manager again. If anyone has any solutions for wicd let me know.

WICD

Monday, September 21st, 2009

I read somewhere (not sure where) about wicd to manage internet instead of network-manager. And thus far in my experience it really isn’t bad at all.

Good:
Has more granular control over networks. Including a place to have scripts run at pre-connect, post-connect, and disconnect. I think I could use that to avoid problems at shutdown with cifs mounted shares. Also, you can specify your own DNS servers for either general or for each network specifically.
The little computers in the notification area actually light up with network activity. Kinda cool.
WiCD runs before your gui is up and running. So I am connected to my wireless the second that I can use my mouse. Very cool.

Bummer:
I do like the simple menu that pops up with network-manager. It was a very easy way to manage which network you were connected to. wicd feels something like Windows wireless connection dialog. Only to a certain degree, but enough I guess.

So, I am still using it, overall I think that I like it. More possibly later.