How to configure OpenWRT to automatically switch nodes?
To set up automatic node switching in OpenWRT, you can follow these steps:
- Install node software like Shadowsocks or VPN on OpenWRT devices. You can use the opkg command to install the necessary packages. For example, to install Shadowsocks, you can run the following command: opkg update && opkg install shadowsocks-libev.
- On OpenWRT devices, you can create multiple network interfaces, with each interface corresponding to a node. You can use network interface configuration files to do this. For example, to create an interface called wan1 for the first node, you can create a file named /etc/config/network.wan1 and configure it accordingly.
- Set up load balancing rules. You can use the load balancing feature to achieve automatic node switching. On OpenWRT devices, you can configure load balancing rules by editing the /etc/config/mwan3 file. You need to define a rule for each node and set the corresponding priority and weight.
- Enable load balancing. Before performing a node switch, you need to enable the load balancing feature. You can do this by editing the /etc/config/mwan3 file and setting the option enabled ‘1’ to enable load balancing.
- Save and apply configuration changes. After completing the above configuration, you need to save and apply the configuration changes. You can do this by running the following commands: /etc/init.d/mwan3 save && /etc/init.d/mwan3 restart.
After completing the above steps, the OpenWRT device will automatically switch nodes based on the load balancing rules.