My home network is reasonably fault tolerant; the main router is on UPS, as is my HP MicroServer running ubuntu. I use 2 HomePlugAV 500 network adapters for a reliable connection (compared to WiFi) between the server and the router as they are on different floors.
A few weeks ago a woke up to my external house lights blinking regularly which was confusing. Some lights were on, some were dim, and most were making a sizzling noise. It turns out we had a brownout – the mains voltage went down to an intermittent 60V for about 3 hours which some power supplies could deal with, others could not. Nonetheless, both UPSes kicked in but the HomePlug network went offline.
I knew it was possible to bond 2 or more (homogeneous?) network connections for speed and/or redundancy; but what about ethernet with WiFi? It turns out a few people have done this but for the purpose of docking a laptop. I ordered a Dual-Band Atheros based low-profile PCI-E 802.11n which was surprisingly uncommon; the market is flooded with binary-blob1 powered Broadcom 802.11ac cards.
Anyway, I had no luck with most configurations; I eventually used the example configuration 2 from the Debian website. Here’s my
auto em1 iface em1 inet manual bond-master bond0 bond-primary em1 bond-mode active-backup #pre-up ifconfig $IFACE up #post-down ifconfig $IFACE down auto wlan0 iface wlan0 inet manual wpa-ssid BTHub-2211 wpa-psk goatsareinteresting bond-master bond0 bond-primary em1 bond-mode active-backup #pre-up ifconfig $IFACE up #post-down ifconfig $IFACE down ## Request dhcp ip for bonded interface #iface bond0 inet dhcp auto bond0 iface bond0 inet static address 192.168.1.105 netmask 255.255.255.0 gateway 192.168.1.254 dns-nameservers 192.168.1.254 bond-slaves none bond-primary em1 bond-mode active-backup bond-miimon 100
bond- options have to be specified 3 times each or it doesn’t work. I suspect it works around a chicken-and-egg condition or something. The bonding configuration is set to
active-backup which means all traffic goes through the ethernet interface until that fails, at which point the WiFi interface takes over; this way the traffic always uses the best-available route. In case you were wondering,
bond0 assumes the MAC address of the Ethernet interface, as does the WiFi card so ARP tables won’t be invalidated (nor will sessions be dropped) on failover.
The result is a much more fault-tolerant connection which is important as I use the server to log events from my home automation system (which is also power-failure tolerant) more on that later. SSH sessions can even persist with a slight interruption.
Still? I thought Broadcom open sourced their WiFi drivers. ↩︎
Thanks for reading! I'd appreciate it if you could submit/upvote/discuss this article somewhere on Hacker news, Twitter, Hackaday, Lobste.rs, Reddit and/or LinkedIn.
Please email me with any corrections or feedback.