I have a travel router that connects to the WAN through Wi-Fi. The LAN devices connect through the built in ethernet port (eth0), two USB to USB to ethernet adaptors (eth1 and eth2), and a USB Wi-Fi radio. Sometimes I want to plug right into a modern or another router (for example, plug into home router so I have a second network for testing/experimenting, routing through my VPN, or utilizing the wired performance advantages when possible), so the built in ethernet port should connect to the WAN instead of the built in Wi-Fi radio which normally connects to the WAN. I would then unplug the second Wi-Fi radio (USB) and and any unused USB ethernet adaptors, basically switching the functionality of the two. This would automatically happen depending on what is plugged in (if the antenna is plugged in or the type of connection coming through the ethernet port). If some manual configuration is required, that is fine, as long as it can be done with the only connection being an ethernet cable connecting my MacBook to the travel router.
Your setup sounds rather convoluted and I'm not entirely sure I follow what you're trying to do...
Fundamentally, each physical network device should be assigned to logical network interface (or bridge), and then you should assign any network that will ever be used as a WAN (active or not) to the wan firewall zone. Same with LAN network interfaces -- typically those will be put together in a bridge if they're all part of the same LAN, but if you have multiple LAN networks, you might not want to be bridging them.
I'm not sure I understand why you have so many physical interfaces -- typically you only need 1 or 2 for WAN (usually 1x Ethernet and/or 1x wifi), and 1 or 2 for LAN (1x ethernet and 1x wifi... and you may or may not actually need ethernet for your lan). So at most you'd need 2 ethernet and 2 wifi. And although there is a reduction in performance, you can actually use the same physical radio for lan and wan (or if your travel router has dual radios, you can use those independently).
I sometimes want the wan to use wifi. Sometimes ethernet. If it is on wifi, I want the ethernet port to be utilize by the lan, and vice versa. This can be done by completely reconfiguring the devices and reassigning to the opposite interfaces, but I want as little manual configuration as possible.
Sure, that can be done. But you don't need so many physical interfaces to achieve this. I've got a TL-WR902AC (1x 2.4GHz radio, 1x 5GHz radio, 1x ethernet). I use travelmate to handle the WWAN side of things. And a simple script with a few UCI commands can move the ethernet port between WAN and LAN functions.
What would the script need? A bash script? What does travel mate do?
Here my script. It basically just toggles between LAN and WAN, based on a button press. It's not elegant, but it works:
#!/bin/sh # Test if eth0 is attached to br-lan device eth=$(uci get network.@device.ports) if [ "$eth" == "eth0" ] then logger Found eth0 attached to br-lan. Changing eth0 to WAN. # Set eth0 = WAN uci delete network.@device.ports uci set network.wan.device=eth0 else logger Found eth0 attached to WAN. Changing eth0 to br-lan. # Set eth0 = LAN uci delete network.wan.device uci set network.@device.ports=eth0 fi # Commit and reload the network uci commit network /etc/init.d/network reload
It helps manage upstream wifi networks in a travel context. Read the description in the linked thread.