In this universe, redundancy is usually a fairly simple and effective strategy for dealing with non-determinism. For example, a physical hard drive might fail at any time, so one of the simplest solutions, RAID, is still one of the most widely used for high-availability systems. What about Internet connections?
I have DSL at home. Most of the time, it's solid, yet it depends on a physical network of copper cabling, which is vulnerable to extreme weather, or doofuses that dig before calling. That's beside the fact that the modem itself, although solid state, is still made of physical components that can fail. If for any reason, my DSL goes offline, it would be nice to simply swap in some other device to provide a WAN uplink.
Finally, it's my smartphone's time to shine! It has a data plan, and it can create a WiFi hotspot -- but not all the PCs in my LAN use wireless, plus I don't want to go about reconfiguring things either. Ah, but what about the USB tethering feature? As luck* would have it, my router has two USB ports, and can run third-party firmware. I've been using Tomato for a number of years now, and it has performed extremely well, so I was primed for a solution that would let me keep Tomato.
Now the real luck begins: someone has been developing a fork of the TomatoUSB project -- itself a fork of the original Tomato -- called Tomato by Shibby, which provides a fairly easy-to-understand architecture for handling USB devices, and which I'll refer to as TbShibby from here on out. It even includes extras, in particular, the kernel modules needed to get the phone to work as a WAN modem, using its packet radio service.
First, the list of drivers needed, in the form of a shell script snippet:
insmod mii.ko insmod usbnet.ko insmod cdc_ether.ko insmod rndis_host.ko
Just add the above lines to the Init script at /admin-scripts.asp in TbShibby's HTTP configurator GUI to have the router automagically load these modules on startup.
Here's where a problem arose: in the builds available to me, it appeared the rndis_host.ko kernel module was not included, the main file system was read-only, and I didn't want to go to the trouble of building my own environment and toolchain in order to rebuild the .trx firmware image. I might have figured out a way to place the missing file(s) on a USB stick that would permanently occupy one of the ports, but that's just... ugh.
It seemed likely that there was a template file system in the image, so there must be a way to extract the image contents, modify something in the template file system, and rebuild everything back into an image, for easy uploading to the router.
Sho'nuff, my quest led to firmware-mod-kit, a rather vaguely named but ultimately helpful project that fortunately kept old versions of itself in the main package; these old versions were less finnicky than the current stuff, and it was them that I built and used on the spot. Dependency problems reached no higher than the level of "easily solved annoyance". :-)
Testing with my phone indicated that a new device usb0 was available after USB tethering was activated. There remained one thing to do: automation based on plug state change. Basically, when the phone is plugged in, it takes over the job of WAN provider; when it's unplugged, the previous provider, such as a DSL modem, resumes operation.
Initially, I contemplated writing my own script, but I also expected that I wasn't the first to tackle this mission, and once again, fortunately discovered this script that monitors for USB tethering, which was the basis for what I am running right now. My DSL is still offline, but now my LAN is none the wiser -- well, until I hit my data cap! :-D
* heh, luck, right... like I don't overthink my gadget purchases! :-b