How to handle network if there are two interfaces for wan?

Hi All,

We are developing our own 5G cellular router with OpenWrt 21.02.0.
Device have 1 LAN port, 2 WAN ports(wan2 for ethernet port and wan for 5G cellular port).

This is board.json from device.

root@OpenWrt:~# cat /etc/board.json 
{
	"model": {
		"id": "ABC",
		"name": "ABC"
	},
	"network": {
		"lan": {
			"ports": [
				"eth0.1",
				"rrasi0"
			],
			"protocol": "static"
		},
		"wan2": {
			"device": "eth0.2",
			"protocol": "dhcp"
		},
		"wan": {
			"ifname": "ccm",
			"protocol": "mipc"
		},
		"wan6": {
			"ifname": "ccm",
			"protocol": "mipc"
		}
	}
}

Questions:

  1. How to define hot plug for wan/wan2? How to update routing table when wan/wan2 is plugin?
  2. How to define the routing table priority when both wan and wan2 are plugging?
    We would like to see wan port have higher priority.
  3. How to do load balance betwenn wan and wan2?
    If there are some devices already have above features at OpenWrt 21.02.0 branch, please let me know.
    We will try to study it first. Thanks.
3 Likes

Hi @vgaetera

Thanks. We will study this first. Have a good day.

1 Like

Hi @vgaetera

After trying mwan3, I think I need some help. Thanks.

By default, device are plugin wan2(ethernet) and wan(5G cellular).
I can see following info and I can ping 168.95.1.1

root@OpenWrt:~# ip route s
default via 10.134.234.53 dev ccm proto static src 10.134.234.54 
10.134.234.48/29 dev ccm proto kernel scope link src 10.134.234.54 
192.168.1.0/24 dev br-lan proto kernel scope link src 192.168.1.1 
192.168.99.0/24 dev eth0.2 proto kernel scope link src 192.168.99.139 

Then, I try to unplug wan(5G cellular) and fail to ping 168.95.1.1.
Look like route is not correct.

root@OpenWrt:~# ip route
192.168.1.0/24 dev br-lan proto kernel scope link src 192.168.1.1 
192.168.99.0/24 dev eth0.2 proto kernel scope link src 192.168.99.139 

Question:

  1. How do I define plugin/unplug behavior for wan and wan2 interface?
  2. What is the classic action when wan/wan2 is plugin/unplug? Any target project I can refer?

Please help. Thanks.

Hi all,

I following hotplug wiki page to add my action script for wan/wan2.
But, looks like uevent from wan2 is not stable.
Anyone have such experience to debug? Thanks.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.