Click here to Skip to main content
11,488,877 members (75,942 online)
Click here to Skip to main content

Android Usb Port Forwarding

, 26 Dec 2011 CPOL 996.8K 162.9K 138
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

Comments and Discussions

 
GeneralRe: Samsung S3 (not rooted), it worked! [modified] Pin
Calories3315-May-13 20:31
professionalCalories3315-May-13 20:31 
GeneralRe: Samsung S3 (not rooted), it worked! Pin
Kevin Jeremy19-May-13 22:10
memberKevin Jeremy19-May-13 22:10 
Questionnot connecting Pin
Nitin Soneji26-Mar-13 9:15
memberNitin Soneji26-Mar-13 9:15 
Questionreach upto step4 but? Pin
gauravmay25-Mar-13 1:45
membergauravmay25-Mar-13 1:45 
QuestionHelp Pin
popke9-Mar-13 8:35
memberpopke9-Mar-13 8:35 
Questionplease help Pin
sja0516-Feb-13 20:26
membersja0516-Feb-13 20:26 
QuestionSource Pin
eojjoe7-Feb-13 7:16
membereojjoe7-Feb-13 7:16 
AnswerRe: Source Pin
Thierry Parent7-Feb-13 21:15
memberThierry Parent7-Feb-13 21:15 
Questiontotal noob needs help Pin
Member 98041281-Feb-13 20:25
memberMember 98041281-Feb-13 20:25 
QuestionNot able to detect my device!! Pin
Member 970392321-Dec-12 5:18
memberMember 970392321-Dec-12 5:18 
AnswerRe: Not able to detect my device!! Pin
Thierry Parent21-Dec-12 6:30
mvpThierry Parent21-Dec-12 6:30 
Questionusb tunneling Pin
nikscan20-Dec-12 4:21
membernikscan20-Dec-12 4:21 
AnswerRe: usb tunneling Pin
Thierry Parent20-Dec-12 4:29
mvpThierry Parent20-Dec-12 4:29 
Questionmiddle part and opera part Pin
filippomper4-Dec-12 12:41
memberfilippomper4-Dec-12 12:41 
When I want to connect through PC it says, on android connected. But in Android tool on PC it says waiting for android, host status "not connected". What can it be?
And can you please explain me that part when I need to add configurations to it. I don't get it. Where to put it.
Thanks

P.S. I have LG optimus L3 android phone
QuestionPossible to support multiple devices? Pin
Hu Song2-Dec-12 23:25
memberHu Song2-Dec-12 23:25 
QuestionMP959 like MP-MAN 9.7 Pin
Stanislav.Petrek19-Nov-12 1:58
memberStanislav.Petrek19-Nov-12 1:58 
Questionhelp Pin
b4onlyme_110-Nov-12 6:26
memberb4onlyme_110-Nov-12 6:26 
Questionhaving some confusion Pin
b4onlyme_110-Nov-12 6:11
memberb4onlyme_110-Nov-12 6:11 
Questionalso if its not hard for u pls make avideo of this Pin
derickrk8-Nov-12 5:50
memberderickrk8-Nov-12 5:50 
Questionthe android device is not being detected in the android tool software Pin
derickrk8-Nov-12 5:48
memberderickrk8-Nov-12 5:48 
Questionmy android 2.3 while using reverse tethering isn't detected by windows part help me out Pin
Member 95668962-Nov-12 10:35
memberMember 95668962-Nov-12 10:35 
QuestionBrilliant work Pin
vvampirevv27-Oct-12 4:32
membervvampirevv27-Oct-12 4:32 
Questionhow to do it Pin
Rahul 242715-Oct-12 8:51
memberRahul 242715-Oct-12 8:51 
QuestionSet up with broadband modem Pin
Swift Jon6-Oct-12 4:15
memberSwift Jon6-Oct-12 4:15 
Questiondevice connected but "no device selected" message occurs Pin
ThomAce3-Oct-12 23:51
memberThomAce3-Oct-12 23:51 
QuestionGalaxy y not listed Pin
Thalapaneni Jaya Prakash Naidu19-Sep-12 21:53
memberThalapaneni Jaya Prakash Naidu19-Sep-12 21:53 
Questiongirl alert.. its not working for me! Pin
samcoode19-Sep-12 6:26
membersamcoode19-Sep-12 6:26 
QuestionCan we also use Google Play with this connection? Pin
paraglajder11-Sep-12 23:34
memberparaglajder11-Sep-12 23:34 
GeneralMy vote of 5 Pin
C++Kernel5-Sep-12 4:02
memberC++Kernel5-Sep-12 4:02 
QuestionNice article Pin
joaofsa31-Aug-12 5:35
memberjoaofsa31-Aug-12 5:35 
QuestionNreed Help setting up Opera via WAN Miniport Pin
Hisham Superb30-Aug-12 0:19
memberHisham Superb30-Aug-12 0:19 
AnswerRe: Nreed Help setting up Opera via WAN Miniport Pin
Thierry Parent30-Aug-12 8:21
mvpThierry Parent30-Aug-12 8:21 
GeneralMy vote of 5 Pin
pteols22-Aug-12 23:45
memberpteols22-Aug-12 23:45 
QuestionProblem with download links Pin
dlozanolu21-Aug-12 2:26
memberdlozanolu21-Aug-12 2:26 
QuestionThanks !!! Pin
Member 936314816-Aug-12 22:08
memberMember 936314816-Aug-12 22:08 
QuestionWon't connect. Pin
ChiefGanja14-Aug-12 14:06
memberChiefGanja14-Aug-12 14:06 
Questionhow to open the port on adbd of android Pin
hunt_20042-Aug-12 20:28
memberhunt_20042-Aug-12 20:28 
Question? Pin
Kshitij Bhardwaj28-Jul-12 5:15
memberKshitij Bhardwaj28-Jul-12 5:15 
GeneralDevice Connected But Status Unknown Pin
Xafar22-Jun-12 20:43
memberXafar22-Jun-12 20:43 
QuestionDoesnt pick up my device Pin
Dawiehuysamen12-Jun-12 2:23
memberDawiehuysamen12-Jun-12 2:23 
AnswerRe: Doesnt pick up my device Pin
Member 86015262-Jul-12 9:49
memberMember 86015262-Jul-12 9:49 
QuestionModify this code? Pin
Member 90727424-Jun-12 16:22
memberMember 90727424-Jun-12 16:22 
AnswerRe: Modify this code? Pin
Thierry Parent4-Jun-12 21:39
mvpThierry Parent4-Jun-12 21:39 
Generalre: this tool Pin
piyush61925-May-12 1:39
memberpiyush61925-May-12 1:39 
Questionaaaaaaaa Pin
siger1318-May-12 3:47
membersiger1318-May-12 3:47 
GeneralMy vote of 5 Pin
klaydze11-May-12 4:22
memberklaydze11-May-12 4:22 
Questionconnect android to Visual Basic Pin
rais_rg26-Apr-12 18:15
memberrais_rg26-Apr-12 18:15 
QuestionHow do i find out my android port and host server port? Pin
Member 882888516-Apr-12 20:47
memberMember 882888516-Apr-12 20:47 
AnswerRe: How do i find out my android port and host server port? Pin
Thierry Parent16-Apr-12 21:45
mvpThierry Parent16-Apr-12 21:45 
QuestionReverse tethering for non rooted android. Pin
archyys7716-Apr-12 5:09
memberarchyys7716-Apr-12 5:09 

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
Web01 | 2.8.150520.1 | Last Updated 26 Dec 2011
Article Copyright 2011 by Thierry Parent
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid