Connect G1 to ad hoc or usb to use pc internet - G1 Android Development

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?

Related

Internet on G1 via USB cable (Reverse Tethering)?

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

[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

[FIXED] Adhoc working without any file editing !!!

Just tried this out and it connected to my laptop adhoc wireless fine. Wish the rom creators will put this in their builds...
http://forum.xda-developers.com/showthread.php?t=754961
Use the one at the bootom of the page as it has a newer wpa_supplicant 0.6.10
Sounds great, have to try this out!
why would we need this when we have the HTC mobile hotspot app?
neowlchaz said:
why would we need this when we have the HTC mobile hotspot app?
Click to expand...
Click to collapse
Mobile hostpot is to use the desire's wifi as a hotspot for connecting *other* devices to use the 2g/3g network.
This is for connecting the desire to a adhoc network like the wifi network on your laptop. Some laptop wifi cards for example can set them selves into AP mode so they are a true access point and the desire can connect to it, however most cards don't support that mode (well mine doesn't anyhow) so you need to create a ad-hoc network on your laptop that ultimately routes out to the internet via your wired network connection. This is where the desire cannot connect to that ad-hoc network without this 'hack'.
When you are roaming this is invaluable with extortionate roaming data charges so this is a way to reuse your wired connection on your laptop as a gateway for your desire. It's in effect a reverse hotspot.
Wonderful!!!!!
Finally!!!!I'm searching it from a lot of time!!!!
Now all works wonderful!!!
Thanks a lot to all!!
Sent from my HTC Desire using Tapatalk
I noticed that the binary in the link above was for an older wpa_supplicant (0.5.11) and Desire and the new froyo's are on 0.6.10 of wpa_supplicant so i repatched and compiled.
For those with the writeable /system hack, just disable wifi, push this on your /system/bin and reenable wifi. Else push this at recovery time
Code:
adb push wpa_supplicant /system/bin/
I also changed the "(*)" prefix for adhoc networks as i didn't like the look of the wifi list so now it's changed to "(adhoc)" suffix for adhoc networks it sees.
Diff and binary attached below.
daveba said:
so i repatched and compiled.
Click to expand...
Click to collapse
Why not provide as Update.zip ? Thanks!
daveba said:
I noticed that the binary in the link above was for an older wpa_supplicant (0.5.11) and Desire and the new froyo's are on 0.6.10 of wpa_supplicant so i repatched and compiled.
For those with the writeable /system hack, just disable wifi, push this on your /system/bin and reenable wifi. Else push this at recovery time
Code:
adb push wpa_supplicant /sytem/bin/
I also changed the "(*)" prefix for adhoc networks as i didn't like the look of the wifi list so now it's changed to "(adhoc)" suffix for adhoc networks it sees.
Diff and binary attached below.
Click to expand...
Click to collapse
Thank you, it seems to work, but no possibility to set a protection on the wifi, no ask for password...
Orphee said:
Thank you, it seems to work, but no possibility to set a protection on the wifi, no ask for password...
Click to expand...
Click to collapse
Strange, works for me. I've set up a WEP on my linux lappie wifi card and it works fine and pops up the password dialog.
bleh815 said:
Why not provide as Update.zip ? Thanks!
Click to expand...
Click to collapse
Ok, try this
daveba said:
Strange, works for me. I've set up a WEP on my linux lappie wifi card and it works fine and pops up the password dialog.
Click to expand...
Click to collapse
I tried WPA AES ...
daveba said:
Ok, try this
Click to expand...
Click to collapse
Kudos 10char
Orphee said:
I tried WPA AES ...
Click to expand...
Click to collapse
http://www.sprintusers.com/forum/archive/index.php/t-195868.html
try tkip ?
Can anyone post a complete guide what to do in my desire and what to do in my pc using WinXp or Win7.
*With Ad-hoc I can share my internet connection from notebook with desire and inverted ?
daveba said:
http://www.sprintusers.com/forum/archive/index.php/t-195868.html
try tkip ?
Click to expand...
Click to collapse
WPA AES works well in AP mode (I can switch my PCI can into AP mode)
Orphee said:
WPA AES works well in AP mode (I can switch my PCI can into AP mode)
Click to expand...
Click to collapse
Strange, then this must be a generic bug with ad-hoc networks (i.e. not something this patch/hack has introduced) so you will see the same results if you edit the wpa_supplicant.conf files manually correct ? It looks from this that adhoc supports only open or WEP encrypted network (in wifi tether too you can only use WEP). See the thread here:
http://forum.xda-developers.com/showthread.php?p=7726880
Lior84 said:
Can anyone post a complete guide what to do in my desire and what to do in my pc using WinXp or Win7.
*With Ad-hoc I can share my internet connection from notebook with desire and inverted ?
Click to expand...
Click to collapse
Yeah I need that too. I have gone through the thread but I didnt understand how to go about connectiong my HTC Desire to my laptop's internet...Pls help!
tochie009 said:
Yeah I need that too. I have gone through the thread but I didnt understand how to go about connectiong my HTC Desire to my laptop's internet...Pls help!
Click to expand...
Click to collapse
Flash the zip provided in the thread, and google 'windows setting up adhoc network'
Ensure not to choose WPA2-AES key for the password, but a WEP password. Then select wifi networks on your phone and choose your network and put in the password you selected.
For linux it's easy too. First disable wifi scanning on your applet in the top right as you want to disable it as a client and make it as a server. So as root do this (assuming your wireless interface is called wlan0) and want to create a network on 10.0.0.x
Code:
DEV=wlan0
iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo 1 >/proc/sys/net/ipv4/ip_forward
ifconfig $DEV down
iwconfig $DEV essid 'Laptop WiFi'
iwconfig $DEV mode ad-hoc
iwconfig $DEV key s:mykey
ifconfig $DEV 10.0.0.1 netmask 255.255.255.0
/usr/sbin/dnsmasq --dhcp-range=10.0.0.2,10.0.0.10 -x /tmp/dnsmasq-$DEV.pid -i $DEV
Thank you very much for this hack, Daveba! Don't really need this as of now, but could be handy in the future. One, probably silly question, does it have any negative impact when connecting to a standard Wi-Fi router, or it just provides additional functionality?
Hopefully we can see this included in various Roms soon.
Good day!
Sent from my DynaTAC 8000X.
phunkycow said:
Thank you very much for this hack, Daveba! Don't really need this as of now, but could be handy in the future. One, probably silly question, does it have any negative impact when connecting to a standard Wi-Fi router, or it just provides additional functionality?
Hopefully we can see this included in various Roms soon.
Good day!
Sent from my DynaTAC 8000X.
Click to expand...
Click to collapse
Well please don't credit me with the work. As noted in the first post, the initial patch was released for an older version of wpa_supplicant. I've just updated it for wpa_supplicant 6 and changed some aesthetics on the wifi list page on the phone. Remember again this is a hack and should really be inherently supported by the OS. I suggest people read issue 82 and star the issue for greater visibility.
I would like to know if anyone sees any negative impact with this hack. The only thing i see is that the phone doesn't automatically disconnect from the ad-hoc network if i take it down on my laptop or i move away from the signal range. It will drain the battery if not manually disconnected. This is a small 'bug' for what (in my opinion) is such a hugely important function. Hell even the iphone, the nokia E71, etc can do this out of the box and i get laughed at at work (until now).

TUN/TAP driver for openvpn available yet?

As the subject states, non of the current roms/kernels appear to have the TUN/TAP driver to run openvpn.
Side note.. ATT pissed me off today (okay so I had it coming for tethering but still..) So, new solution is to run openvpn and force all the traffic through my openvpn gateway, this will keep ATT from spying, and also prevent them from using TTL (still speculation, but one of the methods to detect tethering)
Just out of curiosity, how did you confirm that the TUN/TAP driver was non-existant or not operating properly on the skyrocket?
I'm in the midst of doing the same ... installing openvpn. I have the server set up on my home PC and verified through another laptop off-network. But I have problems when trying to run openvpn settings. Here is what I did:
1) Copied .ovpn file, ca.crt, client1.crt, client1.key, ta.key FROM server TO /sdcard/openvpn directory on skyrocket
2) Installed busybox
3) Installed openvpn installer
4) Installed openvpn using #3
5) Installed and opened openvpn settings
6) Under "OpenVPN Settings" I checked the box saying "OpenVPN"
7) Under "OpenVPN Configurations", I selected my .ovpn file's checkbox
8) The .ovpn checkbox immediately disables and I have no openvpn
Was your approach similar?
I just checked via lsmod. I did not bother going through the process of moving my config files from my captivate to the skyrocket.
Samsung does not include the tun/tap driver in the stock kernel, so it will require a custom kernel, or at least someone to create the module with the same libraries as the stock kernel and just the tun.ko module file to copy across to our current phones.
Actually TUN/TAP is compiled directly into the stock kernel and not compiled as a module so you won't find it with lsmod. You also don't need to do an insmod to use it. I'm running openvpn just fine in tap mode.
There IS a bug in the OpenVPN Installer though that requires you to have ifconfig and route in /system/xbin/bb. It won't work if you select anything else during the openvpn install.
Here's what I did...
Install busybox to /system/xbin
Install openvpn to /system/xbin and select /system/xbin/bb as the location of ifconfig/route
adb shell or use a terminal on the device and do a su.
mount -o rw,remount /dev/block/mmcblk0p24 /system
mkdir /system/xbin/bb
cd /system/xbin/bb
ln -s ../busybox ifconfig
ln -s ../busybox route
mount -o ro,remount /dev/block/mmcblk0p24 /system
Configure and start openvpn.
Good to know.
Will try it in abit, I tried to run openvpn, but it failed on the tun driver, which is why I stopped, but I did not link bb, will give that a try when I get a chance... stupid ATT busted me for unauthorized tethering again.. so cannot get my existing openvpn config from my server yet...
gtj0:
I tried the directions you provided but with using tun and no luck. I'll try and reconfigure my openvpn server to run tap and will try agian.
jvanbrecht:
let me know if you make any progress
plarser48 said:
gtj0:
I tried the directions you provided but with using tun and no luck. I'll try and reconfigure my openvpn server to run tap and will try agian.
jvanbrecht:
let me know if you make any progress
Click to expand...
Click to collapse
I just reconfigured my server over to tun mode and it's still working fine.
Can you try running openvpn from a command line and see what errors it spits out?
I.E. openvpn --config server.ovpn
Also can you check if /dev/tun exists?
edit.....
Here's my config...
client
dev tun0
proto udp
float
remote vpn.example.com 21194
resolv-retry infinite
nobind
persist-key
persist-tun
ca vpn.example.com.ca.crt
cert zzz.crt
key zzz.key
tls-auth vpn.example.com.ta.key 1
cipher AES-256-CBC
comp-lzo
verb 4
mute 20
plarser48 said:
gtj0:
I tried the directions you provided but with using tun and no luck. I'll try and reconfigure my openvpn server to run tap and will try agian.
jvanbrecht:
let me know if you make any progress
Click to expand...
Click to collapse
I had no problems getting it to work, I borrowed my co workers usb modem to pull down my configs from my old Captivate (I use ssl-admin and store the configs with the certificates in zip format).
The problem I am having at the moment is getting tethering to work while openvpn is running.
Laptop can talk to the phone (using wifi tethering, usb tethering kills the adb session, but I suspect it would work just fine), and phone can talk to the world, but laptop will not connect to the world.
The routes are in place, I checked the sysctl options, and ip forwarding is enabled. Just no traffic will pass... it is driving me nuts... heh.
Success for me too! Not sure what was wrong. The server was always working no problem and was always able to connect directly over home wifi from laptop. But I wasn't able to connect on the Skyrocket.
But I used gtj0's config file, changed the remote ip address/port, and worked perfectly. Thanks!
jvanbrecht: I haven't tried it with tethering yet and probably won't get to until at least a few days. Hope to be able to help by trying on my phone sometime soon.
Everyone: Any idea if it is better to run tun or tap for mobile phone openvpn? Regarding tethering, do both tap and tun hide detectable elements like TTL at the IP layer?
EDIT: VPN Not Porting Properly?
Hmm. It seems I am able to connect no problem and openvpn on the phone says it's connected. But when I go to www.whatismyip.com from my phone, it still says an AT&T address. I expected with openvpn running that it should show my home server ip address no? Also, openvpn on skyrocket indicates that it is connected as 10.3.0.6. But if I try to ping 10.3.0.6 from the server I get no response. Is that expected?
plarser48 said:
Success for me too! Not sure what was wrong. The server was always working no problem and was always able to connect directly over home wifi from laptop. But I wasn't able to connect on the Skyrocket.
But I used gtj0's config file, changed the remote ip address/port, and worked perfectly. Thanks!
jvanbrecht: I haven't tried it with tethering yet and probably won't get to until at least a few days. Hope to be able to help by trying on my phone sometime soon.
Everyone: Any idea if it is better to run tun or tap for mobile phone openvpn? Regarding tethering, do both tap and tun hide detectable elements like TTL at the IP layer?
EDIT: VPN Not Porting Properly?
Hmm. It seems I am able to connect no problem and openvpn on the phone says it's connected. But when I go to www whatismyip com from my phone, it still says an AT&T address. I expected with openvpn running that it should show my home server ip address no? Also, openvpn on skyrocket indicates that it is connected as 10.3.0.6. But if I try to ping 10.3.0.6 from the server I get no response. Is that expected?
Click to expand...
Click to collapse
TAP provides a bridged connection so broadcasts on the server's network are propagated across the connection. For network-to-network connections this may be needed for things like dhcp and windows networking. For end users, this usually isn't a good thing because it eats up bandwidth. TUN, which is routed instead of bridged, is the better way to go.
My config only routes traffic destined for the server's LAN over the vpn connection so the behavior you see with whatsmyip is normal. Check openvpn's config file paramters to make the vpn the default route for all traffic.
See my other post. I included my configs.
Just add redirect-gateway option to your client configuration, or the server side client configuration in the ccd directory.
I have everything working. As for what att will see. Only an encrypted tunnel initiated from you phone to your vpn server. Ttl, ip options etc will not be visible to att.
Sent from my SAMSUNG-SGH-I727 using XDA App
Cool thanks again. I'll try updating my configs and trying again tonight. I'm sure not being able to ping across the tunnel was probably a configure issue a well.
You also need the Client to Client option enabled if you want the openvpn server to advertise routes to other vpn client devices and their associated networks. That would be another reason why you cannot ping across the tunnel if you are trying to ping another vpn device.
jvanbrecht:
I'm not seeing your config files on the board here. I'm fairly new here so maybe I'm not looking at the right place. But I didn't see an attachment.
The configs are posted in my other thread.
http://forum.xda-developers.com/showthread.php?t=1378970
Thank you. I'll try out the details in that post. If I have any questions I am going to post over there from now on because that post is more closely aligned with my goal and thus more relevant.

[Q] moto g - using PC broadband on moto g

Hi,
I own a moto g and I have a broadband connection on my PC. Is there any way I use that to access internet on my moto g ?
If there is please explain.
Thanks & Regards
Gilagamesh
gilagamesh said:
Hi,
I own a moto g and I have a broadband connection on my PC. Is there any way I use that to access internet on my moto g ?
If there is please explain.
Thanks & Regards
Gilagamesh
Click to expand...
Click to collapse
do you have a desktop or a laptop ..
if desktop then you should try some apps like reverse USB tethering ..which are very simple to use ..
there are too many apps like this which you can find on the play store ..
Sent from my GT-I9300 using XDA Premium 4 mobile app
Thru Ethernet cable? If so change your modem to WiFi modem if using from data card use WiFi dongle search ebay
Sent from my XT1033 using Tapatalk
Well if you are on laptop...you can use this software known as Connectify to set up a Hotspot on ur laptop
You can do that with a wifi adapter on a PC too
jaspreet997 said:
Well if you are on laptop...you can use this software known as Connectify to set up a Hotspot on ur laptop
You can do that with a wifi adapter on a PC too
Click to expand...
Click to collapse
By the way I am using a Desktop PC and I don't have a Wifi adapter. But can't I use usb cables for connecting internet on my mobile? I that mandatory that I purchase a Wifi adapter?
gilagamesh said:
By the way I am using a Desktop PC and I don't have a Wifi adapter. But can't I use usb cables for connecting internet on my mobile? I that mandatory that I purchase a Wifi adapter?
Click to expand...
Click to collapse
Not at all
There are some reverse tethering apps to get ur pc's internet just by USB cable but they need a rooted phone!
Search on play store " reverse tethering"
If you don't wanna root....invest in a router...they are pretty cheap nowdays!
Sent from Samsung Chat
@gilagamesh
You can do it without using any apps ...u just have to enter some commands in ur PC and ur phone by terminal emulator.. Will help u PM me..
NOTE:: Root is required .
Sent from my XT1033 using xda premium
You can setup an ad hoc wifi network and share the internet connection to connected devices.
You can do it using the Control Panel or using the CMD.
In Windows 8 this functionality ist not available anymore using the GUI.
These commands should work on all windows pc's.
Replace ssid and key with your own if wanted.
Remember to open CMD with admin rights.
To configure adhoc network typ in CMD:
netsh wlan set hostednetwork mode=allow ssid=NameForMyNetwork key=MySecurityKey
Click to expand...
Click to collapse
To start adhoc network type in CMD:
netsh wlan start hostednetwork
Click to expand...
Click to collapse
To stop adhoc network type in CMD:
netsh wlan stop hostednetwork
Click to expand...
Click to collapse
Open properties of your network adapter on PC and you'll find an option to share the internet connection of connected devices of the specific adapter.
Connect your Android over wifi to your PC, voila, you should be done if i did not forget something.......
EDIT:
Aaaargh.....just saw it by reading it the thread a second time....you have no wifi.
But anyway, maybe it helps somebody else.
mokkami said:
You can setup an ad hoc wifi network and share the internet connection to connected devices.
You can do it using the Control Panel or using the CMD.
In Windows 8 this functionality ist not available anymore using the GUI.
These commands should work on all windows pc's.
Replace ssid and key with your own if wanted.
Remember to open CMD with admin rights.
To configure adhoc network typ in CMD:
To start adhoc network type in CMD:
To stop adhoc network type in CMD:
Open properties of your network adapter on PC and you'll find an option to share the internet connection of connected devices of the specific adapter.
Connect your Android over wifi to your PC, voila, you should be done if i did not forget something.......
EDIT:
Aaaargh.....just saw it by reading it the thread a second time....you have no wifi.
But anyway, maybe it helps somebody else.
Click to expand...
Click to collapse
A simpler way to go at it is a software called Connectify....completely gui based...I used to use it all the time on my laptop.....works on windows xp sp3 and up....
Sent from Samsung Chat
@mokkami
This is to create a wifi hotspot ...and as i see the person is using a desktop he might not have a wifi card...and even if u dn have wireless network connection 2 adapter you would notbe able to even create Wifi hotspot from a laptop ....and it does need service pack3 for windows 7
---------- Post added at 02:27 PM ---------- Previous post was at 02:23 PM ----------
I Dont remember the original thread but here are the contents i got fromthat link a while ago...
@gilagamesh
Step 1: Connect your Android to PC by USB cable and enable "USB tethering". You are still allowed to enable this option even when your 3g/wifi on your Android is off.
- If you are using Linux (Ubuntu), you don't need to install anything. NetworkManager applet will try to establish a connection on the new detected wired network device.
- If you are using Windows, Windows will automatically search Windows Update and install driver for you. You can skip Windows Update search and install manually an already included driver from Microsoft. In Install Driver window, click Browse My Computer, then Let me pick..., select Network Adapters, uncheck Show Compatible Hardware, look at "Microsoft Corporation" at the left column, and choose Remote NDIS Compatible Device from the right column. You can install or update a driver from Device Manager in Windows.
- If you are using Mac, install driver HoRNDIS. You will be notified about a new network interface. Click "Network Preferences" in the dialog to add it to known interfaces list. Then "Apply".
- If you are using Linux without GUI or NetworkManager, run these commands as root (or use sudo):
Code:
ifconfig usb0 10.42.0.1 netmask 255.255.255.0
(suppose that you don't have any other USB network adapter, otherwise, your Android may be usb1, usb2...)
Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
Command for sudo will be:
Code:
sudo 'echo 1 > /proc/sys/net/ipv4/ip_forward'
Code:
iptables -t nat -F
iptables -t nat -A POSTROUTING -j MASQUERADE
Step 2:
- If you are using Linux, click on NetworkManager applet at the top right of your screen, select "Edit Connections...". In tab "Wired", choose the new established connection (be careful, not Ethernet LAN connection) and click "Edit..." In tab "IPv4 Settings", choose "Shared to other computers" as Method. Click "Save". NetworkManager will reestablish the connection and assign to your PC an IP address on this USB network connection, default: 10.42.0.1. Leave Internet connections (wired or wireless) untouched.
- If you are using Windows, open "Network Connections" in Control Panel. It is somewhat different from setup in Linux. Right click on an Internet connection that you have. I assume that you are using a desktop which doesn't have any wifi adapter, so right click on LAN Ethernet connection with Internet, and select "Properties". In tab "Sharing" (or "Advanced" for Windows XP), click "Allow other network users to connect through...", then select the USB connection in dropdown list below. Click OK. Windows will automatically setup your USB network connection and assign to it an IP address, default for Windows 7: 192.168.137.1, default for Windows XP: 192.168.0.1. You can see your Internet connection is now "Shared" and your USB connection is now "Unidentified network".
- If you are using Mac, open System Preferences - Network. If you installed HoRNDIS, you will see a new network interface corresponding to your USB connection. With "Using DHCP" as Configure Ipv4, it may be already connected. Go back to System Preferences, click "Sharing". Select "Internet Sharing". Choose the Internet connection (Ethernet or Airport...) in "Share your connection from", and choose USB connection interface in "To computers using". Mac will assign to your USB connection interface an IP address, default: 192.168.2.1.
- If you are using Linux without GUI or NetworkManager, you have done all PC setup in step 1.
Your PC setup is now done!
Step 3:
Open Terminal Emulator on your Android. Type:
Code:
su
The command prompt must change from $ to #. If it does not, check to ensure that your device is rooted properly.
[UPDATED]Type the following command in Terminal Emulator, the same for all PC operating systems:
Code:
netcfg rndis0 dhcp
The name for usb interface inside Android may vary. It is usually rndis0 or usb0. Type
Code:
busybox ifconfig
to identify the name.
Use OLD instructions below when automatical dhcp method does not work.
[OLD]Type these following commands in Terminal Emulator:
For Linux PC:
Code:
ifconfig rndis0 10.42.0.2 netmask 255.255.255.0
route add default gw 10.42.0.1 dev rndis0
If route fails, try:
Code:
busybox route add default gw 10.42.0.1 dev rndis0
For Windows PC, use the same above commands, replace 10.42.0.2 by 192.168.137.2 (192.168.0.2 for Windows XP), replace 10.42.0.1 by 192.168.137.1 (192.168.0.1 for Windows XP)
For Mac PC, replace 10.42.0.2 by 192.168.2.2, replace 10.42.0.1 by 192.168.2.1
Now you can close Terminal Emulator and start the browser for Internet.
Some applications (download in Google Play, GMail, Facebook...) don't recognize Internet connection. You can try this way (WARNING: NOT TESTED):
- Enable temporarily 3G connection on your Android
- Type:
Code:
ifconfig rmnet0 0.0.0.0
The name for 3G interface inside Android may vary: ppp0, rmnet0... Type
Code:
busybox ifconfig
to identify the name.
before ifconfig rmnet0 ... above.
This will make applications see your Internet connection via USB as 3G!
And it works !!!
Yes it is to create a hotspot. And i wrote already that i read it to late that he has no wifi available.
prachetas13 said:
and even if u dn have wireless network connection 2 adapter you would notbe able to even create Wifi hotspot from a laptop
Click to expand...
Click to collapse
I do not understand what you mean. I created a wifi hotspot sucessfully on my netbook which was also connected via network cable.
mokkami said:
Yes it is to create a hotspot. And i wrote already that i read it to late that he has no wifi available.
I do not understand what you mean. I created a wifi hotspot sucessfully on my netbook which was also connected via network cable.
Click to expand...
Click to collapse
Its like most of them dn have those adapters ...i have thinkpad L430 but nt able to share internet ...but on my dell laptop it was easier ...i havetried a lot but netsh wlan commands doesnot work ...not even by connectify ...in the other hand it works good on my other laptop ...
well not losing the oroginal topic ...i have provided a method of reverse tethering ..

Categories

Resources