If you want to have a secure browsing environment or just want to access your home network securely without exposing extra services to the internet and without the mess that comes with setting up and maintaining a VPN server, ssh tunneling is your rescuer. In this post, I’ll tell you how to setup an ssh tunnel to your home network easily. Also look for some bonus tips at the end
This article assumes that you have already installed and setup a ssh server (you can probably use openssh). Also, it assumes that the ssh server is accessible from the internet (i.e. you have appropriately forwarded the port on which ssh server is running). I’d also recommend that if you do not have a static IP for your home network, then sign up for a dynamic DNS service (I use dyndns.org) so that you can access your home network easily by using a domain name (e.g. myserver.dyndns.org) from outside.
Now, here is a step by step guide on what to do on your Android Phone (I’m doing this on a Nexus one but should be same for you as well):1. Install an app called “connectbot” from the android marketplace. It is a FREE ssh client for android.
2. Open it and add the IP (or dynamic domain name as suggested above) and the port on which ssh server is running to the bottom and connect.
![]()
2. Once connected, press the menu button and select the icon which says “Port Forwards”
![]()
3. On this screen you can configure the ports to be used for tunneling. As you can see I already have my firefly server port configured for music streaming over itunes’ DAAP protocol. Now, you can press “menu” button and click on “Add ports” and go to step 4.
![]()
4. You will see the dialog box as shown below. Here you can configure mainly two types of ports.
![]()
4a) First is for services that you want to access already running on your home network. e.g. in my case, I have a firefly media server (mt-daapd) running on a port “12345″ and I want to access this just like I was on LAN over my home wi-fi. In such a case, select “type” as “Local”, source port as , say “56000″ and destination as “ip:port” where ip is the your home local area IP of the machine on which the server is running (My server runs on router itself, which has IP 192.168.1.1) and the port is the actual port on which server is running (e.g. 12345 as we mentioned above). After doing this, just open the respective client app on your phone which wants to connect to this server and enter “127.0.0.1″ as the ip and “56000″ as the port to connect to and it will connect to server as if you were on your home network even over 3G or your office wi-fi.
4b) Secondly, you can use this tunnel to route all traffic to internet through home connection. For this, choose the type as “dynamic” and source port as, say, ” 56001″. You don’t need to select a destination port here because any traffic that comes over this tunnel will be routed back to the internet using the destination ip and port as desired, e.g., specified in a browser’s address bar.
Bonus: As I promised above, here is the bonus. For media streaming, you can use mt-daapd or firefly server on your home network, especially on a router like asus wl-500 or any other hackable router with custom firmware. For more info about how to set it up, you can check these posts: Latest Firefly server for your router and firefly sqlite error solution. For android side things, install the “DAAP Client” app from the market place and click on “Add server” option and follow step 4a as mentioned above. And there it is, your own music streaming service anywhere in the world, over edge/3G or any other network



[...] with Android Filed under: Hardware,Linux,Security — 0ddn1x @ 2010-08-06 18:02:47 +0000 http://tech.shantanugoel.com/2010/08/02/ssh-tunneling-android.html Leave a Comment TrackBack [...]
[...] configured the SSH connection on my phone in the "ConnectBot" app following the guide ( SSH Tunneling On Android | Shantanu's Technophilic Musings ) What I accomplished: 1.) After configuring the SSH server on the PC and the [...]
Hi,
I want to use the tunnel to route all the traffic from my phone to my computer. I can successfully create the tunnel using Dynamic(SOCKS) and 8001 specified as the port. However, when I go to browser and visit whatismyip.com I can’t see my home computer IP. All I see is my current IP address. Do I need to change the settings on browser?
To route all the traffic from your phone, you need to look at a VPN instead since many apps, including the browser, don’t have the ability to use proxies and hence you will not be able to use your ssh tunnel with them.
Shantanu said “you need to look at a VPN instead since many apps, including the browser, don’t have the ability to use proxies”
I use SSHtunnel, and it most definitely works fine with the browser, and all my other android applications. It has an amazingly easy way to set up the ‘proxies’ automatically, too.
[...] 2. SSH Tunneling On Android via Shantanu’s Technophilic Musings [...]
I installed connectbot and can connect to my VPN with no problem. But how can the browser get the tunnel data from my VPN? When I do a showmyip.com I still get the ISP’s IP.
sshtunnel, wonderfullllllllll app. its woking perfectly
Using this you should be able to set the proxy settings in the Androids phone to take advantage of the tunnel. Alternatively in a worst case scenario this could be combined with Squid and then setting up a tunnel to the squid server and using that would proxy the traffic.
trevmar,
please explain how i can browse from my Android through SSH tunnel created to my home network.
I can now connect to my home SSH server successfully from 3G Android using FreeSSHd installed at home and ConnectBot. I used to know how to do SSH web browsing but it was easy with Putty from my laptop.
Can I use port forwarding in ConnectBot? How do I set up SOCKS proxy in browser? WHich browser? Are you saying I can remove ConnectBot all together and use SSHTunnel?
Thank you,
Bert
Here is an easy way to set up your browser and Tunnel on your android device. http://crackednoodle.com/2012/01/bypass-firewalls-with-android-ssh-tunneling/
[...] http://tech.shantanugoel.com/2010/08/02/ssh-tunneling-android.html Read Comments (0) [...]
hi
i just want to know that can i use ssh tunneling for data sync to server in android.If yes how i can use this for data sync.
thanx….
Arun Goyal
[...] Story link via DuckDuckGo for Android: http://tech.shantanugoel.com/2010/08/02/ssh-tunneling-android.html [...]
[...] SSH Tunneling On Android | Shantanu vs The World. [...]