My home gets more and more dependent on an functioning Internet Connection — especially after I switched to VoIP. My wife would kill me if her precious phone went offline because our DSL provider has problems
I decided to add some redundancy to my home network. My neighbor had a WLAN router which I could reach from my home office and that made things real easy.
After getting his permission to use his uplink in a failover situation I went in search of an automatic failover solution …
My current router at home runs OpenBSD so after reading a few man pages I quickly found that the trunk(4) driver was exactly what I was looking for. The trunk(4) interface allows the aggregation of multiple network interfaces into a virtual trunk(4) interface which then can be set up to failover between the physical trunk(4) members based on their link status.
The configuration is, like most things in OpenBSD, rather simple :
ifconfig trunk0 trunkproto failover trunkport fxp0 trunkport ral0 192.168.0.1 netmask 255.255.255.0
This command creates a pseudo-device, trunk0, comprised of 2 physical network cards. When my DSL uplink fails, fxp0 changes it’s link status to down and that would trigger the trunk(4) failover mechanism and trunk(4) would then send traffic using my wireless network card (ral0) which is connected to my neighbors WLAN router.
trunk(4) can do other stuff besides failover; roundrobin and loadbalance operations are also supported.
Since trunk(4) only detects changes in the link state of a network card (like an unplugged cable or the like) I also use ifstated(8) to further validate my DSL connectivity; once ifstated detects that my uplink is down it downs the network card that connects to my DSL modem so that trunk(4) can do its magic.
A nice benefit was that my neighbor and I were using 2 different ISP’s but as it turns out we also use completely different circuits ! My DSL line runs over the cobber phone line but my neighbors DSL runs over his TV Cable box which makes my failover solution even more redundant