Internet on G1 via USB cable (Reverse Tethering)? - G1 Android Development

Would it be possible to get Internet on the device, through PC, instead of Internet on PC, through device?

Is there any way to do this its very important as I live in India, there is no 3g and edge is very slow so can't download themes, updates directly on my g1

Sure there is a way, WiFi
No you cannot give the phone internet via USB

Can you be more specific on how to do it with WiFi? And without a router
I tried using the AdHoc connection created for the Tethering (Internet from G1's 3G/EDGE to PC), but with no luck.
The laptop and phone can ping each other, I have done all the necessary steps to share my LAN and WiFi connection, remounted the /system partition as rw, edited /etc/resolv.conf (/etc is in fact on /system/etc and if not remounted as rw you cannot edit /etc/resolv.conf), added the IP of the laptop, but then I have some trouble adding default route to it. No matter what settings I try "route add ...", they change nothing...
No internet, no ping.

Did you set the gateway?

You have the SDcard that you can use to move files to the phone, I don't see any need to download directly to the sdcard, especially if you have the phone hooked up via USB anyways.
Kind of pointless no>?

@ncoop23
but then I had some trouble adding default route to it. No matter what settings I try "route add ...", they change nothing...
Click to expand...
Click to collapse
So, I have tried at least.

How do you do it without Wi-Fi, over the USB cable? I can't set up a Wi-Fi node at work or the network security guys will send a SWAT team after me.

If you have access to a computer that has internet, and you have your usb cable, why don't you just download whatever theme/update to the computer, then plug in the usb cable and transfer it to your phone?

You have a PC or laptop with access to the internet. Why not just download stuff on to the PC/Laptop and move onto SD card.
If you want it to get on the market or watch youtube to test it out etc then join the laptop/PC's connection. Simple.

There is no solution for getting internet from laptop to the phone....
I wonder that with technology improving at such a fast pace, why any developer at corporations or independently hasnt thought about it yet. Any app, gadget or software providing a solution for this problem will sell like a hot cake especially in developing countries like south asia, middle east and africa.

Brock Samson said:
If you have access to a computer that has internet, and you have your usb cable, why don't you just download whatever theme/update to the computer, then plug in the usb cable and transfer it to your phone?
Click to expand...
Click to collapse
But how do I sync my Gmail and Contacts without a Wi-Fi or data connection?
dilwaladoctor said:
There is no solution for getting internet from laptop to the phone....
Click to expand...
Click to collapse
Are you sure? There is a solution for getting internet from phone to laptop over USB, so why not from laptop to phone? This blog post claims it can be done, but I haven't ever seen it working: http://blog.mycila.com/2010/06/reverse-usb-tethering-with-android-22.html
I wonder that with technology improving at such a fast pace, why any developer at corporations or independently hasnt thought about it yet. Any app, gadget or software providing a solution for this problem will sell like a hot cake especially in developing countries like south asia, middle east and africa.
Click to expand...
Click to collapse
This isn't a matter of "technology improving". Other phones already have it. Windows Mobile has had it for years.

dilwaladoctor said:
There is no solution for getting internet from laptop to the phone....
Click to expand...
Click to collapse
You have no idea what you're talking about.
http://forum.xda-developers.com/showpost.php?p=5242264&postcount=17

I have know idea if this will work or not, but I have found this on a few different forum all posted by Diyism, so if it does work he deserves all the credit.
Code:
My android os is CyanogenMod 4.2.14.1,
1.Enable "Settings\Wireless controls\Internet tethering"
2.Install HTC Remote NDIS based Device driver([url]http://forum.xda-developers.com/attachment.php?attachmentid=277122&d=1265356413[/url])
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.

highlandsun said:
You have no idea what you're talking about.
http://forum.xda-developers.com/showpost.php?p=5242264&postcount=17
Click to expand...
Click to collapse
Those instructions are only for a Linux computer, though?

I have used the setups as Brock Samson has indicated and it works for me.

I was asking the same question one year ago and I think I've posted somewhere a similar method to Brock Samson's, so it will definitely work.
In fact it will be less hussle if you don't enable internet tethering in settings and just bring usb0 up using ifconfig. You must set a correct IP address and netmask before the port is up though. Otherwise the driver on the PC end will freak out.
Generally Android never uses /etc/resolv.conf. Only console programs originated from Linux use it. DNS server must be set through setprop and has to be set everytime network status changes (e.g. mobile data network reconnect, etc).
Some programs will also use Android API to detect network availability and will back out if neither mobile data nor Wi-Fi is connected, so make sure you don't turn both of them off.

http://forum.xda-developers.com/showthread.php?t=793102

Related

Connect G1 to ad hoc or usb to use pc internet

Hello. I have searched the forums but can't find a solution that works for me.
I need to connect my g1 to my laptop Wi-fi connection or at least via USB using adb shell. Can someone help me. I live in a country with very expensive 3g
data and cannot afford downloading apps. Any help will be appreciated.
I have rooted G1 with JF rc33
Why not get a wireless router?
/Mats
for example at work...
Edit : Nvm just reread ur post
Just get a wireless router or use the ad hoc thing for laptops, google search it
http://www.wi-fiplanet.com/tutorials/article.php/1451421
Пробвай това: http://junefabrics.com/android/index.php
Try this: http://junefabrics.com/android/index.php
;-)
Thanks
Well, getting a wireless router just to connect my G1 from time to time seems like a waste of money to me.I have read some articles about G1 and ad hoc networks and it seems that it is not possible at this moment to connect the device to a laptop. Actually I used to connect a PPC this way but the G1 won't even detect the ad hoc network i create. Well, if there isn't any other solution I guess the wireless router will be the last resort then. About PdaNET- i think it does just the opposite - it connects your PC to the internet using your phone. Isn't there any way to reverse teether using adb shell and usb cable?
Come on, is it really impossible to reverse tether using adb shell fo rexample, cant anyone with more knowledge give a solution please.
I was looking for something else and came across this post. I decided, even though it's ANCIENT, that someone might want to do the same, so I went to Google and searched for "Reverse tether G1 android". Within 5 minutes I had the answer.
http://androidcommunity.com/forums/291099-post8.html
It does require you to do a little command-line work on the G1 itself (or through ADB on the command prompt of the computer) but it appears it can be done.
HIH.
try this
Close any program that uses internet on your PC, connect your phone, turn on USB tethering. You would see a new virtual network adapter in your PC, enable internet sharing on that adapter as described in this article(hxxp://support.microsoft.com/kb/306126). The adapter's ip address would change to 192.168.0.1 with netmask of 255.255.255.0.
Then input the following codes line by line in your phone's terminal, you could download GScript(hxxp://code.google.com/p/gscript-android/) to do the job or just save it as a .sh file with 755 permission and run it when you want.
Code:
busybox ifconfig usb0 192.168.0.2 netmask 255.255.255.0
busybox route delete default
iptables -F
iptables -F -t nat
busybox route add default gw 192.168.0.1
setprop net.dns1 8.8.8.8
setprop "net.gprs.http-proxy" ""
You would need to keep your GPRS/Edge connection on to trick programs into thinking that you have an internet connection, but all your phone's data is now routed thru your PC. Confirm this by checking if the GPRS/Edge icon on the top has those up and down arrows in it.
And to disable this, you simply turn off USB tethering and restart your GPRS/Edge connection.
OMG I just replied a post of 23rd March 2009, 09:13 PM! Don't think axlastro is needing this anymore. lol
@test1943
nice, I have been looking for this but...
how do I disable this properly?
To "restart your GPRS/Edge connection" I put my phone into airplane mode and then back to normal but it still couldn't connect to the network?? so I just rebooted and now that works.
But now my phone isn't recognized by my pc when I plug in the usb??
Any help.
oops let me take that all back. reboot, re-plugin and pc finds my phone again. tested again and it works as described.
Sweet Thanks
can this be done using root explorer?
I don't think so.
I just used gscript lite (free on the market)
I saved the stuff from test1943 in notepad as USBTether.sh, copied to my sdcard into the gscript folder.
Open gscript, push menu > add script. Click load file and select the USBTether.sh.
Made sure su was checked and clicked save.
Created a shortcut on the homescreen for this script.
1. Enabled Usb Tether
2. ran script
3. ???
4. profit.
Sleeepy2 said:
@test1943
nice, I have been looking for this but...
how do I disable this properly?
To "restart your GPRS/Edge connection" I put my phone into airplane mode and then back to normal but it still couldn't connect to the network?? so I just rebooted and now that works.
But now my phone isn't recognized by my pc when I plug in the usb??
Any help.
oops let me take that all back. reboot, re-plugin and pc finds my phone again. tested again and it works as described.
Sweet Thanks
Click to expand...
Click to collapse
The easiest way to disable this(I think we could call it reverse USB tethering) was to use an APN switch, the "APN on-off Widget" in the market seems to do the job right. Turn off USB tethering, switch off APN, then switch on and you are good to go.
And Sleeepy2, how do you mean by "not recognized by my pc", is it in storage mode or debug mode?
plumppp said:
can this be done using root explorer?
Click to expand...
Click to collapse
I think he is referring to the root explorer by Gpc, a Taiwanese. Never used that app, but judging by its description it could turn on/off APN just like the "APN on-off Widget" did.
Sleeepy2 said:
I don't think so.
I just used gscript lite (free on the market)
I saved the stuff from test1943 in notepad as USBTether.sh, copied to my sdcard into the gscript folder.
Open gscript, push menu > add script. Click load file and select the USBTether.sh.
Made sure su was checked and clicked save.
Created a shortcut on the homescreen for this script.
1. Enabled Usb Tether
2. ran script
3. ???
4. profit.
Click to expand...
Click to collapse
ok thanks, gonna give it a try now
Edit: is this step necessary? im using vista and can't seem to find it.. can i skip it?
# Log on to the client computer as Administrator or as Owner.
# Click Start, and then click Control Panel.
# Click Network and Internet Connections.
# Click Network Connections.
# Right-click Local Area Connection, and then click Properties.
# Click the General tab, click Internet Protocol (TCP/IP) in the This connection uses the following items list, and then click Properties.
# In the Internet Protocol (TCP/IP) Properties dialog box, click Obtain an IP address automatically (if it is not already selected), and then click OK.
Note You can also assign a unique static IP address in the range of 192.168.0.2 to 192.168.0.254. For example, you can assign the following static IP address, subnet mask, and default gateway:
IP Address 192.168.0.2
Subnet mask 255.255.255.0
Default gateway 192.168.0.1
plumppp said:
ok thanks, gonna give it a try now
Edit: is this step necessary? im using vista and can't seem to find it.. can i skip it?
# Log on to the client computer as Administrator or as Owner.
# Click Start, and then click Control Panel.
# Click Network and Internet Connections.
# Click Network Connections.
# Right-click Local Area Connection, and then click Properties.
# Click the General tab, click Internet Protocol (TCP/IP) in the This connection uses the following items list, and then click Properties.
# In the Internet Protocol (TCP/IP) Properties dialog box, click Obtain an IP address automatically (if it is not already selected), and then click OK.
Note You can also assign a unique static IP address in the range of 192.168.0.2 to 192.168.0.254. For example, you can assign the following static IP address, subnet mask, and default gateway:
IP Address 192.168.0.2
Subnet mask 255.255.255.0
Default gateway 192.168.0.1
Click to expand...
Click to collapse
Sorry for the confusion, that article was for XP only. Check this one for Vista: hxxp://windows.microsoft.com/en-US/windows-vista/Using-ICS-Internet-Connection-Sharing
Notice: the network adapter you'll be working on should NOT be "Local Area Connection" because that's your PC's adapter. If you should have enabled USB tethering on your phone, you should see NEW one(i.e. it was not there before you turn on tethering), in my Windows 7, it was named "Local Area Connection 2".
test1943 said:
And Sleeepy2, how do you mean by "not recognized by my pc", is it in storage mode or debug mode?
Click to expand...
Click to collapse
I mean after disabling usb tether, unplug usb, then plug it back in. The pc did nothing. Didn't recognize that I even plugged it in. Must be something that I did because it works great now.
I just need to figure out how to us gscript to enable USB Tether then I can do it all with 1 shortcut.
Then another 1 to disable USB Tether, disable apn and then re-enable apn.
test1943 said:
Sorry for the confusion, that article was for XP only. Check this one for Vista: hxxp://windows.microsoft.com/en-US/windows-vista/Using-ICS-Internet-Connection-Sharing
Notice: the network adapter you'll be working on should NOT be "Local Area Connection" because that's your PC's adapter. If you should have enabled USB tethering on your phone, you should see NEW one(i.e. it was not there before you turn on tethering), in my Windows 7, it was named "Local Area Connection 2".
Click to expand...
Click to collapse
ok thanks, gonna try this again
Edit: sorry if im beginning to become an annoyance.. but when i run the script i get "stderrr Script execution failed" "no such process network is unreachable"
Su is checked, i also removed tex. and added sh
plumppp said:
ok thanks, gonna try this again
Edit: sorry if im beginning to become an annoyance.. but when i run the script i get "stderrr Script execution failed" "no such process network is unreachable"
Su is checked, i also removed tex. and added sh
Click to expand...
Click to collapse
Please type in each line to see which line produces error. And may I ask which ROM are you using? Remember to su first.
test1943 said:
Please type in each line to see which line produces error. And may I ask which ROM are you using? Remember to su first.
Click to expand...
Click to collapse
okay thanks again, i'll do it manually one at a time. i'm using cyanogen 307 nightly
Edit: okay.. i didn't even get pass the first line lol..
i'm assuming its the rom.. when typing "busybox ifconfig usb0 192.168.0.2 netmask 255.255.255.0"
i get: [ifconfig: socket: Permission denied]
which rom are you using?
plumppp said:
okay thanks again, i'll do it manually one at a time. i'm using cyanogen 307 nightly
Edit: okay.. i didn't even get pass the first line lol..
i'm assuming its the rom.. when typing "busybox ifconfig usb0 192.168.0.2 netmask 255.255.255.0"
i get: [ifconfig: socket: Permission denied]
which rom are you using?
Click to expand...
Click to collapse
That seems to be a root problem to me, does other root-required apps work right?

[REQ] Reverse wired tethering

Before i start i want to let people know YES I DO HAVE A WIRELESS ROUTER!! So please do not respond telling me to just go buy a router.
REQUEST - Reverse wired tethering. I.E. Sharing PC's iNet connection with your phone via USB.
REASON - My university's wireless is locked down and does not allow mobile phones, pda's to connect up to our wireless without submitting MAC for approval. Looking to sync certain apps without using my data connection.
I dont know if anyone has played around with trying to get this working or not. I know its a small market of people who may be interested in this, but for certain places (CANADA) where data charges are WAY to expensive this could be handy for students at UNI where wireless is not an option.
get a second wifi adapter on your laptop, and share your uni wireless network connection with the second wifi adapter. Use a hidden SSID, then no one will know what is going on
This was asked a couple of times before here and I remember people saying you couldn't reverse the tethering.You could try though.
alexperkins said:
get a second wifi adapter on your laptop, and share your uni wireless network connection with the second wifi adapter. Use a hidden SSID, then no one will know what is going on
Click to expand...
Click to collapse
Thats a good idea xD
Hey guys,
I have been trying to find a way to do this for a long time.
The best solution i have found (actually the only solution) is Connectify. The only downside is you must have Win7.
What it does is turns your wifi adapter into a HotSpot, even if you are using wifi to get the net in the first place. Its a great tool and should be what your after.
http://www.connectify.me/
memphisraynz said:
Hey guys,
I have been trying to find a way to do this for a long time.
The best solution i have found (actually the only solution) is Connectify. The only downside is you must have Win7.
What it does is turns your wifi adapter into a HotSpot, even if you are using wifi to get the net in the first place. Its a great tool and should be what your after.
http://www.connectify.me/
Click to expand...
Click to collapse
thank you so much for this
Your best solution is the WiFi adapter. You could most likely get away with a SOCKS proxy over USB, possibly using adb, but it would be complicated, unstable, and messy.
I still don't know you just don't use your wireless router. I assume they have wired. Clone your PC's mac address and hook it up. Universities are retarded with that crap. They have the worst networks and security.
If no wired, then what podunk place is it? haha
Even if they had only wireless , you could set up a wlan client and repeat it. DDWRT, etc, ftw.
Just get backtrack for your laptop and spoof your mac to all 0 then grab connect to the network at your school the spoofed mac will allow you to browse so long as no other encyption is on the network such as WEP or WPA.
then you can try to flood all the ports on the network so no one else can connect then spoof your phones mac by conneecting to your laptop through wireless as an adhoc connection and while staying connected through adhoc load a second server through the same wireless network card and you can connect to the achools network again. and walla...
death1246 said:
Just get backtrack for your laptop and spoof your mac to all 0 then grab connect to the network at your school the spoofed mac will allow you to browse so long as no other encyption is on the network such as WEP or WPA.
then you can try to flood all the ports on the network so no one else can connect then spoof your phones mac by conneecting to your laptop through wireless as an adhoc connection and while staying connected through adhoc load a second server through the same wireless network card and you can connect to the achools network again. and walla...
Click to expand...
Click to collapse
so simple, i dunno why i didnt think of that. thanks! lol
Well its quit simple once you learn your way around linux...
If you have any experience with *nix, you may want to look at Cyanogen's original usb tether shell script:
http://github.com/cyanogen/android_vendor_cyanogen/blob/master/bin/usb-tether
Basically you could use the internet connection sharing function that comes with all popular OSes and access your uni's network on your phone. You must have Cyanogen mod or another mod using his kernel. Not yet working on OSX for some reason. Tested under Windows 7.
First you'll need to figure out what IP address range your computer's DHCP server is using. This is normally fixed for each OS. For Windows 7, it's always 192.168.137.0/24.
For OSX or Linux, you can setup connection sharing (for some other connection because we don't have the USB interface yet) and ifconfig.
Second is to enable the USB connection on the phone's side. Type the following command in any console program, like Connectbot. (You must use a console program as opposed to adb because you will lose USB debugging once the USB network interface is enabled.)
Code:
su
cd /sys/devices/virtual/net/usb0
ifconfig usb0 192.168.137.200 mask 255.255.255.0
echo 1 > enable
The first line makes you the superuser. (Skip if the command prompt is #)
The second line land you in usb0's directory under sys. We'll need to type the disable command later, so it's easier if we're here.
The third line brings up the virtual usb network interface and sets its IP address.
The IP address should be in the same network (i.e. IP address range) you obtained in step 1. Say if the original is 192.168.137.1 in a /24, you can use 192.168.137.2 through 192.168.137.254
This actually enables the usb interface.
You will now see a new network adapter is recognized by your computer. Set up connection sharing to share your internet TO that adapter.
Make sure you have connection by pinging your computer from your phone.
For example:
ping 192.168.137.1
Now you'll have to change the routes so traffic go through the USB cable instead of the mobile network.(# is the command prompt, do not enter)
# busybox route
check the line starting with "default". Write down the ip address after it; call it IP1.
# getprop net.dns1
Call the IP returned IP2.
Code:
busybox route del default gw IP1
busybox route add -host IP2 rmnet0
busybox route add default gw 192.168.137.1
The first line deletes the old default route via the mobile network.
The second line adds an "exception" for your carrier's DNS server.
The third line adds the new route via USB. You should replace the address at the end with the IP address from the first step.
Your network should be working now. Test by visiting some website that is only available on campus or by traceroute.
You must make sure the mobile network is always connected though. This is because domain names are still resolved by your mobile carrier. If you ever lose your mobile connection, the routing table will be changed as well.
To disconnect:
Make sure you're still in /sys/devices/virtual/net/usb0.(Use pwd if unsure.)
Code:
netcfg usb0 down
echo 0 > enable
The usb interface will disappear on your computer.
Now switch the phone to airplane mode and back to re-enable mobile network.
The disconnect step should always restore your phone's state.
// This is written at 3am, so use it at your own risk...
help?
look at this
http://superuser.com/questions/91699/spoof-mac-address-from-ip-command
bg
It's really sad that Android can't reverse tether. If you want to use your laptop's AdHoc connection you have to do serious hacking to the tiwlan.ini and the wpa_supplicant.conf. There is no way to connect via bluetooth ar USB.
I'm seriously considering WP7 now for my next OS of choice... A nd for everyone saying "go buy a router" - go buy a router and stick it up your .... nose.
Hi,
I have the same problem. No WiFi in my work and no WiFi in my current home (a Resident Hall). There's no possibility to buy a WiFi router, of course. I tried to hack the system to connect ad-hoc networks but it didn't work.
I have found some interesting resources:
sluniverse.com/php/vb/blogs/psyke+phaeton/1042-making-android-phone-use-your.html
letsgoustc.spaces.live.com/blog/cns!89AD27DFB5E249BA!877.entry
I have a HTC Magic with the ADP-DRC83 hacked ROM with Usb tethering integrated. But usb0 interface in the mobile is configured to provide Internet connection (as gateway) to the PC, not the reverse functionality: connecting the mobile to Internet through the PC. So, all I need is to change the gateway in Android and then configure a NAT-DNS in my linux PC (easy with iptables and dnsmasq). But, I don't know how automatize the process exactly.
digitaljeff said:
but for certain places (CANADA) where data charges are WAY to expensive this could be handy for students at UNI where wireless is not an option.
Click to expand...
Click to collapse
Wind will be launching in vancouver soon.
$35 unlimited data.
Silly ragin' cajun.
Ok, now it works. Here it's my procedure for a HTC Magic (Sapphire) without any APN previously configured from Telecom provider and ROM CSDIv4.
In the mobile by using Better Terminal:
Code:
su
cd /sys/devices/virtual/net/usb0
echo 1 > enable
ifconfig usb0 192.168.2.2 mask 255.255.255.0
busybox route add default gw 192.168.2.1
setprop net.dns1 8.8.8.8
In the linux computer:
Code:
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i usb0 -j ACCEPT
sudo ifconfig usb0 192.168.2.1 netmask 255.255.255.0
Android Market downloads and location service don't work but I think is possible if you switch on the WiFi.
Update: Syncronization, Android Market downloads and location service don't work even the WiFi antenna is switched on. I have added the iptables commands also.
Well gosh, reverse wireless tethering is so much simpler
There are another similar thread: http://forum.xda-developers.com/showthread.php?t=522498

Join Bluetooth PAN as client? (reverse tether)

How can I join an Android device to a Bluetooth PAN (Personal Area Network) as a client? In some areas, the only internet connection available would be to tether it through another cell phone via bluetooth PAN (other phone has no wifi).
Solutions that require rooting or config file editing are OK.
I've searched alot, but all results are about going the other way - tethering other devices through the Android.
Soundman6 said:
How can I join an Android device to a Bluetooth PAN (Personal Area Network) as a client? In some areas, the only internet connection available would be to tether it through another cell phone via bluetooth PAN (other phone has no wifi).
Solutions that require rooting or config file editing are OK.
I've searched alot, but all results are about going the other way - tethering other devices through the Android.
Click to expand...
Click to collapse
It's Linux, man, all you need is setting network config I was using reverse tethering for some time, this is my script (run on PC):
Code:
sudo pand --listen --role NAP
adb shell pand --connect XX:XX:XX:XX:XX:XX
sudo ifconfig bnep0 192.168.101.1
adb shell ifconfig bnep0 down 192.168.101.2 up
adb shell route add default gw 192.168.101.1 dev bnep0
adb shell setprop net.dns1 192.168.101.1
Of course you should omit 1st and 3rd lines.
Are you sure second phone supports PAN connections, not DUN? PAN is quite complicated for phone, because it requires full NAT.
And you will have problems with Android Market and some other apps. Internet is configured at linux level, Android OS don't know about it, so if application asks: "Do we have internet connection?", Android replies: "No". Android Market will wait for connection even if there is one.
Brut.all said:
And you will have problems with Android Market and some other apps. Internet is configured at linux level, Android OS don't know about it, so if application asks: "Do we have internet connection?", Android replies: "No". Android Market will wait for connection even if there is one.
Click to expand...
Click to collapse
I believe that is a valid concern. Anyone know how to deal with this? Thanks.
Soundman6 said:
I believe that is a valid concern. Anyone know how to deal with this? Thanks.
Click to expand...
Click to collapse
But most of the apps don't check internet status and just use it - they will work. AFAIR I couldn't use Market, GTalk and syncing feature, but Browser, Gmail and many, many more was working.
If you have any WiFi device then you could connect Android to it. Even if it doesn't share internet connection, Android OS will think, that it does (but will use BT connection configured at linux level ) - then any app should work.
At work I got a laptop with windows XP, There's a wireless network but it's EAP secured and I can't connect to it with the phone (Motorola Milestone - Android 2.1).
Did you manage to make internet work through Bluetooth PAN? I just need to use the borwser, so It's not important if market or other apps don't work.
I have android sdk with adb on my laptop and terminal emulator with busybox on my phone. I'm kind of a newbie in this so some hints would be nice. I think many people like me would be gratefull
haxxy said:
Has anybody got it working?
At work I got a laptop with windows XP, There's a wireless network but it's EAP secured and I can't connect to it with the phone (Motorola Milestone - Android 2.1).
Did you manage to make internet work through Bluetooth PAN? I just need to use the borwser, so It's not important if market or other apps don't work.
I have android sdk with adb on my laptop and terminal emulator with busybox on my phone. I'm kind of a newbie in this so some hints would be nice. I think many people like me would be gratefull
Click to expand...
Click to collapse
And my first post was about what, you think? I don't use it now, but I was reverse-tethering through BT for several months, until I bought some data plan.
Above commands should work for you, but... they will let you connect your phone to PC, but I don't know, how to share internet connection on Windows XP. AFAIR I tried to do it, but failed.
There's a bluetooth network icon. I know it's possible to share the internet connection from my ethernet to the other network cards. So this should work also with the bluetooth network.
I will try the commands and see how it goes.
haxxy said:
it's possible to share the internet connection from my ethernet to the other network cards. So this should work also with the bluetooth network.
Click to expand...
Click to collapse
Unfortunately not ;-) It is a cost of easy-clicking-configuration that Windows has - it's very limited, don't work for BT connections. I guess there is some professional software for internet sharing on Windows, but I don't know one.
Brut.all said:
Unfortunately not ;-) It is a cost of easy-clicking-configuration that Windows has - it's very limited, don't work for BT connections. I guess there is some professional software for internet sharing on Windows, but I don't know one.
Click to expand...
Click to collapse
I did this with my symbian phone. I managed to share internet to the bluetooth network, but the phone had a bluetooth PAN profile that connected to my laptop.
No! Already I have a bluetooth network set up on my Ubuntu Laptop - pand is running and there is a dhcp server monitoring the interface. What I need is not the below advice, which are commands to run on the PC, but an application / utility / instructions for enabling BLUETOOTH PAN CLIENT on Android. That is what the original question was too! Anybody?
Paul Beardsell
Brut.all said:
It's Linux, man, all you need is setting network config I was using reverse tethering for some time, this is my script (run on PC):
Code:
sudo pand --listen --role NAP
adb shell pand --connect XX:XX:XX:XX:XX:XX
sudo ifconfig bnep0 192.168.101.1
adb shell ifconfig bnep0 down 192.168.101.2 up
adb shell route add default gw 192.168.101.1 dev bnep0
adb shell setprop net.dns1 192.168.101.1
Of course you should omit 1st and 3rd lines.
Are you sure second phone supports PAN connections, not DUN? PAN is quite complicated for phone, because it requires full NAT.
Click to expand...
Click to collapse
psb777 said:
What I need is not the below advice, which are commands to run on the PC, but an application / utility / instructions for enabling BLUETOOTH PAN CLIENT on Android.
Click to expand...
Click to collapse
4 of 6 lines of my instructions were for setting Android client: connecting, setting IP, routing and DNS. And yes, they are run on Android, not on PC - I thought you will notice "adb shell" prefixes... You can also use dhcpcd instead of last 3 lines, but if you don't understand, what are you doing, you will have problems anyway.
Maybe anyone with Froyo can confirm that there's still no official option for joining a Bluetooth PAN from Android there?
@Brut.all So I guess there's currently no way to kind of telling Android there's a configured connection on Linux level?
By the way, every Mac allows the creation of a Bluetooth PAN with one click so this would be my usage scenario ;-)
This seems like it should work, and indeed I can use a similar technique from an ubuntu laptop to connect to another device, but my HTC Hero doesn't seem to have hcitool or pand installed on it. I downloaded some prebuilt binaries for them but they don't seem to be able to access the bluetooth device:
# /data/tmp/pand --role PANU --connect 00:17:83:0F:0F:C7 -n
pand[5083]: Bluetooth PAN daemon version 3.36
pand[5083]: Connecting to 00:17:83:0F:0F:C7
pand[5083]: Connect to 00:17:83:0F:0F:C7 failed. No route to host(113)
Do all versions of Android come with pand and hcitool? I'm on 1.5 although I'll be reflashing to 2.1 soon.
"find / -name pand" yields no results
trphunk said:
Do all versions of Android come with pand and hcitool? I'm on 1.5 although I'll be reflashing to 2.1 soon.
Click to expand...
Click to collapse
No, it was added by rom cookers and I don't know how they did this. I think there are missing some kernel modules or something like that.
trphunk said:
This seems like it should work, and indeed I can use a similar technique from an ubuntu laptop to connect to another device, but my HTC Hero doesn't seem to have hcitool or pand installed on it. I downloaded some prebuilt binaries for them but they don't seem to be able to access the bluetooth device:
# /data/tmp/pand --role PANU --connect 00:17:83:0F:0F:C7 -n
pand[5083]: Bluetooth PAN daemon version 3.36
pand[5083]: Connecting to 00:17:83:0F:0F:C7
pand[5083]: Connect to 00:17:83:0F:0F:C7 failed. No route to host(113)
Do all versions of Android come with pand and hcitool? I'm on 1.5 although I'll be reflashing to 2.1 soon.
"find / -name pand" yields no results
Click to expand...
Click to collapse
Brut.all said:
No, it was added by rom cookers and I don't know how they did this. I think there are missing some kernel modules or something like that.
Click to expand...
Click to collapse
Thanks, I've got the FroydVillain ROM installed now and can confirm that it comes with pand and hcitool compiled and working.
Reverse tether does seem to work, the method that's worked for me has been to use:
Code:
pand --connect <remote BT device hex address>
ifconfig bnep0 down
dhcpcd bnep0
setprop net.dns1 8.8.8.8
This allows the device to access the internet, and you can ping www . google . com and get a response etc.
However, a lot of android apps (including the built-in google apps for gmail etc) use the ConnectivityService (see source code here) to access the net, and since this method of reverse tethering doesn't change the connectivity state within this service, those apps still believe that there is no internet connection on the device.
I can't see an easy way of "tricking" the ConnectivityService as it appears to have been hard coded to only cater for WIFI and 3G connectivity. So perhaps the only way is to rewrite it.
I've found a few cases of others going through the same issues online, although I think the getMobileDataEnabled return value is a red herring:
(I'm not allowed to post links, so you will need to add http : // www to these
superuser.com/questions/188636/close-connect-android-to-internet-using-usb-tether-through-laptops-newtwork
forceclose.com/questions/2669/connect-android-to-internet-using-usb-tether-through-laptops-newtwork
Looking at the code in ConnectivityService.java it seems that apps must subscribe to this service via getInstance() and then wait for a sendConnectedBroadcast() to occur, triggering them into action (e.g. the gmail app will attempt to sync to the gmail server etc).
Anyone got any ideas for an easier route than rewriting ConnectivityService.java to add an additional connectivity type?
Edit to add:
Found another related discussion at the following site. Seems to suggest modifying the ConnectivityService is the way to go:
comments.gmane.org/gmane.comp.handhelds.android.porting/12028
Based on the posts I've seen in this thread, I'm guessing I can't use BlueTooth PAN tethering from my rooted Dinc to provide internet access to a Samsung Galaxy Tab???
So has anyone tried to Bluetooth tether a Galaxy tab with a phone?
Thanks for this thread! I just successfully Tethered both internet+gps over bluetooth from my G1 to my AdventVega tablet.
For now I am using GScript lite with the following script commands:
Code:
pand --connect {my phones BT hex address}
ifconfig bnep0 down
dhcpcd bnep0
setprop net.dns1 8.8.8.8
dhcpcd bnep0
(for some reason the first dhcpcd command always says permission denied, but the last one always works)
So...
1) Get in to car with Android phone and Vega Tablet.
2) On phone: Enable GPS/Bluetooth, click GPS2Bluetooth widget button, click WiFi Tether (configure for BT), press to start tethering.
3) On tablet: Enable Bluetooth, click Bluetooth GPS Provider, click Start, click Back or Home, click GScript Lite, click "Connect to BT-PAN" (above script)
4) Run GoogleMaps/Navigation on tablet and enjoy using your tablet as the ultimate GPS navigation system (while streaming Pandora in the background)!
I am very happy. I just wish I could make step 2 & 3 be a single click instead of so many.
NOTE: Must have "Allow mock locations" enabled in Settings->Applications->Development
NOTE2: You must pair your phone and tablet in BT settings (it will never say "connected" though, which is fine)
I tried this, but still no connection between my android phone and the other phone. Is there some other method?

Could I connect to my Internet PC connection via USB cable and my Desire / Bravo?

Hello People, I am looking for a way or app in order to get Internet on my HTC Desire using PC Internet Connection but I don't have any Wireless AP or similar, I need by connecting my Desire by USB to PC....any ideas about this?
thanks in advance
Simply can't be done. Someone would have to design a proxy app app for PC or something to talk to windows ics like what Ms did with activesync
single finger pecked on a galaxy s
it's a shame, hope anyone do this asap...
thanks anyway
ickyboo said:
Simply can't be done. Someone would have to design a proxy app app for PC or something to talk to windows ics like what Ms did with activesync
single finger pecked on a galaxy s
Click to expand...
Click to collapse
Is there a reason you want do to this? Why cant you use your 3g?
of course there is a reason for all this, simple, where I live there is not 3G, EDGE, just GPRS but it's very limited, just exist one Cell Phone Carrier, so no choice....
I'm like you. My house must have alot of steel and whatnot that seem to just kill reception and I only get gprs. I went looking for a usb > android method for months and havn't come up with anything . What helped for me is setting my phone to lock onto WCDMA in settings and using the 3G only fix (type *#301279# in phone/dial pad then select [2] then [1]. To restore select [2] then [3]) Now I atleast get 2 bars with 3G (not full utms/Hpsa) which is fine as its better then GPRS and battery wise its a lot better then HSPA/UMTS but of cause it uses more power then GPRS but since I'm at home I always have it either plugged in or I can charge quick
You don't HAVE to set it to WCDMA only. You can leave it at GSM/WCDMA if you want but I find it very annoying when the phone keeps switching bands as it lags when i'm playing games that need network so thats why I leave it locked onto WCDMA only.
O crap, I didn't relize you don't have the a Galaxy S like I do. Maybe you can find a app or code or something to get your phone to lock onto 3G/EDGE only instead of HSPA
No No, I have HTC Desire / Bravo, will be very nice if something create some app to connect USB cable using Windows.....
I have found this
I have found this, but not sure if works or not, maybe someone can explain me better.
Code:
Can i share the connection between android and my pc through USB cable?
I'd like to connect to the internet with my android using the PC internet connection. Yes, you can. It's described on koolu's forum. Check this link [1].
If you dont have access i just copy paste the instructions below.
All credit goes to koolu and Brian Code for this info:
[1] forum.koolu.org • Login
Yes, you can use the USB to browse the web...
You need to do three things to enable the internet.
1. First make sure that network forwarding is working on the computer that the phone is connected to. 2. Add the default route to the phone:
Code: Select all
route add default gw 192.168.0.200 dev usb0
3. Add the dns for proper name resolution
Code: Select all
setprop net.dns1 192.168.0.200
You should be able to ping the computer the phone is connected to:
Code: Select all
ping 192.168.0.200
You should also be able to ping IP addresses outside of that subnet if the route has been set up properly. The route can be verified by:
Code: Select all
cat /proc/net/route
If you're using windows 7, its easy. Use a bit of software called connectify. It turns your pc into an access point. Just connect your phone through WiFi and voila!!!
It doesn't have any software same as activesyn for android mobile ?
I cant connect to internet via my HD2 but I have internet connection in my PC.
It doesn't have any software same as activesyn for android mobile ?
I cant connect to internet via my HD2 but I have internet connection in my PC.
you can try this:
http://blog.mycila.com/2010/06/reverse-usb-tethering-with-android-22.html
I know this is not a solution exactly, but the HD port has something called 'Internet pass-through' which is what you want. It's sad that we used to do it easily in WinMo but have to go through hell to do it in Android.
So if you feel like putting up a new ROM, try it here:
http://forum.xda-developers.com/showthread.php?t=861690
If he could connect to his computer through WiFi then wouldn't it be easier to connect straight to the net through WiFi,
There must be a way of doing this, I used to have a Samsung omnia, when you plugged in the usb cable it would connect to the net via the computers connection and sync the emails
Good luck with this but considering there is no way to access the internal memory other than in adb there is probably no way for the pc to access it either
Sent from my HTC Desire using XDA App

[Tips]Access internet via USB net: share Windows internet connection to android phone

I tested accessing internet in Android phone via USB net which connected to a Windows XP PC, pure wired, not wireless solution I Googled.
It works! However, some application does not designed to use USB net, these application only use WiFi or GPRS/EDGE/HSPA to access internet.
My environment:
Windows: XP
Phone: Huawei U8800, Android 2.3.5
Internet: Ethernet (ADSL+router infact)
For those people who don't have WiFi, can't use WiFi (care about baby's health?), don't want to use WiFi/GPRS/EDGE/HSPA (expensive?), here is the tips to let you access internet via USB net.
How to do
Your android phone must be rooted first
Install Microsoft ActiveSync on your Windows PC
Install Terminal Emulator application on your android phone from market.
Connect your phone to your Windows PC
On your phone, turn on USB tethering: Settings -> Wireless & networks -> Tethering & portable hotspot -> USB tethering
Now, look at your Windows system, there will be a new network card (Windows Mobile-based Internet Sharing Device) appears
Share your internet connection to the new network card: right click internet connection (PPPoE or Ethernet or WiFi or whatever your internet connection is) -> Property -> Advance -> Enabled internet connection sharing. (if your Windows Firewall service is not started, start it first), this will change the IP address of new network card to 192.168.0.1/255.255.255.0
Now back to your phone, open the Terminal application, type commands like the following
Code:
su
ip addr add 192.168.0.2/24 broadcast 192.168.0.255 dev usb0
route add default gw 192.168.0.1 dev usb0
setprop net.dns 192.168.1.1
setprop net.dns1 8.8.8.8
setprop net.dns2 8.8.4.4
# the DNS server should change to your favorite DNS server, 192.168.1.1 is for my environment (a router)
DONE! turn your phone WiFi off, open a browser, you can surfering now, but as I tested, some other application won't work (or work well), they don't know USB net
Compatible/Incompatible applications
I tested few applications, found some compatible and incompatible applications, I will list them here, if you found incompatible applications, please help fill these lists.
++ Compatible ++
Generally, most browser or browser-like application works with USB net.
XDA
Browser
Gmail
Google Map
News & Weather
QQ
SoSo Map
新蛋商城/Newegg Mall China
Opera Mobile Browser
-- Incompatible --
Market: can browse, but can't download application
Weather Clock: can't update weather
QQGame: can login, but can't enter room to play
Google Voice recognition applications like Voice Search
YY: can't login
Jingdong Mall/京东商城: can't login
Proxy issue
For environment which need proxy to access internet, there're very few applications support it. Currently, I only know Opera Mobile browser works in such environment, there're proxy configurations in opera:config page.
very good work >>>
perfect solution
keep working and you might find easier solution .
ELRAKAWY said:
very good work >>>
perfect solution
keep working and you might find easier solution .
Click to expand...
Click to collapse
An easier way already exists: http://forum.xda-developers.com/showthread.php?t=1371345.
Theonew said:
An easier way already exists: http://forum.xda-developers.com/showthread.php?t=1371345.
Click to expand...
Click to collapse
capslock66 really did a great and expert job both on Android and Windows.
My solutions is some kind of clean & manual one, no application is needed on Android phone, no router-like client application is needed on Windows PC, let "Windows Firewall/Internet Connection Sharing (ICS)" service do the internet sharing magic.
I shared internet between two Windows PC before (install 2 network cards on host PC), so I think it should be same when the client PC changed to an Android phone, that's how this solution came out.
Hey
lovetide said:
How to do
Your android phone must be rooted first
Install Microsoft ActiveSync on your Windows PC
Install Terminal Emulator application on your android phone from market.
Connect your phone to your Windows PC
On your phone, turn on USB tethering: Settings -> Wireless & networks -> Tethering & portable hotspot -> USB tethering
Now, look at your Windows system, there will be a new network card (Windows Mobile-based Internet Sharing Device) appears
Share your internet connection to the new network card: right click internet connection (PPPoE or Ethernet or WiFi or whatever your internet connection is) -> Property -> Advance -> Enabled internet connection sharing. (if your Windows Firewall service is not started, start it first), this will change the IP address of new network card to 192.168.0.1/255.255.255.0
Now back to your phone, open the Terminal application, type commands like the following
Code:
su
ip addr add 192.168.0.2/24 broadcast 192.168.0.255 dev usb0
route add default gw 192.168.0.1 dev usb0
setprop net.dns 192.168.1.1
setprop net.dns1 8.8.8.8
setprop net.dns2 8.8.4.4
# the DNS server should change to your favorite DNS server, 192.168.1.1 is for my environment (a router)
DONE! turn your phone WiFi off, open a browser, you can surfering now, but as I tested, some other application won't work (or work well), they don't know USB net
Click to expand...
Click to collapse
Hey
first of all, thank you so much for your article.
I really need to do this.
anyways, my questions
what's a "rooted android phone" ?
and how do I "Install Terminal Emulator application on my android phone" ?
I'm sorry but I just bought my phone and I don't know much about it
I tried to copy-paste it in my SD Memory but it didn't work
and by the way I didn't download it from Market (because GPRS is so damn expensive in here ), instead I downloaded it from developer's website (jackpal).
thanks again
I really appreciate it o7
Yea you lost me once I found out that in order for this to work I had to install
Microsoft Active Stink.
One of the things I hated about Windows Mobile was its reliance on that crappy software and I don't want it on my new PC.
Arash.Eternal said:
what's a "rooted android phone" ?
and how do I "Install Terminal Emulator application on my android phone" ?
I'm sorry but I just bought my phone and I don't know much about it
I tried to copy-paste it in my SD Memory but it didn't work
and by the way I didn't download it from Market (because GPRS is so damn expensive in here ), instead I downloaded it from developer's website (jackpal).
thanks again
I really appreciate it o7
Click to expand...
Click to collapse
Since you are noob I'll guide you. For info on rooted phones:
http://bit.ly/I3hROF
For everything else check the sticky (the first message) in this forum labeled
Android Terms,Slang & Definitions(READ THIS BEFORE POSTING QUESTIONS!)
Phrack said:
Since you are noob I'll guide you. For info on rooted phones:
For everything else check the sticky (the first message) in this forum labeled
Android Terms,Slang & Definitions(READ THIS BEFORE POSTING QUESTIONS!)
Click to expand...
Click to collapse
meh
thanks for nothin
btw, I LoLed hard at that cat in your signature
Great!
Thanks a ton mate! Keep up the good work. Waiting for Google Play to work with this
lovetide said:
Install Microsoft ActiveSync on your Windows PC
Click to expand...
Click to collapse
That page says: "Note: Microsoft ActiveSync works only with Windows XP SP2 or earlier."
So... can this work on Windows 7?
Hi, This is ashok, I am receiving an error stating "cannot find device usb0". How can i find the device name?
Question
lovetide said:
I tested accessing internet in Android phone via USB net which connected to a Windows XP PC, pure wired, not wireless solution I Googled.
It works! However, some application does not designed to use USB net, these application only use WiFi or GPRS/EDGE/HSPA to access internet.
My environment:
Windows: XP
Phone: Huawei U8800, Android 2.3.5
Internet: Ethernet (ADSL+router infact)
For those people who don't have WiFi, can't use WiFi (care about baby's health?), don't want to use WiFi/GPRS/EDGE/HSPA (expensive?), here is the tips to let you access internet via USB net.
How to do
Your android phone must be rooted first
Install Microsoft ActiveSync on your Windows PC
Install Terminal Emulator application on your android phone from market.
Connect your phone to your Windows PC
On your phone, turn on USB tethering: Settings -> Wireless & networks -> Tethering & portable hotspot -> USB tethering
Now, look at your Windows system, there will be a new network card (Windows Mobile-based Internet Sharing Device) appears
Share your internet connection to the new network card: right click internet connection (PPPoE or Ethernet or WiFi or whatever your internet connection is) -> Property -> Advance -> Enabled internet connection sharing. (if your Windows Firewall service is not started, start it first), this will change the IP address of new network card to 192.168.0.1/255.255.255.0
Now back to your phone, open the Terminal application, type commands like the following
Code:
su
ip addr add 192.168.0.2/24 broadcast 192.168.0.255 dev usb0
route add default gw 192.168.0.1 dev usb0
setprop net.dns 192.168.1.1
setprop net.dns1 8.8.8.8
setprop net.dns2 8.8.4.4
# the DNS server should change to your favorite DNS server, 192.168.1.1 is for my environment (a router)
DONE! turn your phone WiFi off, open a browser, you can surfering now, but as I tested, some other application won't work (or work well), they don't know USB net
Compatible/Incompatible applications
I tested few applications, found some compatible and incompatible applications, I will list them here, if you found incompatible applications, please help fill these lists.
++ Compatible ++
Generally, most browser or browser-like application works with USB net.
XDA
Browser
Gmail
Google Map
News & Weather
QQ
SoSo Map
新蛋商城/Newegg Mall China
Opera Mobile Browser
-- Incompatible --
Market: can browse, but can't download application
Weather Clock: can't update weather
QQGame: can login, but can't enter room to play
Google Voice recognition applications like Voice Search
YY: can't login
Jingdong Mall/京东商城: can't login
Proxy issue
For environment which need proxy to access internet, there're very few applications support it. Currently, I only know Opera Mobile browser works in such environment, there're proxy configurations in opera:config page.
Click to expand...
Click to collapse
What about if I installed one of CM10 ROMs and USB tethering is not working
USB to LAN Ethernet Adapter for Google Android Tablet
AmirNajjar said:
What about if I installed one of CM10 ROMs and USB tethering is not working
Click to expand...
Click to collapse
My Nexus 7 (2012) hat USB host function. I'm simply using an "USB to LAN Ethernet Adapter for Google Android Tablet". No Windows needed.
Lots of troubles
• The ip of my router is "192.168.0.1" and ICS were having a trouble about that.
• After I type in terminal the "ip addr bla bla bla..." it says " Object 'addr' not found. Try 'ip help' "
• I typed "ip help" then it says " 'help' not found try 'ip help' " Seriously??
• I Google "help not found on android terminal" and I cannot find any related problem like mine
The PC I am using doesn't have any WiFi so I badly needed this kind of workaround because I need internet to simulate the app I'm gonna work for. Thanks!
My phone charge only when it connect to pc
why my pc won't recognize my android device , it just doing charging and no usb thing or image in tray or menu ( i don't know the term to use) i search whole day and still i can't find answer for this, i don't have usb utility in my device, i do have usb debugging enabled/disabled, usb computer connection (MTP, PTP and as Storage ) i already restarted my device many times.
Help me with my problem so i can do this
-------------------->>>>>>>>> [Tips]Access internet via USB net: share Windows internet connection to android phone.
sorry if i do this in maybe wrong section :crying:
BoomPork said:
why my pc won't recognize my android device , it just doing charging and no usb thing or image in tray or menu ( i don't know the term to use) i search whole day and still i can't find answer for this, i don't have usb utility in my device, i do have usb debugging enabled/disabled, usb computer connection (MTP, PTP and as Storage ) i already restarted my device many times.
Help me with my problem so i can do this
-------------------->>>>>>>>> [Tips]Access internet via USB net: share Windows internet connection to android phone.
sorry if i do this in maybe wrong section :crying:
Click to expand...
Click to collapse
Have you had try downloading the necessary drivers to be able to detect it by your computer? That's one possible problem I encountered in the past.
Thanks for this. Will try this later. :victory:

Categories

Resources