I'm setting up a portable, embedded Linux machine for use in outdoor environments where I'm likely to get internet access either via an in-field wireless network or a cellular data connection. On top of that the machine itself creates its own WLAN and forwards IPv4 packets to/from the aforementioned WAN ports. Or at least, that's the idea.
My problem is this: I'd like to give precedence to the wireless WAN port, and only use cellular data when WiFi is not available (similar to how modern smartphones operate). Based on my research, it sounds like what I'm looking for is Dual WAN failover routing using iproute2. While I've found a few explanations and examples online, I can't seem to find any where the WAN card IPs are dynamically assigned via DHCP.
More concisely, I have:
- wlan0 configured as an access point.
- wlan1 configured to automatically log into trusted WiFi network, if available.
- wwan0 enabled at startup, but should only be used if wlan1 can't find a connection.
Originally, I thought I could do this by writing a script to explicitly bring up/down interfaces, but it's critical that I minimize any sort of disruptions to the connection, and using clever packet forwarding seemed like the best way to do that.
Apologies if this is a duplicate or nonsensical post; I'm new to both the site and networking in general.