open source java ME (prefered but SE is would do okay too maybe) VPN server?

Okay I have G1 as my home internet access. Using the dev tools for it’s os (Andriod) I can forward a connection socket through the usb cable into the phone. From there I can run tetherbot which is a socks 5 proxy, and with a combo of that and proxifier I can sort of get a functioning internet connection. Many things don’t work however. I’d like to get a full on lan connection going

The G1’s data plan includes tethering, google just hasn’t implemented it yet I was told by the T-mobile employee I asked. The only gotcha is if I use over 10 gigs a month I get dropped to edge speeds, but since I only get edge service out here anyway this threat has no teeth.
What I’d like to do is implement a VPN server on the phone and connect that way.

I can’t root the phone with out voiding my warranty so I can’t compile c++, and c binaries for it. No way to execute them. I’d have to implement it in java, sort of. Android apps run on a java VM that’s based on Jave ME, but different.

So I figure a java ME vpn server would be easiest to port. Jave SE would prolly be a close second.

Why does it have to be a VPN server? Wouldn’t you just need some kind of gateway software?

Well it’s hacks you see. The phone won’t connect to both the internet and lan at the same time. So you can’t make any network connections to the phone while it’s on the internet. At least anything windows is designed to see as a network connection.

In the Android dev tools there’s a a program called adb.exe that can forward IP traffic from the computer to the phone.
So if you plug the phone in with a usb cable and do the command

Any traffic sent to port 1080 on your computer will be redirected to your phone. If you run a proxy server on your phone there then you access the phone’s internet.

Then what you do is use proxifier which through some more hacks forwards all your net traffic through the proxy whether the program supports it or not. You set the proxy server as localhost:1080

This works for some things and breaks other things. Meanwhile some software won’t even try and use the internet because you don’t have any network connections so it just assumes you don’t have any net.
A VPN connection would fix all that. Windows would make a virtual connection and all software would see it as a an honest to god network connection. A gateway would still be needed but it’d work a lot better even with the proxy.

Maybe I’m dense, but if you can forward the PC’s port 1080 to the phone listening on its own port 1080, and then get out the internet via the phone (similar to an SSH tunnel, yes?), isn’t the phone connecting to the internet and lan at the same time?

The phone is connected through a USB cable. Using ADB packets can be port forwarded through the USB cable to the phone.

The way you access the proxy is by using localhost as the proxy address. The packets are then intercepted by ADB and forwarded through the USB cable to the proxy server on the phone.

Here’s the proxy: http://graha.ms/androidproxy/

Hm. Well, anyway, have you tried compiling openvpn on the thing?

You may also find some SSL vpn solution, but I don’t know of any open source ones (I’m familiar with Juniper).

Remember that even if you get some vpn compiled/installed on the phone, it may still not do what you want it to do. While VPN servers are generally connected to initially on a single port (presumably the port you hope to forward to with the adb thing), other stuff often happens after that, on other ports. And sometimes it’s UDP rather than TCP, even.

One last other suggestion I might make is to look into ppp over ssh. With your adb port forwarding you should be able to set up an SSH tunnel, and from there you can use ppp over the tunnel for a quick and dirty “vpn lite.” Assuming you can get ssh and ppp servers on the phone. But that might be easier to do than getting a VPN server on the phone.

But you probably you probably know all this, so good luck with it. Tell us what happens!

I’d be willing to bet compiling OpenVPN on the android SDK is not one of those “it just works” projects by a longshot.

But you don’t actually need any VPN stuff to run on the phone if you can set up a simple port-forwarder to any arbitrary host on the internet. You can’t do this with ADB alone as far as I can tell, but let’s say you have a VPN server on port 1234 of host vpn.myjob.com. You could set up ADB to listen on localhost:1234 and forward to tcp:4321, then you have an android app that itself is a port forwarder listening on port 4321 on the device and blindly forwarding to vpn.myjob.com:1234. Then you run VPN client stuff on your PC, connecting to localhost. (in actuality, you could use the same port number in all four places; I just used two different numbers because the second one is arbitrary and that makes it a little clearer)

Seems doable. If you decide to try it, you don’t necessarily need to write a custom port forwarding app; there’s a very nice SSH client called ConnectBot on the App Market (for free) that does port forwarding.

W00t. I just verified that this will work by doing the following:

adb -d tcp:2222 tcp:2222

then running connectbot and specifying a “local” forward of port 2222 to splitter.mydomain.com:22 (where splitter.mydomain.com is a linux server I have colocated out on the internets which will otherwise remain anonymous).

Then on my PC:
ssh -p 2222 localhost

and bingo, I’m logged into splitter via my 3G connection. Since VPN is quite tunnelable, you can just replace “splitter.mydomain.com:22” with the hostname and port of your VPN server and you should be good to go by telling your VPN client that the server is localhost, port 2222.

I can’t possibly be the first to figure this out… Report back if you try it out.

That’s a pretty cool idea, ntucker. Tho I didn’t know VPNs in general worked over ssh tunnels – I tried that once and it had seemed like being able to reach the one port on the VPN server alone wasn’t enough for the VPN client and server to negotiate the connection. But maybe that was just because of the particular VPN software I was using, or maybe I just did something wrong. But yeah, if the VPN server you use just needs to listen on the one port then I agree this is a good solution.

I admit I don’t have a ton of familiarity with all VPN protocols, and I think there is at least one that needs two ports open (which is obviously doable too), but I definitely succeeded in tunneling my old company’s VPN through an ssh pipe. I’d test it out now, but I don’t have a VPN server to connect to.

Wow that’s a pretty cool idea. Been trying to set up an openvpn server. I’ve tried mucho times since last night to get standard vpn working but it’s no go.

Openvpn is the only one that’s tcp/ip based so I can forward it but tcp based openvpn services on the internet are pretty rare, especially ones with a free trial to test this.

So I found one with a free trial and a shell account figuring I could set it up openvpn myself but man that was some problems too.