How is the default route determined?

Hi all,

a, maybe stupid question, arises on my side today:
How is OpenWrt "knowing" what is the default (=upstream mostly) route?

Is there some kind of hardcoding in terms of "wan" named interface? What happens e.g. if I rename the "wan" interface?

The reason why this question is important to me right now is, that there is no default route anymore on my test router after (NanoPi R4S):

  • changing wan and wan6 interfaces base device name from eth0 to eth.150
  • changing wan interface to static instead of dhcp configuration
  • adding a new interface ("dmzmgm", but name should not matter here I think) based on plain eth0 device

Thanks and best regards beforehand
Robert

Hi.

There's no hardcoding, it's a convention. You can rename wan to anything you like as long as you use that new name in firewall config and other config files. It all comes down to network and firewall settings when it comes to routing.

Post your /etc/config/network, /etc/config/firewall and /etc/config/dhcp. Use "preformatted text" formatting.

Hi @qunvureze,

thanks for your reply!

But what is the convention to set the default route?

What criteria and data is used for it by OpenWrt?

Best regards
Robert

If an interface has a "gateway" property set, either manually, as DHCP client or by other means, then it's considered to be a network gateway. I believe the first such interface is used as a default route. When it comes to VPNs, they often have a way to become the default route when tunnel is established.

Cool, thanks!

After adding the gateway property to my static wan configuration the default route is back. :slight_smile:

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