My home network is a bit odd. The DSL runs to the refrigerator, and the wireless base station on top of it. Almost everything else plugs into a wireless bridge on my desk. This means most in-house networking is wired, but internet traffic goes through a wireless hop.
I spent a long time trying to get that wireless hop to work well. Eventually, I bought a pair of Linksys WRT54GL base stations and loaded the open source firmware Tomato. This got things to work in the way that I wanted, including functional encryption for the link. The firmware added a lot of assorted perks (like nice bandwidth usage graphs).
However, one of my old stability problems was still happening. Every once in a while, something in my neighborhood starts spewing radio noise. This is enough to kill all network connnections on that frequency. Sadly, this noise’s frequency moves around from time to time.
The pattern was that every two weeks or so, I’d have to carry the laptop into the kitchen, plug into the wireless base station and pick a new frequency. Then things would work fine…. until next time. It would, of course, usually break just during the intense part of some online game.
After a while, I realized that this process could be automated, AND I’m running this nice open source software that I can modify myself without permission from a big company that doesn’t care how often I have to get up to go fix my network.
This led to some investigation, and two small scripts. Once per minute, my base station tries to ping the wireless bridge. If it can’t reach it, it rotates the frequency by one. The base station was already smart enough to auto-reconnect on a different frequency if the base station changed. Since then, my network has been wonderfully stable! Online gaming bliss, broken only by an actual DSL failure that knocked me offline for a week.
init.sh (to create the cron job to run the real job):
/bin/sleep 60 /usr/sbin/cru a ChannelRotate "* * * * * /jffs/channel.sh"
channel.sh (the real job):
# If the other side of the bridge can be reached... we're happy! ping -c 3 desk > /dev/null && exit OLD_CHAN=`nvram get wl_channel` NEW_CHAN=$(( ($OLD_CHAN % 14) + 1 )) nvram set wl_channel=$NEW_CHAN nvram commit kill -sighup 1
This is exactly how things are supposed to work for geeks! We run across something broken, and invent a custom solution, implement, and move on.