본문 바로가기
스마트폰 (Mobile)

Android Usb Port Forwarding

by 날으는물고기 2011. 6. 8.

Android Usb Port Forwarding

Introduction  

The Android architecture does not allow to start communication from the Android to the host through the USB cable.The opposite is possible, using the Google "Android Debug Bridge" (ADB in short).    

This tool will act as a tunnel between the Android client application and the host server. It is a software implementation of a router doing IP port forwarding.



On the Host part, you have to declare the ports you want to be opened on the Android and the tunnel will transfer communications between the android and the host. The host can be any server on the network or your local host. 

Prerequisits   

  • Enable "Usb debuging" on your Android
  • Install "Usb Tunnel" on your Android (see donwnload link on top of the article) or from the market :
  • Screenshot - market.jpg
  • Install the host windows application (see download link on top of the article) or this skydrive link or this GDoc link   
  • On the configuration panel, enter the path to the ADB program. ADB is part of the Android SDK. The installation includes the minimum files required.
  • Add tunnels. Each tunnel is composed of a name, an Android port (low port like 80 can't be used), a host IP and a host port (can be different from the android port)  


HTTP proxy 

If Tethering is a technology that allows you to use the mobile internet connection on your PC, this tool gives you the opposite. It's a sort of Reverse Tethering.   

You can now surf on your mobile (using the internet connection on your PC) through the Usb tunnel and via a proxy. 

If you are on a company network, ask your administrator what IP adddress and port he is using for the proxy. In some cases it can be the default gateway (run ipconfig command at the DOS prompt to find out what the default gateway is). 

If you are on a private network and you have no clue about the proxy adress and port, you can use a public proxy (do search for "Public proxy" on the internet). To help you out, here is link to a list of proxies. 

Another possibility is to install a local http proxy server like squid.  

Step 1 : configure the windows part. Since low ports can't be used, you should use a different high port for the android and another port for the host.  

Sample configuration for a company network : (192.168.xxx.xxx) on port 80 


Sample configuration for a public internet proxy on port 8080 

Step 2 : Connect he USB cable (of course).  Click the refresh button to display your device in the device list then click connect. The Android Usb tunnel service will start in the background. A connection icon will be added on the notification pannel.  

Step 3 : Setup your browser to use a proxy. Depending on the version of your Android OS, it's possible to define a http proxy in the advanced wifi settings menu (Not tested, available in Android 2.2). 

If you don't want to change the proxy each time (or have an older Android), it's perhaps better to install another browser that lets you specify a proxy.  

I tested it with Opera mobile ( Here is an article with some screenshots) :  

  • Enter about:config in the address bar 
  • Expand the proxy line  
  • Enter 127.0.0.1:8080 in the HTTP server and HTTPS server text box 
  • Click "Save" 

It may work with Firefox (not tested). I didn't find any information for proxy settings for skyfire 

Step 4 : Enjoy! enter any URL on your browser. Your firewall may detect that AndroidTool.exe is trying to access the internet. Give him the rights to access the proxy. 

In this screenshot, you can see the number of active connections , closed connections, total bytes transfered (to and from) 

I checked with an internet speed test. It's just a little bit slower. 

History 

May 2011 : First version 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author
Thierry Parent

728x90

댓글