Mi router 4C mwan3 network and firewall configuration without LUCI

Hello. I created a custom image for this router but I am having a hard time trying to replicate mwan3 configuration from looking at the other tutorials. I have two modems with DHCP on. This is the default mi4c network configuration: https://pastebin.com/2J7mgT9A. I know that I basically have to create a second wan but can't wrap my head around vlan configuration with terminal config.

uci add network device
uci set network.@device[-1].name='eth0.3'
uci set network.@device[-1].macaddr='8c:de:f9:dd:92:b5'

uci set network.wanb=interface
uci set network.wanb.proto='dhcp'
uci set network.wanb.device='eth0.3'
uci set network.wanb.metric='10'

uci set network.@switch_vlan[0].ports='4 6t'

uci add network switch_vlan
uci set network.@switch_vlan[-1].device='switch0'
uci set network.@switch_vlan[-1].vlan='3'
uci set network.@switch_vlan[-1].vid='3'
uci set network.@switch_vlan[-1].ports='2 6t'

uci add_list firewall.@zone[1].network='wanb'

uci commit
/etc/init.d/network restart
/etc/init.d/firewall restart

You will need to find out which lan port is number 2 and use it as wanb.

1 Like

I am going to try this configuration it should work just for research purposes since the hardware is not that capable for practical use. Can I use rpi4 with unmanaged switch for bonding? Sorry if it's a noob question but rpi does not have that many ports for multi wan.