QSDK Openwrt random route gateways


I have been trying to setup OpenWrt on a router with two Internet connections, an eth wan and a lte redundancy modem. The interfaces are working correctly, but upon reboot the system seems to create gateways randomly in the routing table. Sometimes it creates two gateways, one for each interface, sometimes it creates a gateway for just one interface, seemly at random. Both interfaces are assigned IPs and, when I manually set up the routing table, work correctly, .

LuCi is disabled on this particular installation, I am configuring via /etc/ files mostly.

Can someone shed some light on why the OS is setting up the routing table in such erratic way?

mwan3 > Configure a different metric for each WAN interface

They already have different metrics and 'default' gateway enabled.

1 Like

Check if the issue persists if you specify different routing tables for each interface:
Create a vlan for each wan interface where wan interfaces has the same ip ranges - #2 by vgaetera

If I understand this correctly, this one is for static gateway routes, ie. I would need to know the gateway addresses beforehand. All my gateways/addresses change after each reboot, so I don't think this one would apply?

It works for both static and dynamic setups as long as the protocol is supported by netifd.

Then I am at a loss here. This is how the netifd nics are configured:

config interface 'wan'
        option proto 'dhcp'
        option ifname 'eth4'
        option metric '10'

config interface 'lwan'
        option proto 'qmi'
        option ipv6 'auto'
        option device '/dev/cdc-wdm0'
        option apn XXXXXXX
        option ifname 'wwan0'
        option metric '25'

I tried a route rule like this:

config route 'route1'
        option interface 'wan'
        option target ''

But what the system did was create a default gw at, which is not useful.

uci -q delete network.route1
uci set network.lwan.ip4table="1"
uci set network.lwan.ip6table="1"
uci commit network
/etc/init.d/network restart
sleep 10; ip route show table all; ip rule show; ip -6 rule show

Adding ip4table/ip6table to the wwan changed nothing. However, running /etc/init.d/network restart after some time added the missing gateways. That tells me the interfaces are not online when the system starts, and therefore are not added. Also udhcpc is not working properly, since it should add the gateways later as the DHCP procedure completes.

There is another issue bugging me though. After restarting the network service, ip show route gives me this:

default via dev wwan0  proto static  src X.X.X.X 
default via dev eth4  proto static  src  Y.Y.Y.Y  metric 1 

The metrics clearly do not match the ones in /etc/config/network. Any ideas?

I will dig into the udhcpc script to find what is going on with the gateways.

That's definitely weird, check the output:

ubus call system board

This one

	"kernel": "4.4.60",
	"hostname": "OpenWrt",
	"model": "Qualcomm Technologies, Inc. IPQ807x\/AP-AC04",
	"release": {
		"distribution": "OpenWrt",
		"version": "Chaos Calmer",
		"revision": "b61d32c+r49254",
		"codename": "chaos_calmer",
		"target": "ipq\/ipq807x_64",
		"description": "OpenWrt Chaos Calmer 15.05.1"
1 Like

Well, no wonder something doesn't work as expected in such an ancient version.
Try upgrading if possible, otherwise finding a solution may be problematic.

1 Like

It is the openwrt QSDK uses actually and, since there is no official support to IPQ807x, upgrading right now would require a lot of effort to port everything. Maybe in the future, if I have time.

Regarding the problem itself, I am stuck, udhcpc requests the gateway correctly, but the system refuses, I would have to debug the kernel to find the cause probably. So I just added a crontab to call network restart whenever the gateway is missing, and restarting mwan. It is working fine for now.

1 Like
1 Like