I haven't seen any success stories on these forums, however it IS possible to do.
The sequence of steps goes something like this:
1) Turn off wifi network managers (NetworkManager et al)
2) Remove your wifi module, modprobe it (it doesn't work for me otherwise, YMMV)
3) iwconfig <DEVICE> mode ad-hoc essid "G1 "
4) ifconfig <DEVICE> up
5) iwconfig <DEVICE> mode ad-hoc essid "G1 "
6) dhclient <DEVICE>
Where <DEVICE> is of course your wireless device, whether it's wlan0, eth0, eth1, etc.
I realise these commands look odd, but it's the only way I've been able to *reproducibly* connect. It may be my horrible broadcom wireless chipset drivers, but I couldn't say for certain.
If dhclient fails to get an address, it didn't work.
I'd be interested in other peoples' success; perhaps there is an easier way.
Here's an example start|stop script:
Code:
#!/bin/bash
case "$1" in
start)
/etc/rc.d/autowifi stop 2>/dev/null
rmmod wl 2>/dev/null
modprobe wl
iwconfig eth0 mode ad-hoc essid "G1 "
sleep 3
ifconfig eth0 up
sleep 3
iwconfig eth0 mode ad-hoc essid "G1 " 2>/dev/null
sleep 3
dhclient eth0
;;
stop)
kill `pidof dhclient` 2>/dev/null
ifconfig eth0 down
ifconfig eth0 up
/etc/rc.d/autowifi start || exit 1
;;
*)
echo "USAGE: wifitether start|stop"
;;
esac
exit 0
Note for script usage: I use autowifi to manage wifi networks normally. If you want to use this script, please replace /etc/rc.d/autowifi with your network manager of choice, wl with your wireless module, and eth0 with the wireless device.
Trying to do this but not having much luck :/ Using PuppyLinux On both computers.
On the laptop, I think it's a driver issues. I can't get past the first iwconfig line, with or without the wlan0 module loaded.
On the pc without the module i get the same as the laptop. With the module still loaded, I get to 'dhclient wlan0' then error... Bash (or sh): dhclient: command not found
*do I need to use the script part too? or is that just for future automatic setting up..Do i need to go back through the network setup and input the ip,mask,dhcp etc?
I see dhclient in /sbin but idk. I'm new to *nix and trying to use the tetherwifi.apk with my G1/PuppyLinux project. Unfortunately I can't get past the wlan(wireless 3g internet) & boot from USB G1(sd memory) parts:/
If you have anyideas that'd be great! I'll post back here if I get everything working..
theres a great app in the dream app forum that lets you do wifi tethering, ive got it workng on both linux and windows7.
are you referring to TetherWiFi ?
If so, I have that one working cool in windows (one of my favorite apps!). I just have no exp with linux About the farthest I get is the browser hanging longer than usual before timing out. I've removed/installed the wlan drivers. set the ip,mask etc to match what shows up in xp. Just can't get a connection :/
Silly question, but are you sudo/root when you try to dhclient? If yes, try /sbin/dhclient wlan0
The script is just an example for future automation, yes.
If you can't get past the first iwconfig line (which puts the NIC into ad-hoc mode), the card or the driver may not support ad-hoc currently.
Something is wrong here. You put the PC in Ad-Hoc mode and then run dhclient on it? Why?
Also does your phone really see the Ad-Hoc network? I have tried with linux, windows 7 and windows XP and the phone sees neither of them. And many other people have reported the same. The phone doesn't list Ad-Hoc networks. It is possible, though to put the phone in ad-hoc mode and connect to it from a PC.
MoridinBG said:
Something is wrong here. You put the PC in Ad-Hoc mode and then run dhclient on it? Why?
Also does your phone really see the Ad-Hoc network? I have tried with linux, windows 7 and windows XP and the phone sees neither of them. And many other people have reported the same. The phone doesn't list Ad-Hoc networks. It is possible, though to put the phone in ad-hoc mode and connect to it from a PC.
Click to expand...
Click to collapse
1) The tether application sets up a dhcp server
2) It's easier than setting the ip/gateway/broadcast yourself
Hmm with ubuntu 8.1 the ad hoc tethering just works. Nothing special to do other than know the ssid is g1.
Is this method for connect PC using G1 internet or connect G1 to PC internet?
>>> <<<< >>>> <<< >>> <<<>>>>
yes if you use the network manager from ubuntu builds, it will automatically configure the ad hoc, works out of the box
Any way to connect the G1 to the PC Internet connection with ad hoc connection? without the use of the Access Point or router, just with a wifi card on pc (ad hoc connection).
Any Idea?
Related
Disconnect from #android on freenode figured out how to get bluetooth tethering to work. It requires root access of course.
http://www.gotontheinter.net/node/515
Enjoy!
BTW, I just tried and this *does* work for windows. Once you run the pand command on the phone, then go back to your computer and right click on the bluetooth icon in the system tray and select "Join a Personal Area Network". Then click "Refresh" in the dialog that pops up, then select the G1 and click connect.
Now you should have a "Bluetooth Network Connection", and you have to set it up with a static ip like Disconnect's post describes.
Wow the Real Hacking is started !
Rock and Roll!
That's pretty nice
Will wait for the DHCP version though, and I am still hoping for a USB way to do it, since Server 2008 and Bluetooth is a nightmare >.<
I keep getting read-only errors when copying into /system/xbin. I've remounted /system as read-write too. (RC30 v1.2)
And if I try to execute pand from /sdcard, I get Permission Denied errors.
Any thoughts, anyone?
The /system/xbin folder is a mounted cramfs image. So is /system/modules. Cramfs is a readonly file system.
I had to use cramfs to compress those two folders because it wouldn't all fit in /system otherwise.
If you really want to add/change something, unmount the folder, and you'll see an xbin.cramfs file in the folder instead. Download that to your computer and use the tools provided by the cramfs project to extract and repack it. Keep in mind the space limitations in /system. There isn't much space left at all
When I run this, the network interface bnep0 isn't created. Here's what happened:
I modified the tether script over in the iptables thread to load the bnep.ko module and run pand, etc.
When I ran my new script, I got an error because I forgot to set the execute permissions on pand. So, I changed the permissions.
Before I went to run the script again, I wanted to get back to my original state, so I tried to 'rmmod bnep'. That failed. I ran 'ps', and saw this process: kbnepd bnep0. I tried to kill it, which didn't work. I turned off BT from the UI, and the process ended. Then I did an rmmod bnep, and it worked.
I re-enabled BT from the UI, and went to run my script again. This time I got a new error and discovered it came from ifconfig. Sure enough, if i run 'busybox ifconfig -a' there is no interface named bnep0. When I did a 'ps' there was no longer this process called kbnepd bnep0.
I have rebooted the phone several times, recopied the module, and even upgraded to JF's v1.2 ROM (from v1.1). Still, whenever I do an 'insmod pathtomodule/bnep.ko', no network interface is created (there are no errors that output to the screen either and 'rmmod bnep' works as well with no errors).
Any ideas?
P.S. In the "Wireless controls" UI, when you tap the Bluetooth checkbox, does the text below remain "Select to turn on Bluetooth" when BT is enabled?
jbruer said:
When I run this, the network interface bnep0 isn't created.
Click to expand...
Click to collapse
Doh... the network interface isn't created until pand gets an incoming connection. pand has an option to run a script when the interface comes up, so I'll try to use that to run the rest of my setup script.
FYI..
I played around with this setup today and the adhoc-wifi tethering is much easier to setup and a lot faster.
Tethering via bluetooth I was only seeing about 70Kb/s, while Tethering via wifi I'm seeing 300+Kb/s.
Not sure if this is a bluetooth issue or what, but getting the bluetooth connection up and running is a pain in the ass compared to adhoc wifi.
Like others have stated, you have to start the pand service(also make sure in bluetooth settings the g1 is discoverable, only lasts 120 seconds) once the connection is established you can complete the other setups...
Hey, thanks for the tip about the calling the script. The connection speed sucks, but at least the setup is easier.. You still need to turn on bluetooth, and make it discoverable so windows can see the NAP and connect to it..
Here's my setup: I use dsnmasq for DHCP...
(blue.sh)
#!/system/bin/sh
insmod /data/local/bin/bnep.ko
/data/local/bin/pand --listen --role NAP --devup /data/local/bin/blue2.sh
(blue2.sh)
#!/system/bin/sh
ifconfig bnep0 192.168.2.1 netmask 255.255.255.0
ifconfig bnep0 up
/data/local/bin/iptables -F
/data/local/bin/iptables -I INPUT -s 192.168.2.254 -j DROP
/data/local/bin/iptables -I FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
/data/local/bin/iptables -I FORWARD -s 192.168.2.0/24 -j ACCEPT
/data/local/bin/iptables -I FORWARD -s 192.168.2.254 -j DROP
/data/local/bin/iptables -P FORWARD DROP
/data/local/bin/iptables -t nat -I POSTROUTING -s 192.168.2.0/24 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
/data/local/bin/dnsmasq -x /data/local/bin/dnsmasq.pid
parrothd said:
FYI..
Tethering via bluetooth I was only seeing about 70Kb/s, while Tethering via wifi I'm seeing 300+Kb/s.
Click to expand...
Click to collapse
Can anyone else reproduce this? (FYI it will share a wifi link but unfortunately, I'm in EDGE and my wifi is WPA2 .. so my wifi connectivity only lasts 5-10 seconds at a time, and edge is.. well.. edge..)
Disconn3ct said:
Can anyone else reproduce this? (FYI it will share a wifi link but unfortunately, I'm in EDGE and my wifi is WPA2 .. so my wifi connectivity only lasts 5-10 seconds at a time, and edge is.. well.. edge..)
Click to expand...
Click to collapse
I can confirm this. I'm in an EDGE area this weekend, so I tested by sharing a Wifi connection. Speedtest on the phone gave 4 Mbps down. Sharing over BT gave 89 kbps down. Also, when I ping the phone while connected to the PAN, I get latency around 30-50ms. Latency to google.com using the shared Wifi was around 250ms.
This may not be related, but if you look in the git for the Dream platform, init.trout.rc has this section: (http://android.git.kernel.org/?p=platform/vendor/htc/dream.git;a=blob;f=init.trout.rc;h=de41a72986890868b07d34c347245396be9f8f90;hb=HEAD)
Code:
64 service hciattach /system/bin/hciattach \
65 -n -s 115200 /dev/ttyMSM0 texas 115200 flow
66 user bluetooth
67 group bluetooth net_bt_admin
68 disabled
I know that hciattach is the BT service, and it appears that its creating a 115k baud serial port. The module we load emulates an ethernet adapter (bnep0), but I'm not sure if this serial device has any relation. Anybody around here know what the deal with this is?
Hmm. that's a good point. I'll play around with it a bit today and see if it's related
Just a quick update on this, google is working on a faster bluetooth driver, which will (automagically) make this faster too.
parrothd said:
Hey, thanks for the tip about the calling the script. The connection speed sucks, but at least the setup is easier.. You still need to turn on bluetooth, and make it discoverable so windows can see the NAP and connect to it..
Here's my setup: I use dsnmasq for DHCP...
...
/data/local/bin/dnsmasq -x /data/local/bin/dnsmasq.pid
Click to expand...
Click to collapse
WOW! Nice job. Could you please put your compiled dnsmasq somethere?
Strange thing. I setuped everything. Seeing iface on my phone via busybox ifconfig. Phone could ping himself via it's bluetooth IP.
Also PC could itself. Ifaces up and active on both sides.
But on PC I am having 0 recieved packets thru virtual bluetooth nic. While on phone i am having both RX and TX. And funny thing what RX on phone is exactly equal to TX on PC. So actually connection working but only one way...
WTF is what? Haven't even idea which way to look into this problem. Anyone have any idea about that?
hmepas said:
WOW! Nice job. Could you please put your compiled dnsmasq somethere?
Click to expand...
Click to collapse
i didn't compile it, but it's available in the iptables thread, if you can't find it I'll post it, having said that, you can also use udhcpd from busybox as well...
parrothd said:
i didn't compile it, but it's available in the iptables thread, if you can't find it I'll post it, having said that, you can also use udhcpd from busybox as well...
Click to expand...
Click to collapse
Oh thanks. I found it easily.
Btw could explain those two lines in your script:
Code:
/data/local/bin/iptables -I INPUT -s 192.168.2.254 -j DROP
/data/local/bin/iptables -I FORWARD -s 192.168.2.254 -j DROP
any secret here? for me those lines is complete useless. Or it's just your local issue which you didn't clean up before publishing script?
They're not needed, but you may want them.
dnsmasq and probably busybox udhcp will only start if you have at least 1 ip available for DHCP assignment(as far as I can tell).
This allows anyone to connect to your G1 mobile when in ad-hoc wifi mode and get access to the internet. Probably something you don't want to allow, with the limited speed and caps.
I use dnsmasq to staticly assign my laptop 192.168.2.30(cux I'm lazy and don't want to manually assign my IP), while assigning everyone else that connects to my G1 IP 192.168.2.254 which I then drop all access via iptables, so they have no access.
If you can figure out how to get dnsmasq or busybox udhcp to provide only static IP assignments then this is not needed...
My dnsmasq.conf changes..
# Uncomment this to enable the integrated DHCP server, you need
# to supply the range of addresses available for lease and optionally
# a lease time. If you have more than one network, you will need to
# repeat this for each network on which you want to supply DHCP
# service.
dhcp-range=192.168.2.254,192.168.2.254,30m
# Always allocate the host with ethernet address 11:22:33:44:55:66
# The IP address 192.168.0.60
dhcp-host=00:13:ce:b7:a8:0e,192.168.2.30
I found that if you set the lease time to 0, dnsmasq will not assign an IP address unless it's statically assigned. You still should setup some filtering to keep people of your network, but most users won't bother trying to figuring that out.
# Uncomment this to enable the integrated DHCP server, you need
# to supply the range of addresses available for lease and optionally
# a lease time. If you have more than one network, you will need to
# repeat this for each network on which you want to supply DHCP
# service.
dhcp-range=192.168.2.254,192.168.2.254,0
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
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?
I have a Galaxy Spica so no patched wpa_supplicant for android 2.1.
But I rooted and I have a working ad-hoc wifi connection through my laptop.
I can browse the net openvpn is working but all the apps like market, skype not.
I think there is somewhere something Connectivity Manager, Network Manager or else and the actual state of the connection is registered. Is there a way to register the new connection from commandline? to be able to use ad-hoc connection for market and co.
It should automatically find the connection unless you messed with your wifi connection
I have a script:
--- cut ---
#!/system/bin/sh
/system/xbin/killall wpa_supplicant
/system/xbin/killall dnsmasq
/system/xbin/ifconfig eth0 down
/system/bin/rmmod dhd
echo "Load wifi module..."
/system/xbin/insmod /lib/modules/dhd.ko firmware_path=/data/data/android.tether/bin/rtecdc.bin nvram_path=/etc/nvram.txt
echo "Waiting..."
sleep 5
echo "Activating ad-hoc mode..."
/system/bin/wpa_supplicant -Dwext -ieth0 -B -c/sdcard/w/wpa.conf
sleep 2
echo "Up interface"
/system/xbin/ifconfig eth0 10.99.0.2 broadcast 10.99.255.255 up
echo "Add default route"
ip route add default via 10.99.0.1 dev eth0
echo "Set DNS servers..."
setprop net.eth0.dns1 10.99.0.1
setprop net.dns1 10.99.0.1
echo "Done "
--- cut ---
based on [Dev] WiFi Ad-Hoc on i5700. Access to Internet via notebook (WIndows 7) - samdroid.net but with stock wpa_supplicant with this config:
--- cut ---
ctrl_interface=/data/misc/wifi
ctrl_interface_group=wifi
update_config=1
ap_scan=2
fast_reauth=1
network={
ssid="SpicaSzim"
key_mgmt=NONE
mode=1
frequency=2412
auth_alg=SHARED
wep_key0="xxxxx"
wep_tx_keyidx=0
}
--- cut ---
I update the apps through appbrain everything is fine but download of the app.
I got ads and all the stuff can search and so... and skype say that is a network problem but I see no packets go in my laptop at all...
I have no wifi status icon near the clock.
Now I have SamdroidMod 2.2.2 from samdroid kitchen (android 2.2.2r1).
I switched on the Portable Hotspot connected the PC with it.
Than I added a default route in phone go to my PC. I made masquerading in PC.
There is no firewall in action.
I can ping everything. Browser works. Openvpn works.
But no suggestion. No voice search. No download from Market. No Funambol client
I tcpdumped all devices in the phone (eth0, wl0.1, lo) there is not a bit going trough these interfaces while I was trying to make sync with Funambol or trying voice search or market download. But there was a lot of traffic while I was pinging something or browsed on net.
So there is something to be set if someone has a working link to the Net. Have a working link is not sufficient. DNS server was 8.8.8.8 but dns isn't the problem either.
After trying several methods (tiwlan.ini, wpa_supplicant.conf, wpa_supplicant patch) to get my Motorola Milestone to connect to my Laptop's Adhoc wifi network with no success, i finally come up with a solution. Now I am sharing it here hoping it will help those with the same problem.
The idea is to use Barnacle (on Market) to first setup a connection with the laptop, then re-config it to make the sharing work in the reverse direction.
Steps are as followed:
1. Start Barnacle (you may check "Local Mode" in Settings to go ahead without a data connection in phone), then connect your laptop to the wireless network it creates (named milestones or so). After this step, your phone's IP will be something like :192.168.5.1, and your Laptop's IP will be something like: 192.168.5.100
2. Start sharing your data connection from Laptop, in doing that, your Laptop's IP will be forcibly set to 192.168.0.1 (yours may be different, just note that this IP will be used as default gateway we use in the next step)
3. Now the configuration part:
//Start adb shell by entering at Cmd prompt
adb shell
$
su
#
//mannualy set IP for your phone, can be anything in form of 192.168.0.xxx
# ifconfig tiwlan0 192.168.0.2 netmask 255.255.255.0
//manually set the default gateway of the phone to the Laptop's IP at this time
# route add default gw 192.168.0.1 dev tiwlan0
After these steps, the phone can access the internet via the Laptop's connection. We will complete the remaining by manually specifying a DNS for the phone
# setprop net.dns1 #.#.#.# (here you should replace the #.#.#.# to a known IP address of your ISP's DNS, in worst case you may use Google's DNS)
//Now test with ping to see if we receive any response:
# ping -c 4 192.168.0.1 => the Laptop should answer
# ping -c 4 191.168.0.2 => phone are pinging itself, the phone should answer
# ping -c 4 209.85.175.106 => some server in the Internet should answer
# ping -c 4 www dot google dot com => Google should answer
If the tests above are all OK, you are done, enjoy the internet from your phone !
have tried :
+ Mail OK
+ Browser OK
+ Internet radio OK
+ Market nearly OK (in here the app browsing is OK, but download seem stuck)
Please confirm your result,
Codelavie
not working. i follow your guide exactly, but it didn't work. how can you do that? where am i wrong?
Didn't work for me either. After quite a hard experience I've managed to compile a wpa_supplicant with adhoc support for Milestone 2.1-update1 after applying szym's patch, and so far it works fine. The only thing you need to do is substituting the original system/bin/wpa_supplicant for the patched one, and restart wifi. I cant post the link yet because I'm new in the forums, but I'll post it as soon as i can.