Table option in Luci's static routes takes no effect

Say I have 2 auto populated routing tables:

  1. main (254) by wan0
default via 192.168.125.1 dev eth0 proto static src 192.168.125.171
192.168.125.0/24 dev eth0 proto kernel scope link src 192.168.125.171
  1. alt (11) by wan1
default via 192.168.50.1 dev eth1 proto static src 192.168.50.51
192.168.50.0/24 dev eth1 proto static scope link

I know 10.0.0.0/24 can be reached through 192.168.50.1, but I'd like that route to be in the main (254) table. As far as I know, the only way to do that in Luci is to specify the gateway 192.168.50.1, leaving the parent interface unset. If I set the parent interface, the route goes in alt (11). Is the table option supposed to work here?

ip ro sh t 11

Can you show us the UCI routing config (or stanzas added to /etc/config/network)?

My actual config differs from the abstracted example, but I always had this issue on different hardware with different configurations. You should be able to reproduce this even in a VM. But since I'm the one asking for help, here's my slightly redacted config:


config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd45:38a:5331::/48'
	option packet_steering '2'
	option steering_flows '128'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'eth1'
	list ports 'lan1'
	list ports 'lan2'
	list ports 'lan3'

config interface 'lan'
	option device 'br-lan.1'
	option proto 'static'
	option ipaddr '192.168.125.1'
	option netmask '255.255.255.0'
	option ip6assign '64'
	option ip6weight '10'

config interface 'cu'
	option proto 'pppoe'
	option device 'br-lan.9'
	option username 'redacted'
	option password 'redacted'
	option ipv6 '1'
	option metric '10'
	option peerdns '0'
	option ip4table 'main'
	option ip6table 'main'

config interface 'cu6'
	option proto 'dhcpv6'
	option device '@cu'
	option reqaddress 'try'
	option reqprefix 'auto'
	option peerdns '0'
	option ip4table 'main'
	option ip6table 'main'
	option norelease '0'

config interface 'cm'
	option proto 'pppoe'
	option username 'redacted'
	option password 'redacted'
	option ipv6 '1'
	option metric '20'
	option peerdns '0'
	option device 'br-lan.2'
	option ip4table 'main'
	option ip6table 'main'

config interface 'cm6'
	option proto 'dhcpv6'
	option device '@cm'
	option reqaddress 'try'
	option reqprefix 'auto'
	option peerdns '0'
	option ip4table 'main'
	option ip6table 'main'
	option norelease '0'

config rule
	option in 'lan'
	option lookup 'redacted'
	option mark '0x9'
	option priority '10'

config rule
	option in 'lan'
	option lookup 'redacted'
	option mark '0xd2'
	option priority '15'

config rule
	option in 'lan'
	option lookup 'gfwlist'
	option mark '0x6'
	option priority '20'

config rule
	option in 'lan'
	option lookup 'asus_a0'
	option mark '0x7'
	option priority '30'

config rule
	option lookup 'gfwlist'
	option mark '0xe2'
	option priority '40'

config rule6
	option lookup 'gfwlist'
	option mark '0xe2'

config rule
	option dest '8.8.8.0/24'
	option lookup 'gfwlist'
	option priority '40'

config rule
	option dest '8.8.4.0/24'
	option lookup 'gfwlist'
	option priority '40'

config rule
	option dest '1.1.1.0/24'
	option lookup 'gfwlist'
	option priority '40'

config bridge-vlan
	option device 'br-lan'
	option vlan '1'
	list ports 'eth1:u*'
	list ports 'lan1:u*'
	list ports 'lan3'

config bridge-vlan
	option device 'br-lan'
	option vlan '2'
	list ports 'eth1:t'

config bridge-vlan
	option device 'br-lan'
	option vlan '3'
	list ports 'lan3:t'

config bridge-vlan
	option device 'br-lan'
	option vlan '4'
	list ports 'lan1:t'

config bridge-vlan
	option device 'br-lan'
	option vlan '5'
	list ports 'lan1:t'

config device
	option name 'br-lan.5'
	option type '8021q'
	option ifname 'br-lan'
	option vid '5'
	option macaddr 'redacted'

config interface 'wndr3800ch'
	option proto 'dhcp'
	option device 'br-lan.4'
	option peerdns '0'
	option delegate '0'
	option metric '80'
	option defaultroute '0'

config bridge-vlan
	option device 'br-lan'
	option vlan '6'
	list ports 'lan1:t'

config interface 'IoT'
	option proto 'static'
	option ipaddr '192.168.126.1'
	option netmask '255.255.255.0'
	option device 'br-lan.8'
	list ip6class 'cm6'
	list ip6class 'cu6'
	option ip6assign '64'

config bridge-vlan
	option device 'br-lan'
	option vlan '8'
	list ports 'eth1:t'
	list ports 'lan2:u*'

config interface 'proxy0'
	option proto 'dhcp'
	option device 'br-lan.10'
	option ip4table 'gfwlist'
	option ip6table 'gfwlist'
	option delegate '0'
	option peerdns '0'

config interface 'proxy0_6'
	option proto 'dhcpv6'
	option device 'br-lan.10'
	option reqaddress 'try'
	option reqprefix 'auto'
	option peerdns '0'
	option ip4table 'gfwlist'
	option ip6table 'gfwlist'
	option sourcefilter '0'
	option delegate '0'

config route6
	option interface 'proxy0_6'
	option target '::/0'
	option table 'gfwlist'

config bridge-vlan
	option device 'br-lan'
	option vlan '9'
	list ports 'eth1:t'

config bridge-vlan
	option device 'br-lan'
	option vlan '10'
	list ports 'lan3:t'

config bridge-vlan
	option device 'br-lan'
	option vlan '11'
	list ports 'eth1:t'

config route
	option interface 'cm'
	option target '45.11.36.0/22'
	option metric '5'

config route
	option target '10.0.0.0/24'
	option table 'main'
	option gateway '192.168.127.1'
	option interface 'proxy0'

To be clear, you're saying this route appears in Table No. 11 instead of Main, correct?

Also, the interface appears to be set here.

I assume the example has the same issue, correct?

Yes, the route appears in the table where proxy0 automatically sets the default gateway. It's 11 in my example, but not 11 in my real config.

1 Like

What do you mean by the phrase "proxy0 automatically sets the default gateway"?

It's this part:

config interface 'proxy0'
	option proto 'dhcp'
	option device 'br-lan.10'
	option ip4table 'gfwlist'
	option ip6table 'gfwlist'
	option delegate '0'
	option peerdns '0'

Proxy0's default gateway is set in the gfwlist table. It would be table number 11 in my example.

Then why are you making a configuration to place it on gfwlist?

(If you are making up "example configs" - its becoming quite confusing to understand you, or test.)

That's my question actually. What does the "table" option actually do? Or what is it supposed to do?

https://www.cyberciti.biz/faq/what-is-a-routing-table/

I can't answer why you choose to make the configuration.

Is this explanation what you are looking for? https://github.com/openwrt/netifd/issues/44

I looked at this part of netifd https://github.com/openwrt/netifd/blob/master/interface-ip.c#L402. If I can figure out how vlist and blobmsg_* work, I might be able to piece together the whole picture. But that won't be any time soon.

Anyway, thanks for spending the time to look at my issue.

No, I wasn't.

  • That link didn't exist when I responded
  • The person who submitted that issue appears to also configure a table in the interface (option ip4table 'wg_tyo1'), then make a conflicting table in a separate route config (option table 'main')

Again, it's unclear why the poster is doing so. Did you create that GitHub report?

I did. The why is at the beginning:

If the gateway changes, I'd like OpenWrt to find the new one automatically.

  • OK, but you keep failing to explain why you configure an ipv4table in the interface and specify a different one in a confg route statement
  • Expian how the interface gets a "new gateway" any why you need it to change dynamically

Perhaps if you explain the use case, we'd be able to better assist you.

I take that as "We don't know why it doesn't work, but you shouldn't do it anyway because we don't need that." As for who's "we"? I don't know.

Let's read this manual for a second:

Routing table into which to insert this rule.
A numeric table index, or symbol alias declared in /etc/iproute2/rt_tables . Special aliases local (255), main (254) and default (253) are also valid
Only interfaces using this table (via override) will use this route.

Does it say anything about ip4table?

If you can convince me I did something wrong, I'll answer more of your questions.

That is a UCI configuration - I'm lost at why you're referring to the underlying Linux system.

I wasn't attempting to convince you of anything - it's clear you're making 2 route configurations and confused or wondering why one doesn't override the other, or making raw configurations unaware of the OpenWrt system.

It's all right. I still appreciate you spending the time. Few people are interested in helping others for no personal gain. Not all the time at least.

1 Like

Question (out of curiosity):

To be clear - you're aware you're making 2 route configurations, but desire the second config to ignore the first (because you don't see ip4table in the Linux manual), correct?