Internet Tethering over USB? Is that something that was added with 1.6 or is that Eclair functionality? I notice it is in the CyanogenMod latest builds.
How does it work in comparison to bluetooth or wifi tether?
Does it require root?
TIA
What do you mean work in comparison, it's wired and the others are wireless. Speeds shouldn't depend on connection.
If you install cyanogen's build, then you have root so it shouldn't matter as you have it already. There is an application wired tether for root users, name explains.
I don't think it is in the AOSP build, so it was added by him or whoever he gives credit to.
There are 2 different Tethers for root users
Wired - Means u gotta connect your usb to your computer
Wireless - This will create an Ad Hoc wireless connection to your computer (no cable required)
This was added by cyanogen and is not part of eclair
nephron said:
There are 2 different Tethers for root users
Wired - Means u gotta connect your usb to your computer
Wireless - This will create an Ad Hoc wireless connection to your computer (no cable required)
This was added by cyanogen and is not part of eclair
Click to expand...
Click to collapse
What I was originally asking I guess was if the Wired USB tethering was now standard issue in Android 1.6 or 2.0 and as such was available to non-root users. From your response, I understand that is incorrect, and that wired tethering via USB was added by CM in the CM builds and therefore implicitly requires root.
Thanks for clarifying that for me!
If you wanted a non rooted version, search the market -there are several that don't require root.
so...
how is this done exactly on cyanogens rom? i cant find anything about it after searching for about an hour...
mr_brain said:
how is this done exactly on cyanogens rom? i cant find anything about it after searching for about an hour...
Click to expand...
Click to collapse
Yeah me and some people on another thread figured it out......
But first things first you need Windows XP service pack 3 or Windows Vista or Windows 7... I dont know about Mac.....
but Windows Xp is different than Vista or 7 because you need to download HTC sync to get the drivers for your G1 to be reconized as a modem..... Do not mount your G1..... once you have HTC sync installed you do not need to run it..... but now when you connect your G1 just check the internet tethering box and it should work(unless I missed a step)...
OK With Vista and Windows 7 the drivers are preloaded into the OS s do NOT need to download HTC synce... You just need to connect your phone do NOT mount and check the tehtering box... it should work....
is there a certain version for the G1 that I need?
Reverse tether g1 to pc network over usb cable
My android os is CyanogenMod 4.2.14.1,
1.Enable "Settings\Wireless controls\Internet tethering"
2.Install HTC Remote NDIS based Device driver(View attachment 277122)
3.Set the HTC adapter as: IP:192.168.2.1, Mask:255.255.255.0
4.Set the PC ethercard as shared connection
5.Run these codes in terminal:
su
ifconfig usb0 192.168.2.2 netmask 255.255.255.0
busybox route delete default
iptables -F
iptables -F -t nat
busybox route add default gw 192.168.2.1
setprop net.dns1 8.8.8.8
setprop "net.gprs.http-proxy" ""
6.Now your g1 could open browser to view any web pages on the internet, and update apps in the Market.
for diyism
just wanted to say that
This works on Nexus One as well!
The routing stuff disuse posted, I mean.
The only problem is that I can't download stuff from the market yet. But hopefully I'll find a solution to this soon.
Thanks a lot! I've been looking for this for like a whole week.
I think I'll write an app which will just run this as a shell script.
thanks again!
XBOX PS3 Wii anyone????
can someone please tell us or provide a step-by-step on how to have gaming consoles tether the device's web connectivity...or in other words how to make my xbox 360 connect to the web by tethering my device's internet....PLEASE PLEASE...I SWEAR I BUY BEER...I BUY BEER !!!
Reverse tethering not working with Play Store
GuShPaNdA said:
This works on Nexus One as well!
The routing stuff disuse posted, I mean.
The only problem is that I can't download stuff from the market yet. But hopefully I'll find a solution to this soon.
Thanks a lot! I've been looking for this for like a whole week.
I think I'll write an app which will just run this as a shell script.
thanks again!
Click to expand...
Click to collapse
Sure, I've seen before two attempts of reverse tethering with this approach with the same problem: Play Store stays "Downloading" or "Waiting for network" but It doesn't work. I've tried also my own method with the same results: Play Store is not working.
I think this has something to do with the way Play Store app is testing for Internet conectivity. Since it doesn't know if you've got one, it doesn't let you download nothing.
Maybe there is some Android SDK API call to flag the system that Internet connection is up? Any other clue?
Related
Hi All,
I've made a program supporting all originally supported wifi protocols as well as WPA/WPA2 enterprise protocols. This program can be used to set up connection with wireless networks using enterprise protocols.
What you need to do is to select proper protocol/authentification methods. Provide certification files if you have them. You can put certs files anywhere in your SD card. Then click OK.
You need to disable your wifi and re-enable it. Root is required.
Please visit my blog for more updates: http://fredzhung.blogspot.com/
** THIS IS NOT WELL TESTED, But works for Purdue University. (WPA ENTERPRISE WITH THAWTE_PREMIUM_SERVIER certs.)**
[UPDATE MAY-11] 1.0.2 RELEASE
ADDED SUPPORT FOR AD-HOC!
Added support for memorizing all configurations.
Need some test.
[EDIT] v0.2 RELEASE.
fixed a bug connecting to open network.
added support for anonymous indentity in EAP
added help/about
added input validation
changed icon
If this Wifi Helper doesn't work with your company's/school's wifi settings, please provide me your wifi setup so I can figure out what's wrong.
There seem to be a bug that first time run will hang. Close the program when the "force close" window pops up. Then run it again. Add the program to superuser list when asked.
This seem to be a bug for all applications requiring root access in android 1.5. I tested with terminal emulator and it has the same bug as well. Something is wrong with superuser program.
The app is uploaded to Market. Have fun!
Using this to access wifi on campus
Hi
I am a novice at all this root stuff so my questions is straightforward
a) If i buy a G1 (not rooted etc) and install this application from the market, i should be able to access my campus wifi? This is one reason why I am still using the iphone (unlocked on tmobile).
b) Is this likely to work even after the 1.5/cupcake transition that seems to be imminent?
Thanks
ps I am at LSU and here are some of the wifi details for the campus:
http://grok.lsu.edu/Article.aspx?articleId=8198
Hi, if you buy a g1 from store, you need to root it first before using this app. totorials for rooting your phone can be found on the sticky threads.
After you root your phone and use this app, you should be able to connect to your campus wifi. This is the purpose of this app.
May 11: 1.0.2 is released. Available in market
Hey zhang!
Great work, but i am having problems getting the ad-hoc to work.
It's been setup on my laptop and i have tried w/WPA & open to no avail.
The phone does not seem to detect the network.
I'm running 1.5 JF ADP.
Any thoughts as to what i might be doing wrong?
And thanks for the ad-hoc capability, been waiting on that one
Sean
Hi Sean,
I've been doing experiments with adhoc, I am not 100% sure adhoc will work. I will keep trying.
Great, great, great job!
I'm gonna buy the pro one, just as a "thank you"..
It seems it won't even detect my adhoc network
Hi. I use the free version (will buy it if it actually works) but I can't seem to even detect my adhoc networh. I use the ICS on XP laptop. I setup an open network with no encryption for the test but the G1 doesn't detect it (it sets it up and says it's unavailable, thus allowing me only to "forget" it). Do I have to change anything else on my device (for example the tiwlan.ini) so my device actually shows those elusive adhoc networks. Has anyone actually succeeded to setup properly an adhoc connection on G1 ever with any kind of software or is it like the UFO - we hear it exists but we've never actually seen it?
I cna't get it to work on my university's WPA2 Enterprise with a 'GTE CyberTrust Global Root' certificate (with extention cer).
I'm using a Vodafone Magic
I am also having a problem with a WPA2 enterprise setup.
It is a eduroam network.
On my computer I have entered the following setup in wicd:
encryption: PEAP with TKIP/MSCHAPv2
identity: my username
password: my password
In the wifi list (in the android system menu) the eduroam network shows as "Not in range, remembered"
I have another problem with the app itself: "Modify configurations" does not work. This makes it a hassle to try different encryption settings.
I know the network also works with PEAP with GTC, but don't know how to set that up.
Where did this go? It's no longer on the market. I can't find it anywhere!
Yeah, I was looking for this app and can't seem to find it anywhere. It disappeared. Does anyone have the apk?
Boogy
Try WiFi Buddy...free and works great.
All you had to do was go to his site...
http://fredzhung.blogspot.com/2009/05/download-for-wifi-helper.html
My First Guide. Hope it Helps..
HOW TO REVERSE TETHER YOUR PHONE / INTERNET PASS THROUGH
Reverse Tethering / Internet Pass through is the method in which you can make your android phone use the internet connection of your computer without a WIFI and by using a usb cable. It is helpful for those people who don’t have a WIFI at their place and for those who don’t have a good internet plan for their mobile.
BASIC REQUIREMENTS
Rooted Phone With S-OFF
SuperUser [QR Code]
BusyBox [QR Code]
Terminal Emulator [QR Code]
Windows O.S. [I am using Win-7]
USB Cable for your phone
THE PROCESS
Connect Your Android Phone to your PC. Make sure you are rooted and have terminal emulator installed. Turn on USB Tethering from
SETTINGS -> WIRELESS AND NETWOKRS -> TETHERING AND PORTABLE HOTSPOT -> USB TETHERING.
Screen
Next you will get a new connection in your PC. Open Networking and Sharing Center from
CONTROL PANEL -> NETWORK AND SHARING CENTER
You get a scene in a similar manner.
Screen
Now There will be one connection which will be your Main Net Connection and the Other one will be your Android Phone’s Created Connection for tethering. Click on your main net connection i.e. the one you use for Connecting to net Local Area Connection(in my case).
You will get the following screen.
Screen
Now click on Properties.After this click on sharing and tick on Allow other network users to connect through this computer’s internet connection and click ok for any dialog box shown and click ok to come back to the main networking screen.
Screen
Now click on the new connection made by the android phone Local Area Connection 2 (in my case)
You will get the following screen
Screen
Click on properties. Then go to Internet Protocol version 4(TCP/IPv4) and click on properties.
Screen
Now You need to enter 192.168.2.1 in IP address and enter 255.255.255.0 in Subnet mask and keep remaining things empty.
Screen
PART ON THE PHONE
NOTE:- ALL CODES HAVE TO BE WRITTEN WITHOUT QUOTES
Open Android Terminal on the Phone and type "su". Provide it superuser permissions.
Screen
Now type “ifconfig usb0 192.168.2.2 netmask 255.255.255.0”
Screen
“busybox route delete default”
Screen
You may get an error here but it does not matter.
Now type “iptables –F –t nat”(* -F in caps is must)
Then type “busybox route add default gw 192.168.2.1”
Screen
“setprop net.dns1 8.8.8.8”
Next (setprop “net.gprs.http-proxy” “” ) [*Note :- here the code is written in bracket to avoid confusion.. The quotes(“”) are required.
Screen
CONGRATS.... YOU ARE DONE!!
RESULTS
Works on Android Browser.(FOR ME)
Works on Opera & Opera Mini.
Works on XDA Premium App.
DOES NOT Work on Android Market.(Finding a Solution... if anyone gets it working please tell)
You may need to repeat this process each time you connect the phone to PC.
Works even without a SIM inserted.
Nice guide
To enable the market click settings under the sharing tab and add a new service called market with the port number 5228.
how use other app for internet
No resolution
currently m using a wildfire and cannot switch on USB tethering until mobile network is connected followed all the steps but no luck
I am also a wildfire user. I did so many searching for reverse usb tethering, what I searched for were similar to the script of this thread. I follow all the steps but also not success.
I did do some searching, I just GUESS the main problem is the router at my home. My computer access the modem via router, maybe the router cannot give my WF a IP so my WF cannot access the internet? I dunno.
I didn't try access the internet with my computer connecting directly via modem without router since my home wire connection is so so so so complicated, but I believe that it will success. Would somebody try it and share your experience?
I think you can write a batch file for this. Using netsh and adb it would be easily done just from PC
thanks for the guide worked for me.
Problem though is that after i turned off the tethering and disconnected my phone from the pc then reconnect it again just to check if it works the 2nd time, if found that usb tethering is having an error and does not turn on.
question is how to disable this or how i disconnect my phone from pc the right way? well after restarting, tethering is again ok and
I did it on linux!
The configuration on the PC is next:
Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
ifconfig usb0 192.168.2.1 netmask 255.255.255.0
iptables -A POSTROUTING -t nat -s 192.168.2.1/24 -o wlan0 -j MASQUERADE
On the phone same az you did, but I had to edit
Code:
setprop net.dns1 8.8.8.8
to match my DNS server i.e.
Code:
setprop net.dns1 87.120.131.2
worked !!!!!!!!!!!!!
After about two months of searching I finally found this guide which makes it work. Thanks a lot! Surfing everything is fine but downloads just don't start (market or browser) I'm using G2x by the way so I guess this should work for most people.
meknb said:
Nice guide
To enable the market click settings under the sharing tab and add a new service called market with the port number 5228.
Click to expand...
Click to collapse
I did this which enabled me to browse the market. It won't download anything. I even forwarded the port on my broadband modem and the downloads don't start. Just keep saying "Starting downloading..."
How to make a script for apps like script manager so we do not have to keep typing the configs everytime we restart our phone?
URLs instead of QR Codes, please.
rahuliyer95 said:
[*]SuperUser [QR Code]
[*]BusyBox [QR Code]
[*]Terminal Emulator [QR Code]
Click to expand...
Click to collapse
Anyone with URLs to the above, please? I don't have a QR code scanner
mnongkhlaw said:
Anyone with URLs to the above, please? I don't have a QR code scanner
Click to expand...
Click to collapse
https://market.android.com/details?...wsMSwxLDEsImNvbS5ub3NodWZvdS5hbmRyb2lkLnN1Il0.
https://market.android.com/details?...t=W251bGwsMSwxLDEsInN0ZXJpY3Nvbi5idXN5Ym94Il0.
https://market.android.com/details?...251bGwsMSwxLDEsImphY2twYWwuYW5kcm9pZHRlcm0iXQ..
Thank you!
rahulparekh said:
https://market.android.com/details?...wsMSwxLDEsImNvbS5ub3NodWZvdS5hbmRyb2lkLnN1Il0.
https://market.android.com/details?...t=W251bGwsMSwxLDEsInN0ZXJpY3Nvbi5idXN5Ym94Il0.
https://market.android.com/details?...251bGwsMSwxLDEsImphY2twYWwuYW5kcm9pZHRlcm0iXQ..
Click to expand...
Click to collapse
Thanks, does it work with Market, email etc? Have you used it with Samsung Galaxy S2?
mnongkhlaw said:
Thanks, does it work with Market, email etc? Have you used it with Samsung Galaxy S2?
Click to expand...
Click to collapse
This method actually stopped working for me after I reflashed CM7 on my phone. (TMobile G2X). It doesn't work with market but I think ASProxy makes it work.
rahulparekh said:
It doesn't work with market but I think ASProxy makes it work.
Click to expand...
Click to collapse
What is ASProxy ?
method worked good all apps working...
i can browse through market also but when select download option downloading and freezes.. what could be problem ??
mnongkhlaw said:
What is ASProxy ?
Click to expand...
Click to collapse
It's a proxy app which supposedly allows all Google apps to work on reverse tethering and such. Search the market for it.
rahulparekh said:
It's a proxy app which supposedly allows all Google apps to work on reverse tethering and such. Search the market for it.
Click to expand...
Click to collapse
Do you mind a tutorial on how to get ASProxy to work?
mudkipstar said:
Do you mind a tutorial on how to get ASProxy to work?
Click to expand...
Click to collapse
I haven't had a chance to use the app as reverse tethering stopped working for me before I got the app.
Is there a way compile the JB source so USB tether is enabled?
I made the following modification to frameworks/base/core/res/res/values/config.xml but the Nexus 7 with JB doesn't bring up any USB network interface or show the tethering option in the menu
Code:
<!-- List of regexpressions describing the interface (if any) that represent tetherable
USB interfaces. If the device doesn't want to support tething over USB this should
be empty. An example would be "usb.*" -->
<string-array translatable="false" name="config_tether_usb_regexs">
<item>"usb0"</item>
</string-array>
Not to be 'that guy', but could you please add a question mark to the title of your thread? I came in here hoping for a solution, not a question
I asked a similar question http://forum.xda-developers.com/showthread.php?t=1822788
a 3rd-party app may be able to help, but the kernel apparently has to be compiled with CONFIG_NETFILTER/CONFIG_IP_NF_IPTABLES and/or RNDIS
espionage724 said:
I asked a similar question http://forum.xda-developers.com/showthread.php?t=1822788
a 3rd-party app may be able to help, but the kernel apparently has to be compiled with CONFIG_NETFILTER/CONFIG_IP_NF_IPTABLES and/or RNDIS
Click to expand...
Click to collapse
I tried using android-wired-tether with a custom kernel that includes netfilter, iptables, and rndis. This still did not work since the application tries to access usb0 directly and the Nexus 7 never creates that interface even with a customized config.xml
I was able to get the USB tethering, Wi-Fi hotspot, and Bluetooth tethering options to come up in the menu on the Nexus 7 using the attached overlay placed in device/asus/grouper/overlay/frameworks/base/core/res/res/values/config.xml
The Wi-Fi hotspot and Bluetooth tethering options appear to work.
However, the USB tethering option unchecks itself after a second when I try to activate it.
I get the following error in logcat:
Code:
09-13 13:10:41.820: E/UsbDeviceManager(331): Failed to switch USB config to rndis,adb
I am happy to announce I got native USB tethering working on the Nexus 7
I had to make the changes to the config.xml as shown in the previous post and also had to modify out/target/product/grouper/root/init.usb.rc by adding the following
Code:
on property:sys.usb.config=rndis
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 18d1
write /sys/class/android_usb/android0/idProduct 4e23
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/bDeviceClass 224
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=rndis,adb
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 18d1
write /sys/class/android_usb/android0/idProduct 4e24
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/bDeviceClass 224
write /sys/class/android_usb/android0/enable 1
start adbd
setprop sys.usb.state ${sys.usb.config}
I'm also using a modified tegra kernel with RNDIS options activated...not sure if this is required (I'm assuming it is). I will try the stock kernel later.
That is good news indeed
Props to You!
cbdonohue said:
I was able to get the USB tethering, Wi-Fi hotspot, and Bluetooth tethering options to come up in the menu on the Nexus 7 using the attached overlay placed in device/asus/grouper/overlay/frameworks/base/core/res/res/values/config.xml
The Wi-Fi hotspot and Bluetooth tethering options appear to work.
However, the USB tethering option unchecks itself after a second when I try to activate it.
I get the following error in logcat:
Code:
09-13 13:10:41.820: E/UsbDeviceManager(331): Failed to switch USB config to rndis,adb
Click to expand...
Click to collapse
Nice work and quick as well, I do like those overlays, there is plenty of nice tweaks to be had out of them if folks are willing to put the effort in.
I built my own overlay earlier on after you planted the seed and was quite surprised to get Wifi-Hotspot for free. It does work, well my HTC Sensation connects to it, which is quite amusing as Cm10 on the sensation doesn't have a working WifiHotspot :laugh: I think a bit of cross device hacking is in order there
cbdonohue said:
I'm also using a modified tegra kernel with RNDIS options activated...not sure if this is required (I'm assuming it is). I will try the stock kernel later.
Click to expand...
Click to collapse
I think this is my missing link, I was going to have a proper look at some point and you've saved me a job there, I'll build myself a fresh kernel now and see if it is the case.
:good:
So does this require both a modified (before compile) Kernel and ROM?
espionage724 said:
So does this require both a modified (before compile) Kernel and ROM?
Click to expand...
Click to collapse
After talking with trevd, I am pretty confident you need to modify the .config created by "make tegra3_android_defconfig" so the RNDIS driver is in the kernel. I won't be able to compare the stock kernel to my modified one until the weekend (I only have one Nexus 7 and have to do other testing with it). The .config file I used for my modified tegra kernel is attached.
So yes, modify the kernel and Jelly Bean source. I can certainly help anyone if they run into trouble.
I plan on putting up flashable images when I can and submitting a patch to cyanogen.
cbdonohue said:
I was able to get the USB tethering, Wi-Fi hotspot, and Bluetooth tethering options to come up in the menu on the Nexus 7 using the attached overlay placed in device/asus/grouper/overlay/frameworks/base/core/res/res/values/config.xml
The Wi-Fi hotspot and Bluetooth tethering options appear to work.
However, the USB tethering option unchecks itself after a second when I try to activate it.
I get the following error in logcat:
Code:
09-13 13:10:41.820: E/UsbDeviceManager(331): Failed to switch USB config to rndis,adb
Click to expand...
Click to collapse
Would love to use your overlay.
Where exactly do I find the above mentioned path?
When I connect Nexus 7 to my Mac and see the file structure, it is missing the device/asus/grouper/overlay/frameworks/base/core/res/res/values/config.xml
retfeg said:
Would love to use your overlay.
Where exactly do I find the above mentioned path?
When I connect Nexus 7 to my Mac and see the file structure, it is missing the device/asus/grouper/overlay/frameworks/base/core/res/res/values/config.xml
Click to expand...
Click to collapse
You need to modify the files in the Jelly Bean source code and recompile the operating system.
@cbdonohue:
Hey! Do you think you could upload your kernel/framework files to use in the mean time?
I'm very curious and I have asked this so many times and no one has answered me.
Why would you want to tether your device? your device cant and does note generate its own Mobile internet service like a 3G/4G device. its wifi only so why would you want to share your devices wireless connectivity?
the only thing I can think of is if you have a desktop or laptop that does NOT have a wireless card and you want to use your Nexus 7 as a wireless card essentially and then plugging it in via USB to your desktop/laptop?
what other reason could you have for wanting to share your devices wireless connectivity?
nextelbuddy said:
I'm very curious and I have asked this so many times and no one has answered me.
Why would you want to tether your device? your device cant and does note generate its own Mobile internet service like a 3G/4G device. its wifi only so why would you want to share your devices wireless connectivity?
the only thing I can think of is if you have a desktop or laptop that does NOT have a wireless card and you want to use your Nexus 7 as a wireless card essentially and then plugging it in via USB to your desktop/laptop?
what other reason could you have for wanting to share your devices wireless connectivity?
Click to expand...
Click to collapse
You can reverse-tether a device in order to get connectivity from your PC. This is what I'm looking to accomplish with my device while I'm at work so I can access the company intranet.
ObsidianX said:
You can reverse-tether a device in order to get connectivity from your PC. This is what I'm looking to accomplish with my device while I'm at work so I can access the company intranet.
Click to expand...
Click to collapse
^ This.
ObsidianX said:
@cbdonohue:
Hey! Do you think you could upload your kernel/framework files to use in the mean time?
Click to expand...
Click to collapse
1. Download the tegra kernel branch android-tegra3-grouper-3.1-jb-fr2 and compile using the attached defconfig. (This enables the RNDIS driver)
2. Download grouper branch android-4.1.1_r1.1 and copy the compiled tegra kernel into it.
3. Modify the following grouper file with the attached config.xml (This allows the 'Tether to USB' option to come up in the settings')
device/asus/grouper/overlay/frameworks/base/core/res/res/values/config.xml
4. Compile grouper
5. Modify the following file with the attached init.usb.rc (This allows the OS to enable RNDIS USB tethering)
out/target/product/grouper/root/init.usb.rc
6. Flash to device.
At some point in the future I can make a flashable image or patch that will make this easier. In the mean time these steps should do it. Let me know if you have any issues.
nextelbuddy said:
I'm very curious and I have asked this so many times and no one has answered me.
Why would you want to tether your device? your device cant and does note generate its own Mobile internet service like a 3G/4G device. its wifi only so why would you want to share your devices wireless connectivity?
the only thing I can think of is if you have a desktop or laptop that does NOT have a wireless card and you want to use your Nexus 7 as a wireless card essentially and then plugging it in via USB to your desktop/laptop?
what other reason could you have for wanting to share your devices wireless connectivity?
Click to expand...
Click to collapse
One reason would be If you wanted to communicate between a PC and an Android device without being wireless. This could be to hide the connection or reduce the impact of RF interference. Not all applications need internet access...it might be just to send data between two end points.
USB interface and addressing specifics
For those of you who are interested...
If the Nexus 7 is acting as a USB device you can turn USB tethering on from the settings menu. The Android device automatically assigns its USB interface a hard coded IP address and starts DHCP server to hand out an address to the USB host at the other end.
If you want to change the IP address that the Android assigns itself you can modifiy the USB_NEAR_IFACE_ADDR constant in following file:
frameworks/base/services/java/com/android/server/connectivity/Tethering.java
If you want to disable the DHCP server, you can simply remove the address space you are using from the mDhcpRange array in the same file.
If the Nexus 7 is acting as a USB host (using USB OTG) then you must manually bring up the USB interface (ifconfig rndis0 x.x.x.x) since the USB menu settings will not do anything.
As an aside, am I the only one surprised to find hard coded IP addresses deep in the Android code?! haha
I've found some other gems like "shoud not get here" lines and c/c++ goto statements.
Hey folks,
I took cbdonohue's modifications and built them into CM10 and it works like a charm! I took the liberty of uploading the ZIP to dev-host:
http://d-h.st/KIr
All credit goes to cbdonohue for finding and creating the modification. I just built it
After a few evenings of searching, reading and testing, I finally found a solution for setting up a reverse-tether connection between my Droid 3 and my Ubuntu box over a USB cable, which I can use to download apps and app updates from Google Play without eating up my mobile data credit. And since it seems to me that complete and clear explanations of how to do this with USB and Ubuntu are not available anywhere, I want to detail here all the steps of my connection setup process, in a way that will hopefully be accessible to most users of Android and Ubuntu. So here goes:
Prerequisites:
- a PC that is connected to the Internet and running Ubuntu, where you have root access and a free USB port
- a rooted Android device (in my case the Motorola Droid 3) with a SIM and an active mobile subscription
- a USB cable (I have the one that came with the phone).
Setup:
#1. Disconnect your Android device's data connection from your mobile carrier by touching the corresponding icon in the notifications tray (2 parallel vertical arrows pointing in opposite directions) or by switching your phone to Airplane Mode.
#2. Launch the Terminal emulator app on your Android device and enter this command:
ifconfig
You should get a response that shows only one network interface, named "lo" or "lo0" or something like that, with an information field that says "inet addr:127.0.0.1". This is the local loopback connection. We will not be using it - just know that it's always there in responses to "ifconfig" and ignore it from now on.
#3. Re-enable your Android device's data connection by reversing what you did at #1. Go back to the Terminal and do another
ifconfig
This time, in addition to the "lo" interface, you should see another interface that is used to communicate with the Internet through your mobile carrier. For me this interface is called "ppp0"; you may have something else, but just remember what it is because you will have to use it later wherever you see me use ppp0 in the commands below.
#4. Now connect your Android device to your Ubuntu PC using the USB cable. Access the USB connection notification in your Android notifications tray and select "PC Mode" as your USB Mode. (If you don't have this option, then I don't know what to say, you will probably have to try them all, but in that case I wouldn't start with the "Mass storage" option - that's the least likely one to work for this.)
#5. Still on the Android, open Settings -> Wireless & networks -> Tethering & Mobile Hotspot and enable "USB tethering". You should get a second, green USB icon on your status bar after tethering is enabled.
#6. Go back to the Terminal app on your Android device and do yet another
ifconfig
This time you should receive information for 3 network interfaces: in addition to "lo" and "ppp0" you should now see a new interface that corresponds to your USB. For me it's called "gether0"; remember what yours is and use it wherever I use gether0 in the commands below.
Also, look at the "inet addr:" specification of your gether0 interface and remember this IP address because we will need it later. (My USB tether interface always gets the same IP address - 192.168.42.129 - so this is what I will be using in my example commands below.)
#7. Now let's look at the PC's network interfaces. Open a terminal emulator (I use Ctrl-Alt-T to do this; depending on what launchers, shortcuts or desktop environments you have, you may need to find it in a menu or do something else to get to it) and type
ifconfig
This response depends a lot on how your PC is set up, but generally I'd expect to see at least a "lo" (local loopback) interface, a "usb0" interface, one or more "eth0", "eth1" etc. interfaces and maybe a "ppp0" interface. The "ppp0" and "eth0" type interfaces will be for your PC's Internet connection and the "usb0" interface will correspond to the USB cable connecting you to the Android device. If you have a "ppp0", that's probably the one you should use in all setup commands to be run on the PC where I will use ppp0. Otherwise if you only have "lo", "usb0" and "eth0", your PC's Internet is probably on "eth0", so use that one in place of my ppp0 in commands run on the PC. (If you have any other combinations without a "ppp0", I don't know what to suggest except try them all one by one, everything you have besides "lo" and "usb0".)
#8. Back to the Android device. What we want here is for the ppp0 interface to remain enabled - because that's the only way the app store will agree to download any apps - but all our Internet communication to actually go through the gether0 interface, i.e. through the USB tether. To do this, we need to change the default route Android apps use to send data, namely to delete the default route that points to ppp0 and add a new default route that points to gether0 and that uses as a gateway the IP address of the Ubuntu PC (an address we will set up on the PC at the end of this process). So run these commands in the Terminal on the Android:
su
route del default
route add default gw 192.168.42.1 dev gether0
setprop net.dns1 8.8.8.8
Notice that the gateway IP address we will be using is made up of the first 3 numbers from our USB tether interface's IP from step #6, followed by a ".1" instead of whatever the 4th group was in the original IP.
#9. On the PC we want to set up standard Internet connection sharing between usb0 and ppp0 according to the instructions from the Ubuntu manual, so we will run these commands in the terminal window:
sudo su -
(enter your password here to get root access and then do 5 more lines)
iptables -A FORWARD -o ppp0 -i usb0 -s 192.168.42.0/24 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -F POSTROUTING
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
Here again you can see we're using the first 3 numbers from the USB tether interface's IP, but adding a ".0" and a "/24" at the end to specify an entire class of IPs we're going to accept packets from over the USB, a class that includes our Android's actual IP, 192.168.42.129. (We could probably just use that single IP without a "/24", but whatever, this class stuff is usually the way it's done.)
#10. Finally, we will set our PC's usb0 interface IP to the gateway IP we already told the Android to send everything to, i.e. 192.168.42.1, after which we need to quickly check that the connection is working and jump right into Google Play to download some apps. I say "quickly" because in my case, for whatever reason, after I set the gateway IP on the PC I can only leave the connection unused for about 1 minute before it drops on its own. So don't wait too much after #10.1 to do the rest:
#10.1. Enter this into your PC's terminal:
ip addr add 192.168.42.1/24 dev usb0
#10.2. Check that the connection is up by entering this into your Android's terminal first:
ping -c 3 google.com
If you get 3 responses from Google, you're all set to launch Google Play and download some apps:victory:. If there's no response, go back to #10.1 and try again.
Another indication that the PC has dropped the connection is that you get a notification popup on the PC that says "Wired network/ Disconnected". That tells you you need to jump back to #10.1 to get the USB link working again.
Also, you will know you need to do this again if you find Google Play is suddenly refusing to load apps or pages even though it was loading them before - you probably waited too long between clicks and allowed the connection to drop.
#11. To reset all the connections to normal when you're done, make sure to
#11.A. Go to Settings -> Wireless & networks -> Tethering & Mobile Hotspot and disable "USB tethering" before you unplug the USB cable from either device, otherwise the gether0 interface may remain active and interfere with your ability to get back your data link to your mobile carrier.
#11.B. Do steps #1 and #3 again to get your Android to automatically re-establish the proper settings for the link to your mobile carrier.
Final remarks:
- In order to streamline this process, especially steps #8-#10, you should probably put these commands and your specific interface names and IP addresses in some scripts - one on the PC, one on the Android device - that you can then launch more easily. I'm a newbie at both Ubuntu and Android, so I have to do some more searching to figure out how to do this properly.
- Keeping the connection up even if you're idle - e.g. while reading app descriptions and deciding what to download - is probably a matter of sending some dummy packets periodically through the USB, which would probably involve another script running in the background - again something I haven't taken the time to figure out how to set up yet.
- Anytime you get paranoid about whether the apps are being downloaded through the USB cable or your mobile data plan, go to your Android terminal and check whether your default network route is still pointing to your gateway PC by running:
route
This will show you all the routes that are configured on your Android. The last line in the table should say "default", then "192.168.42.1" and end with "gether0". This means the data is still going through the USB and not eating up your mobile data credit.
Enjoy!
It seems to work, but I'm still not sure whether my phone uses my computer's internet connection or my 3G. Upon executing:
Code:
busybox route
I get a lot of lines instead of just "192.168.42.1" ended with "rndis0" (this is how its named on my device) though this "192.168.42.1" exists.
leledumbo said:
It seems to work, but I'm still not sure whether my phone uses my computer's internet connection or my 3G.
Click to expand...
Click to collapse
The simple way I confirm it is by looking at the 3G icon at the top: during normal usage the two arrows in the icon light up depending on whether I'm transmitting or receiving or both; when I'm reverse-tethered they never light up at all.
I get a lot of lines instead of just "192.168.42.1" ended with "rndis0" (this is how its named on my device) though this "192.168.42.1" exists.
Click to expand...
Click to collapse
Well, in principle you should only need to care about the "default" line, but if by any chance you have some rule in that table that specifies a non-default route for exactly the websites you're trying to access in all this and that rule happens to specify a different interface than "rndis0", then yes - you might be using your mobile data plan after all. But I wouldn't bet on it. I have a few routes on there, but I think they're just related to services my carrier is offering at some specific IPs it has.
If you can't confirm the 3G is being bypassed by looking at the icon and if you can't spare the traffic to do a direct consumption test (query how much traffic is left/spent, use some more traffic through this setup, query again and compare), then the only other way to make sure that I can think of is to clean up the whole routing table ("route del" everything) and leave only the "default" rule from the instructions above. Then there really won't be any other path for your network packets to take but through the USB. But then you have to hope the routing table will get rebuilt as it was after you reset everything. Or you could just write down all the rules you had before so you can reconfigure them if they don't get re-created automatically at reset.
In fact - what am I talking about? - there's another way you can make sure your Android is really trying to go through the USB to get to the Internet: when you do step #10.1 on the PC just set up a wrong gateway IP, for example 192.1.1.1. If your Android fails to open any webpages or the app store and then if you do #10.1 properly it starts working (again), then it's clear that it's trying to go through the USB cable and isn't using any alternate route.
Weird, the method doesn't work anymore for the subsequent trials. I'll try rebooting the phone.
Works for Windows too
I mixed the instructions found in this thread with another thread here in xda and it worked well under Windows 7.
Thank you for the excelent guide!
donjoe0 said:
After a few evenings of searching, reading and testing, I finally found a solution for setting up a reverse-tether connection between my Droid 3 and my Ubuntu box over a USB cable, which I can use to download apps and app updates from Google Play without eating up my mobile data credit. And since it seems to me that complete and clear explanations of how to do this with USB and Ubuntu are not available anywhere, I want to detail here all the steps of my connection setup process, in a way that will hopefully be accessible to most users of Android and Ubuntu. So here goes:
[guide goes here, edited quote]
Enjoy!
Click to expand...
Click to collapse
So I tried everything on a LG Phoenix running Kitkat and no go. All the commands go through except the ping command. Any suggestions?
AndrMatr said:
So I tried everything on a LG Phoenix running Kitkat and no go. All the commands go through except the ping command. Any suggestions?
Click to expand...
Click to collapse
All I can say is this method continued to work for me pretty much the same as described when I switched to KitKat on an ASUS Padfone 2 with two minor exceptions:
- busybox was no longer set up to be invoked automatically on this other custom ROM so I had to prefix some commands with "busybox " (e.g. the "route" commands)
- my USB tether connection is now named "rndis0" instead of "gether0"; I had to fiddle around a bit with the "netcfg" command to figure that out.
Hi
My phone lumia 930 so windows 8.1
I have seen on US market is Putty, unfortunately cannot download it because stay in uk
I tried to change region for US in phone but doesn't work
Anyone have idea how to install apps from other country app store or know working ssh client which will connect with my qnap nas server?
There's lots of WP SSH clients. I haven't tested them all on 8.1, but they should work. Have you considered just checking the store for "ssh"?
The one I use is called "The SSH Client". The free version works quite well, although there's a paid version with more features.
Yeah, there is few of them and some working but in lan only.
If I'm trying get connected from outside my lan will revive only : This port is not supported by ssh.
Port is properly redirected but different as standard.
Any way it shouldn't be a problem I have putty on my windows rt and connecting without any problems.
wojtas29 said:
Yeah, there is few of them and some working but in lan only.
If I'm trying get connected from outside my lan will revive only : This port is not supported by ssh.
Port is properly redirected but different as standard.
Any way it shouldn't be a problem I have putty on my windows rt and connecting without any problems.
Click to expand...
Click to collapse
Well if you're familiar with SSH then you must of heard about PUTTY , so i'm happy to inform you that there is a working WP8 version of PUTTY, for now it's in closed beta, but you can be part of it, just be sure to drop the developer an email( the default MS account on the device ) for beta access at [email protected]
Can confirm eventhou it's still in beta it's working like a charm.
PROOF : PUTTY
Any decent SSH client, including the one I recommended, supports custom ports... but hey, that PuTTY looks pretty good too!
GoodDayToDie said:
Any decent SSH client, including the one I recommended, supports custom ports... but hey, that PuTTY looks pretty good too!
Click to expand...
Click to collapse
Well it's more than an ssh client, it supports also raw, telnet and rlogin connection types.
VSparxx said:
Well it's more than an ssh client, it supports also raw, telnet and rlogin connection types.
Click to expand...
Click to collapse
Indeed it is. I'm the developer behind the PuTTY port, glad to see it getting some love. Tunnelling is supported in the latest version but still has a few bugs to iron out and I am also working on support for serial over bluetooth too
noggin182 said:
Indeed it is. I'm the developer behind the PuTTY port, glad to see it getting some love. Tunnelling is supported in the latest version but still has a few bugs to iron out and I am also working on support for serial over bluetooth too
Click to expand...
Click to collapse
Hi...great to see some input from the dev., I'm an system admin and rely heavily on your app. so thank you for bringing this awesome tool to WP.
Also maybe it's time to make the app public, as I don't have any problems with it, so general everyone should be fine with it.
Many thanks again.
VSparxx said:
Also maybe it's time to make the app public, as I don't have any problems with it, so general everyone should be fine with it.
Click to expand...
Click to collapse
Yup, there are a few things that need sorting out. For some people it occasionally crashes when they connect and it's related to loading the sound files used for the system beep and the keyboard clicks. I've not been able to get to the bottom of that yet but the next minor update has some improved crash reporting which should help.
There is also a few people experiencing some problems whilst tunnelling.
I can't reproduce either of this bugs though in the emulator or any of my phones. Once they're sorted though I should be taking it public
noggin182 said:
Yup, there are a few things that need sorting out. For some people it occasionally crashes when they connect and it's related to loading the sound files used for the system beep and the keyboard clicks. I've not been able to get to the bottom of that yet but the next minor update has some improved crash reporting which should help.
There is also a few people experiencing some problems whilst tunnelling.
I can't reproduce either of this bugs though in the emulator or any of my phones. Once they're sorted though I should be taking it public
Click to expand...
Click to collapse
Neither of those affected me, maybe poor net signal is the culprit of tunnelling errors.
Can I really view internal system files using SHSH client on WP? I own Lumia 920.
No, you would need an SSH *server* for that. I don't have one of those (although it should be possible to write or port one), but an FTP / Telnet server is pretty easy.
Alternatively, you can use the Webserver app in my signature.
Note that in either case, this will let you browse only small parts of the file system (the Windows directory and the application's own directories). The AllCapabilities version of the webserver has more access (it can see other apps, your documents and media folders, OEM folders, and the entire SD card), but is still restricted. You need capability-unlock (usually means a Samsung phone) to install the AppCaps version of the app.