Click here to Skip to main content
11,572,389 members (47,950 online)
Click here to Skip to main content

Android Usb Port Forwarding

, 26 Dec 2011 CPOL 1M 164.9K 139
Rate this:
Please Sign up or sign in to vote.
This tool creates an USB tunnel between the android and the PC. The tunnel will forward communications to and from the host.

Download Windows part : AndroidTool.zip - 3.2 MB
Download Android part Tracetool_service.zip - 99.04 KB

(See article in Portuguese here)

Important Update :

For rooted phone, you can use my other program (not yet on codeproject) :

Android reverse tethering : http://forum.xda-developers.com/showthread.php?t=1371345 

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.

global.png

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 : Go to parameters / Applications / Development and check  "Usb debuging" 
  • 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)  
 config.png

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 

 httpProxy.png     

Sample configuration for a public internet proxy on port 8080 

httpProxy2.png

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 some Android, but not all). 

Normal Chrome browser

  • I didn't find a way to get it working. Forget about TransparentProxy, ProxyDroid or AsProxy. that require Root and don't work  

Opera mobile 

  • Enter opera:config in the address bar 
  • Expand the proxy line  
  • HTTP server : 127.0.0.1:8080  
  • HTTPS server : 127.0.0.1:8080  
  • Use HTTP : checked 
  • Use HTTPS : checked 
  • Click "Save" 

Firefox Mobile

  • Enter about:config in the address bar 
  • In the search filter (below address bar), enter "proxy"
  • Set network.proxy.http to 127.0.0.1 
  • Set network.proxy.http_port to 8080  
  • Set network.proxy.type to 1 (Manual). Default is 5 (system)  

Skyfire

  •  I didn't find a way to get it working. 

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. 

running.png 

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  

Decembre 2011 : For rooted phone, you can use my other program (not yet on codeproject) :

   Android reverse tethering : http://forum.xda-developers.com/showthread.php?t=1371345 


 

License

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

Share

About the Author

Thierry Parent
Architect
Belgium Belgium
No Biography provided

You may also be interested in...

Comments and Discussions

 
GeneralRe: How to find out what port my gateway is using? Pin
Thierry Parent15-Nov-11 20:36
memberThierry Parent15-Nov-11 20:36 
GeneralRe: How to find out what port my gateway is using? Pin
mnongkhlaw16-Nov-11 0:23
membermnongkhlaw16-Nov-11 0:23 
Questionandroid 1.5 Pin
Member 83733743-Nov-11 12:01
memberMember 83733743-Nov-11 12:01 
AnswerRe: android 1.5 Pin
Thierry Parent15-Nov-11 2:24
memberThierry Parent15-Nov-11 2:24 
QuestionThe New Project Pin
Member 832945018-Oct-11 5:37
memberMember 832945018-Oct-11 5:37 
QuestionRe: The New Project Pin
mnongkhlaw15-Nov-11 20:29
membermnongkhlaw15-Nov-11 20:29 
AnswerRe: The New Project Pin
Thierry Parent16-Nov-11 7:18
memberThierry Parent16-Nov-11 7:18 
GeneralRe: The New Project Pin
mnongkhlaw16-Nov-11 20:17
membermnongkhlaw16-Nov-11 20:17 
AnswerRe: The New Project Pin
Thierry Parent18-Nov-11 0:53
memberThierry Parent18-Nov-11 0:53 
GeneralMy vote of 4 Pin
Pravin Patil, Mumbai11-Oct-11 23:25
memberPravin Patil, Mumbai11-Oct-11 23:25 
QuestionUSB Tunnel won't connect Pin
Member 829611811-Oct-11 6:09
memberMember 829611811-Oct-11 6:09 
AnswerRe: USB Tunnel won't connect Pin
Thierry Parent11-Oct-11 21:02
memberThierry Parent11-Oct-11 21:02 
GeneralRe: USB Tunnel won't connect Pin
Member 829611814-Oct-11 3:42
memberMember 829611814-Oct-11 3:42 
GeneralRe: USB Tunnel won't connect Pin
Thierry Parent14-Oct-11 3:45
memberThierry Parent14-Oct-11 3:45 
Do you see the device when you enter "adb device" on command prompt ?
If not, it's probably a driver problem.
Thierry
GeneralRe: USB Tunnel won't connect Pin
Member 829611814-Oct-11 4:35
memberMember 829611814-Oct-11 4:35 
AnswerRe: USB Tunnel won't connect Pin
Member 829611817-Oct-11 7:16
memberMember 829611817-Oct-11 7:16 
GeneralRe: USB Tunnel won't connect Pin
Thierry Parent17-Oct-11 20:48
memberThierry Parent17-Oct-11 20:48 
GeneralRe: USB Tunnel won't connect Pin
Member 829611818-Oct-11 6:48
memberMember 829611818-Oct-11 6:48 
QuestionGlobal Setting Pin
Member 828087630-Sep-11 4:27
memberMember 828087630-Sep-11 4:27 
QuestionAnyway to get apps to access the net? Pin
Rahul Parekh20-Sep-11 7:26
memberRahul Parekh20-Sep-11 7:26 
AnswerRe: Anyway to get apps to access the net? Pin
Thierry Parent20-Sep-11 20:16
memberThierry Parent20-Sep-11 20:16 
GeneralRe: Anyway to get apps to access the net? Pin
Rahul Parekh21-Sep-11 4:37
memberRahul Parekh21-Sep-11 4:37 
GeneralRe: Anyway to get apps to access the net? Pin
Thierry Parent21-Sep-11 5:34
memberThierry Parent21-Sep-11 5:34 
GeneralRe: Anyway to get apps to access the net? Pin
Rahul Parekh21-Sep-11 5:38
memberRahul Parekh21-Sep-11 5:38 
GeneralRe: Anyway to get apps to access the net? Pin
Thierry Parent21-Sep-11 20:57
memberThierry Parent21-Sep-11 20:57 
GeneralRe: Anyway to get apps to access the net? Pin
onlinetimc3-Oct-11 22:11
memberonlinetimc3-Oct-11 22:11 
GeneralRe: Anyway to get apps to access the net? Pin
Thierry Parent5-Oct-11 21:06
memberThierry Parent5-Oct-11 21:06 
GeneralRe: Anyway to get apps to access the net? Pin
onlinetimc6-Oct-11 23:55
memberonlinetimc6-Oct-11 23:55 
GeneralMy vote of 5 Pin
Member 775740114-Sep-11 3:26
memberMember 775740114-Sep-11 3:26 
QuestionThe New "USB Reverse Tethering" project Pin
apex1234511-Sep-11 23:14
memberapex1234511-Sep-11 23:14 
AnswerRe: The New "USB Reverse Tethering" project Pin
Thierry Parent12-Sep-11 1:16
memberThierry Parent12-Sep-11 1:16 
QuestionADB.exe is outdated or something wrong with it Pin
apex1234511-Sep-11 23:09
memberapex1234511-Sep-11 23:09 
AnswerRe: ADB.exe is outdated or something wrong with it Pin
Thierry Parent12-Sep-11 1:35
memberThierry Parent12-Sep-11 1:35 
QuestionRe: ADB.exe is outdated or something wrong with it Pin
mnongkhlaw22-Sep-11 0:30
membermnongkhlaw22-Sep-11 0:30 
Generalusb tunnel connection closed by remote server Pin
subinkolady4-Sep-11 7:59
membersubinkolady4-Sep-11 7:59 
GeneralRe: usb tunnel connection closed by remote server Pin
apex1234511-Sep-11 23:05
memberapex1234511-Sep-11 23:05 
QuestionHTTP/1.0 404 Not Found Pin
zzeraciel3-Sep-11 8:38
memberzzeraciel3-Sep-11 8:38 
AnswerRe: HTTP/1.0 404 Not Found Pin
zzeraciel3-Sep-11 9:25
memberzzeraciel3-Sep-11 9:25 
QuestionHas anyone successfully used this with Samsung Galaxy S2? [modified] Pin
mnongkhlaw30-Aug-11 0:19
membermnongkhlaw30-Aug-11 0:19 
AnswerRe: Has anyone successfully used this with Samsung Galaxy S2? Pin
apex1234511-Sep-11 22:55
memberapex1234511-Sep-11 22:55 
GeneralRe: Has anyone successfully used this with Samsung Galaxy S2? Pin
mnongkhlaw11-Sep-11 23:38
membermnongkhlaw11-Sep-11 23:38 
GeneralRe: Has anyone successfully used this with Samsung Galaxy S2? Pin
Thierry Parent12-Sep-11 1:40
memberThierry Parent12-Sep-11 1:40 
GeneralRe: Has anyone successfully used this with Samsung Galaxy S2? Pin
mnongkhlaw12-Sep-11 18:05
membermnongkhlaw12-Sep-11 18:05 
QuestionUsb port forward + connectbot? Pin
ertenebra29-Aug-11 0:58
memberertenebra29-Aug-11 0:58 
AnswerRe: Usb port forward + connectbot? Pin
Thierry Parent29-Aug-11 2:00
memberThierry Parent29-Aug-11 2:00 
GeneralRe: Usb port forward + connectbot? Pin
ertenebra29-Aug-11 2:02
memberertenebra29-Aug-11 2:02 
QuestionUse this w/o using 2G/3G or WiFi connection Pin
Gnana Swaroop11-Aug-11 2:04
memberGnana Swaroop11-Aug-11 2:04 
AnswerRe: Use this w/o using 2G/3G or WiFi connection Pin
Thierry Parent11-Aug-11 7:52
memberThierry Parent11-Aug-11 7:52 
QuestionLinux Host Pin
finrod_20028-Aug-11 21:50
memberfinrod_20028-Aug-11 21:50 
AnswerRe: Linux Host Pin
Thierry Parent8-Aug-11 22:05
memberThierry Parent8-Aug-11 22:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150624.2 | Last Updated 26 Dec 2011
Article Copyright 2011 by Thierry Parent
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid