Tethering via WiFi - Troubleshooting

Search This thread

jashsu

Senior Member
Nov 15, 2008
1,849
20
I thought that this was just a way to limit my ad hoc connection from having others connect. Do I need to do anything else to be able to browse the internet?
If you used the "secure" script and conf then you MUST edit the conf file with your own MAC addresses (lines 153 and 154). Otherwise your client computer will be assigned .254 and all the traffic will be dropped by iptables.

Also, I don't know what happens if one computer has already been assigned the drop address (.254) and another computer without a valid MAC also tries to connect. Will dnsmasq just not give that computer a lease? parrothd have you tested it?
 
Last edited:

digital_1

Member
Aug 30, 2003
27
0
If you used the "secure" script and conf then you MUST edit the conf file with your own MAC addresses (lines 153 and 154). Otherwise your client computer will be assigned .254 and all the traffic will be dropped by iptables.

Are you sure about that? Because I forgot to edit the mac address, I ran tether-secure start and I'm posting this response from my laptop via G1.
 

jashsu

Senior Member
Nov 15, 2008
1,849
20
Are you sure about that? Because I forgot to edit the mac address, I ran tether-secure start and I'm posting this response from my laptop via G1.
If you just dumped the entire directory into your G1, then regardless of whether you ran tether-secure or tether, it is using dnsmasq.conf. You have to rename dnsmasq-secure.conf to dnsmasq.conf and delete the unsecured dnsmasq.conf to block out unregistered MACs

In the 1.5 release there are longer two separate tether scripts. Instead, there is a single tether script which drops 192.168.2.254. Whether you are running secured or unsecured is completely governed by the dnsmasq.conf file, specifically the entry at line 133:

on nonsecure:
dhcp-range=192.168.2.100,192.168.2.110,10
(Assign ten ip addresses to any client starting at .100)

on secure:
dhcp-range=192.168.2.254,192.168.2.254,0
(Assign anyone trying to connect .254)

The instructions in the first post (as well as the scripts themselves) need some more baking and fine tuning.
 
Last edited:

noredline

Member
Jan 3, 2009
5
2
I went through all of the steps listed under "The New Way" and am shown connected to the G1 Ad-hoc network but I am unable to get any pages to pull up. I rebooted the phone and still the same thing is going on. Pulling a 169.x.x.x ip address, checked my tcp/ip settings on my laptop and everything is set correctly. Any advice?
 

jashsu

Senior Member
Nov 15, 2008
1,849
20
I went through all of the steps listed under "The New Way" and am shown connected to the G1 Ad-hoc network but I am unable to get any pages to pull up. I rebooted the phone and still the same thing is going on. Pulling a 169.x.x.x ip address, checked my tcp/ip settings on my laptop and everything is set correctly. Any advice?
What is the exact ip address assigned? It should be 192.168.2.___ either 30, 100 or 254.
 

trmacdonal

Senior Member
Oct 18, 2007
145
9
Boston
I went through all of the steps listed under "The New Way" and am shown connected to the G1 Ad-hoc network but I am unable to get any pages to pull up. I rebooted the phone and still the same thing is going on. Pulling a 169.x.x.x ip address, checked my tcp/ip settings on my laptop and everything is set correctly. Any advice?

This is the same thing that happened to me. Has Anyone successfully been able to use "new way"? I believe there must be some editing to the the dnsmasq.conf file that needs to be done, but is not in the instructions. Unfortunately I do not have the answer.
 
Last edited:

jashsu

Senior Member
Nov 15, 2008
1,849
20
It's the same dnsmasq.conf file as before. I suggest trying rm dnsmasq.leases and dnsmasq.pid. These two files are generated by dnsmasq in the course of its normal operation, and I have no clue why parrothd included them. Then perform a tether stop and try again.
 

jashsu

Senior Member
Nov 15, 2008
1,849
20
169.254.118.231 and a subnet mask of 255.255.0.0 which I know are invalid.
You F-ed up somewhere along the way. That's a APIPA address that is assigned when no dhcp service is detected. Delete all associated files in /data/local and start over.

Edit: Actually, are you using the secured dnsmasq.conf or unsecured? If you are running unsecured the problem might be that all the leases are already taken up. If so, try using the secured conf.
 
Last edited:

noredline

Member
Jan 3, 2009
5
2
It's the same dnsmasq.conf file as before. I suggest trying rm dnsmasq.leases and dnsmasq.pid. These two files are generated by dnsmasq in the course of its normal operation, and I have no clue why parrothd included them. Then perform a tether stop and try again.

removed those two files which were located in data/local/ and when I try performing a stop tether it gives me an error of

/data/local/dnsmasq.pid: No such file or directory
could not kill pid -9: No such process

and it also will not allow me to start tether now because it says it is already in use
 

jashsu

Senior Member
Nov 15, 2008
1,849
20
Ah crap I thought your tether was already stopped. You need to remove leases and pid while tether is stopped. Do a reboot now, remove the leases and pid then start tether.
 

Sistum Id

Senior Member
Jan 2, 2009
497
26
Phoenix
I ended up using this tether method today at work for about a good 4 hours. I had my G1 hooked up to my laptop via usb cord to keep it charged. Well after I was done and shut everything down about 5 minutes later I get a low battery at 15% message and few minutes later it dies. I was shocked that it died after it was on the charger the whole time.

So what does this mean?

Bad usb cable, bad usb ports on laptop, or bad battery on G1? But come on, does the G1 really use that much power to tether?
 

jashsu

Senior Member
Nov 15, 2008
1,849
20
I ended up using this tether method today at work for about a good 4 hours. I had my G1 hooked up to my laptop via usb cord to keep it charged. Well after I was done and shut everything down about 5 minutes later I get a low battery at 15% message and few minutes later it dies. I was shocked that it died after it was on the charger the whole time.

So what does this mean?

Bad usb cable, bad usb ports on laptop, or bad battery on G1? But come on, does the G1 really use that much power to tether?
Hm.. when you plugged the G1 in did the charging indicator come up? iirc my G1 has always remained fully charged up during tethering when leeching 500mA off of USB.
 

donutman

Senior Member
Nov 13, 2007
277
16
You F-ed up somewhere along the way. That's a APIPA address that is assigned when no dhcp service is detected. Delete all associated files in /data/local and start over.

Edit: Actually, are you using the secured dnsmasq.conf or unsecured? If you are running unsecured the problem might be that all the leases are already taken up. If so, try using the secured conf.

I'm still getting the same problems as he is. Followed steps of the new way correctly. Finds the ad-hoc and connects fine but can't get any internet connection to go up. Even deleted those files you said and still didn't work. And then deleted the /data/local folder and started all over. Still didn't work. Whats up? Not sure how to do the unsecured/secured conf. Help me out please.
 
Last edited:

fuchsmi

Member
Jan 4, 2009
19
0
please add a changelog file to this project.

I don't know if it is worth updating from 1.2 to 1.5...
 

jashsu

Senior Member
Nov 15, 2008
1,849
20
Not sure how to do the unsecured/secured conf. Help me out please.
1. Install the contents of tether-1.5 as described in the "New Way".
2. Open the Term Emulator or adb and rm dnsmasq.pid, dnsmasq.leases, and dnsmasq.conf from /data/local.
3. adb pull dnsmasq.conf-secure to your desktop (or open the tar file on your desktop and extract dnsmasq.conf-secure).
4. Open it in wordpad or some text editor capable of parsing linux text files and perform the following:
These are lines 153 and 154 of dnsmasq.conf-secure, which you need to customize:

dhcp-host=00:14:a4:d6:a9:77,192.168.2.31
dhcp-host=
00:13:ce:b7:a8:0e,192.168.2.30

Get the mac addresses of the devices (e.g. laptops) you want to be able to tether and replace the red numbers above with them. If you only have one device, delete one of the lines. Likewise if you have more than two devices, add more lines. The static ips parrothd used (.30 and .31) should be fine. If you want to have different ones, alter only the last number (as this is a class c subnet), and do not make it .1 or .254.

dhcp-host=
<your_mac_address>,192.168.2.<#_btwn_2-253>
5. After you have finished editing the file, save it as dnsmasq.conf without the -secure and adb push it back into /data/local. If all went well you should now be able to run tether start and only connect with your authorized mac addresses.
 
Last edited:

jashsu

Senior Member
Nov 15, 2008
1,849
20
please add a changelog file to this project.

I don't know if it is worth updating from 1.2 to 1.5...
There is no functional change. Actually, the script liberally "borrows" from the one alansj originally posted a month ago here. The only change is the addition of dropping unauthorized macs in 1.1.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    FYI,

    I've been able to successfully use iptables to configure ip masquerading (NAT). With it, I am tethered over WiFi without using tetherbot (which still works as a backup). Hopefully someone else can package this to be more useful.
    Update: See posts #13 and #15 on how to use Ad-hoc mode.

    • Root required
    • Existing wifi network required (and configured)

    1> Disable WiFi through the UI. Then turn on Wifi manually using the following commands as root. Normally the phone data interface and WiFi can't be turned on at the same time. (Can this be done through the android gui somehow?)

    insmod /system/lib/modules/wlan.ko

    wlan_loader -f /system/etc/wifi/Fw1251r1c.bin -e /proc/calibration -i /system/etc/wifi/tiwlan.ini

    cd /data/local/tmp
    wpa_supplicant -f -Dtiwlan0 -itiwlan0 -c/data/misc/wifi/wpa_supplicant.conf &

    sleep 5
    ifconfig tiwlan0 192.168.2.30 netmask 255.255.255.0
    ifconfig tiwlan0 up

    Note that I had to use a static ip since dhcp will typically add in a gateway.

    2> Enable and configure ip forwarding

    iptables -I FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
    iptables -I FORWARD -s 192.168.2.0/24 -j ACCEPT
    iptables -P FORWARD DROP

    iptables -t nat -I POSTROUTING -s 192.168.2.0/24 -j MASQUERADE

    echo 1 > /proc/sys/net/ipv4/ip_forward

    3> On your computers, set your default gateway to your phone's WiFi IP address (192.168.2.30 - in my case). Also set your DNS to a real DNS server.

    Attached is the iptables binary, compiled with the android sdk.
    1
    You could I guess...

    Honestly it may be easier to just use adb to run the shell scripts that enable/disable the configuration.

    Hm, I've got it starting up from Terminal Emulator (Term.apk). I still have to type things on the command-line but at least I can start it up from my phone. First, I created this shell script to make it easier (which I named "tether" and stuck in /data/bin/):

    Code:
    #!/system/bin/sh
    
    case "$1" in
    'start')
    insmod /system/lib/modules/wlan.ko
    wlan_loader -f /system/etc/wifi/Fw1251r1c.bin -e /proc/calibration -i /data/local/tiwlan.ini
    ifconfig tiwlan0 192.168.2.1 netmask 255.255.255.0
    ifconfig tiwlan0 up 
    /data/local/bin/iptables -F
    /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 -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/dnsmasq.pid
    ;;
    'stop')
    rmmod wlan
    kill -9 `cat /data/local/dnsmasq.pid`
    /data/local/bin/iptables -F
    echo 0 > /proc/sys/net/ipv4/ip_forward
    ;;
    *)
    echo "Usage: $0 [start|stop]"
    ;;
    esac

    Then, I started up Terminal Emulator and called my 'suroot' binary (sh with setuid root). I tried calling 'tether start' directly but it was giving me permission denied errors. Then, I did this, which worked:

    Code:
    /data/local/bin/tether start | suroot

    Don't ask my why that works when calling it directly while in a shell via suroot does not work. In order to make it easier for myself, I put the above command into a 1-line shell script called "tetherup" which I placed in my /system/bin/ directory (because it's in my path). The net result is that via Terminal Emulator I can do the following to start up my tether:

    Code:
    # suroot
    # tetherup
    1
    I am on Windows Xp and that guide is what I was trying, but it does works with 2 PCs;
    the adhoc connection is working but the G1 does not show or connect it.
    I am on Haykuro 6.0r1
    It is strange that the applicazione WIFIScanner can catch my PCADSL adhoc but the G1 wifi Settings page does not show it even if I Add it with the Wi-Fi network options.
    The two images shows the WifiScanner application and the Wifi Setting page.
    Any Help?

    Hi. I have the same situation but I am using the app "Wifi Analyzer". Could anybody tell me if following the instructions in #13 we can connect the phone to the computer with the Ad-Hoc mode to use my broadband in my Gphone.

    Thanks.