[ltp] Speeding up wifi reconnect with Network Manager on wake up

Rubin Abdi linux-thinkpad@linux-thinkpad.org
Thu, 08 Nov 2012 11:41:24 -0800

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

When I was using a Mac full time a few years ago I was a bit bewildered
by how quickly the machine could deal with sleep, wake up, and wifi
reconnect. As it turns out Apple executes a lot of sneaky tricks in
order to speed up the process.


Namely poking the last three wifi networks the machine has connected to
first before attempting an AP scan, and remember the last DHCP lease
used on said network and continuing to use that information before DHCP
responds back with a fresh new lease. Some will argue such tricks aren't
healthy, others will gladly accept them because they do make things faste=

I'm running Debian Sid on on a ThinkPad X220 with an Intel Centrino
Advanced-N 6205 wifi card. For a while I had been using Wicd (on XFCE)
due to it's speediness at reconnecting wifi connections after coming out
of sleep, the fact that it could deal with my unicode SSIDs, and it's
ability to remember passwords but not to automatically reconnect to
those networks.

Recently I've had a taste of KDE and am happy to say that I'm now in bed
with the dark side. With that I'm back on Network Manager now, it does
the remember password but don't autoconnect thing, also a nice OpenVPN
interface and it can deal with USB tether off of my Android.

A big issue I was having still with Network Manager however was simply
that after waking up from sleep it would take up to 60 seconds for my
machine to reconnect to wifi. After some googling and staring at logs I
realized that NM is waiting a set number of seconds after wake before
doing any sort of reconnection business. I tried hurrying that up by
simply ifconfig wlan0 up which did bring up the wifi LED sooner than
later, but NM was still waiting for something.

Eventually I realized all one needs to do is to tickle NM itself on wake
and it'll take care of the rest. I imagine the general delay is possibly
compensating for other network wifi cards taking their sweet time waking
back up, but that doesn't seem to be the case for this card in my
ThinkPad. Effectively I've gone from wifi taking 30-60 seconds to
reconnect after wake up to about 5-10 seconds.

If you would like to try the same, dump this into
/etc/pm/sleep.d/wifi.hook and chmod 755 that thing...

case "$1" in
		nmcli nm sleep false

If that doesn't work try throwing a sleep in before the nmcli command,
otherwise your millage may vary. All in all no DHCP tricks, but I
honestly don't see any reason why NM needs to take so long to start up.
Hope this helps out any of you that have also been frustrated by slow 0
to 60/mph times after wake up.


Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

Version: GnuPG v1.4.12 (GNU/Linux)