How is the default gateway selected?

My OpenWRT router is part of two VLANs
VID 10, 192.168.10.1/24
VID 20, 192.168.20.1/24
Both VLANs are equal, e.g. both have internet access and it's even the same internet connection. Now OpenWRT decided to use 192.168.20.1 as the default gateway. I am fine with that but wondering how OpenWRT decided to use 192.168.20.1 and not 192.168.10.1 and especially if this will always stay the same, even across reboots?

It is basically undefined and either depends on the order of configuration items or timing. While it'll likely be the same undefined result on each boot it would be better to make the configuration explicit.

To let things work in a predictable manner, consider setting different metrics on your VLAN interfaces. Even better, declare only one default gateway (in case of DHCP disable the defaultroute option, in case of static settings omit the gateway setting on one of the interfaces).

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