Tiny Core Extensions > TCE Tips & Tricks
preventing dropped wifi connections [SOLVED]
GNUser:
Thanks again. Everything looks good now.
This was a tough one to solve. With virtually no clues from my machine and no personal access to workplace's router or router settings, I was just shooting in the dark. Hopefully the write-up will be of use to someone in a similar situation.
GNUser:
Just a quick follow-up: My original problem may have been a DHCP issue.
dhclient logs lease renewals in /var/db/dhclient.leases and I'm seeing a lease renewal every 12-15 minutes while at work. It seems that the DHCP server on workplace's router is psycho and gives out very short-lived leases. dhclient renews the lease as expected, but udhcpc was apparently not renewing the lease. Just a theory.
Rich:
Hi GNUser
--- Code: ---tc@box:~/tcprovides/db/10.x$ udhcpc --help
BusyBox v1.19.3 (2011-10-30 01:47:29 UTC) multi-call binary.
Usage: udhcpc [-fbnqoCRB] [-i IFACE] [-r IP] [-s PROG] [-p PIDFILE]
[-H HOSTNAME] [-V VENDOR] [-x OPT:VAL]... [-O OPT]... [-P N]
-i,--interface IFACE Interface to use (default eth0)
-p,--pidfile FILE Create pidfile
-s,--script PROG Run PROG at DHCP events (default /usr/share/udhcpc/default.script)
-B,--broadcast Request broadcast replies
-t,--retries N Send up to N discover packets
-T,--timeout N Pause between packets (default 3 seconds)
-A,--tryagain N Wait N seconds after failure (default 20)
-f,--foreground Run in foreground
-b,--background Background if lease is not obtained
-n,--now Exit if lease is not obtained
-q,--quit Exit after obtaining lease
-R,--release Release IP on exit
-S,--syslog Log to syslog too
-P,--client-port N Use port N (default 68)
-a,--arping Use arping to validate offered address
-O,--request-option OPT Request option OPT from server (cumulative)
-o,--no-default-options Don't request any options (unless -O is given)
-r,--request IP Request this IP address
-x OPT:VAL Include option OPT in sent packets (cumulative)
Examples of string, numeric, and hex byte opts:
-x hostname:bbox - option 12
-x lease:3600 - option 51 (lease time)
-x 0x3d:0100BEEFC0FFEE - option 61 (client id)
-F,--fqdn NAME Ask server to update DNS mapping for NAME
-H,-h,--hostname NAME Send NAME as client hostname (default none)
-V,--vendorclass VENDOR Vendor identifier (default 'udhcp VERSION')
-C,--clientid-none Don't send MAC as client identifier
Signals:
USR1 Renew current lease
USR2 Release current lease
tc@box:~/tcprovides/db/10.x$
--- End code ---
Maybe:
--- Code: ---udhcpc -i $iface -x lease:86400
--- End code ---
GNUser:
Thank you, Rich. I may revert to using iwconfig and udhcpc in the future. For now they're in timeout for giving me a headache >:( and I'm enjoying wifi simply working as expected.
If I do figure out how to make my script work with the more minimalistic tools, I'll make sure to post another follow-up. Maybe it really was just a matter of a missing option to udhcpc.
GNUser:
I got it working with udhcpc, so here is the promised follow-up.
It turns out that udhcpc was innocent. The cause for the dropped connections must have been either missing ipv6 support or using iwconfig to establish the connection.
Here are the commands I've been using to establish a rock-solid WiFi connection anywhere:
--- Code: ---0. Create some variables
# iface=wlan0
# auth_file=/tmp/wifi.conf
# ssid=SomeCoolHotspot
# password=SomePassword
1. Enable ipv6 (assumes ipv6-4.19.10-tinycore64.tcz is loaded)
# modprobe ipv6
2. Create wpa_supplicant config file
a. For open network:
# printf 'network={\n\tssid="%s"\n\tkey_mgmt=NONE\n}\n' $ssid > $auth_file
b. For secured network:
# wpa_passphrase "$ssid" "$password" > $auth_file
3. Connect:
# wpa_supplicant -i $iface -c $auth_file & sleep 3
4. Get an IP address:
# udhcpc -S -i $iface
--- End code ---
The -S flag makes udhcpc log to syslog, so to see what udhcpc has been up to just do this:
--- Code: ---$ cat /var/log/messages | grep udhcpc
--- End code ---
Turns out work router gives out 30 minute leases. From syslog I see that udhcpc automatically tries to renew the lease about halfway through lease (when lease is 15 minutes old). Sometimes udhcpc fails to renew, but then it tries again about 7 minutes later (when lease is ~22 minutes old).
Hope this helps someone. I will leave a little note in the wireless section of the wiki.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version