OpenWrt config presets?


I am trying to wrap my head around the best approach to add different config presets to my x86 OpenWrt router.

First of all, I will describe the router: it has 5 x RJ45 ports in total (1 on the motherboard, 4 on a PCIe card), it also has a WiFi 6 card with 2 radios (AsiaRF AW7915-NPD) and a 4G modem plugged through internal USB port.
The router itself has recognized all the devices and though there are some hitches with the 2.4GHz connection speed, this topic is not about that problem which I will probably ask in a different topic.

The main purpose of the router is to be as mobile as possible. I move frequently around and as such I need to have different config presets for different situations.

  1. The most utilized config would be just the typical eth4 (motherboard port) for wan, while the rest of the ports and the wifi for lan. The trick is to set the 4G modem as a failsafe in case cable connection goes down for whatever reason but mostly because of ISP.

  2. Second option would be to connect to another existing network (in my case, an ONT modem/router) using a cable again to the eth4 port, then spreading the connection the same way as in 1), again with a 4G failsafe option.

These should be quite straightforward but the next ones are a bit more finicky and I am unsure how to do:

  1. One of the radios on the WiFi adapter card serves as a WAN connection to another network, spreading the connection to the RJ45 ports AND the other radio on the same card. I specifically chose the AW7915-NPD as it is a DBDC card and it supposedly should be able to do just that. Again, 4G should be failsafe.

  2. 4G is the sole WAN point and everything else just spreads the connection to the devices connected via WiFi or RJ45.

Now, I understand this is quite a long list and while I would appreciate advise on how to set up each config separately, my main concern and reason to create this topic is to ask if it is even possible to save the different config presets somehow, perhaps using a package, or load them with SSH (even from an external device) so that I do not have to manually change the settings when changing my location. The most preferable way would be to do it as simple as possible without too many commands, such as a scripted command file either on the router itself (space is not an issue, it's got a 120 gigs ssd), or from an external device (laptop running linux but also sometimes windows) and maybe even an android phone.

How to set up each of those is beyond the scope of one discussion. This could easily become a how to do everything in OpenWrt thread, so I'm not going to speak toward those. I will certainly speak to the main point:

Absolutely. Simply set up each configuration, and once it is configured the way you want for that particular tasking:

  • LuCI: System->Backup->Generate Archive
  • SSH: sysupgrade --create-backup <filename.tgz>

Sure. Once you have your library of configurations, you can switch between them by loading them with sysupgrade --restore-backup <filename.tgz> && reboot

You can also set it up to be able to do this right through LuCI with nice buttons by installing luci-app-commands. This will give you the menu item System->Custom Commands, which you can pre-configure with all the commands to switch between your different operating modes.

1 Like

There used to be a D-Link "travel" router with a 3-position slider and I remember writing some scripts to have different config files in /etc/config-router, /etc/config-ap, /etc/config-wr and upon slider action it would copy the necessary files to /etc/config and restart network.

You can do the same but then either have a small WebUI to switch the configs or use the above-mentioned luci-app-commands to run scripts when needed.

1 Like

Should be doable with mwan3 failover?