Can't add route table in startup

I try to test mptcp on openwrt + 951ui-2hnd,
I compiled and flash unit, but it's my first openwrt,
and I can’t configure routing.

on ubuntu/Armbian/Orange - I used simple commands,

ip rule add from 192.168.101.2/32 table 101
ip rule add from 192.168.102.2/32 table 102
ip rule add from 192.168.103.2/32 table 103
ip rule add from 192.168.104.2/32 table 104

ip route add default via 192.168.101.1 dev eth0.101 table 101
ip route add default via 192.168.102.1 dev eth0.102 table 102
ip route add default via 192.168.103.1 dev eth0.103 table 103
ip route add default via 192.168.104.1 dev eth0.104 table 104

in OpenWrt I added it to rc.local - but after the overload - nothing happens.
no result in ip rule or ip route show table 101

i add this to /etc/config/networks - and ip rule - OK

config rule
        option src '192.168.103.2/32'
        option lookup '103'

how do I need write for add a tables

ip route add default via 192.168.101.1 dev eth0.101 table 101
ip route add default via 192.168.102.1 dev eth0.102 table 102
ip route add default via 192.168.103.1 dev eth0.103 table 103
ip route add default via 192.168.104.1 dev eth0.104 table 104

I tried different text in config, but nothing works.

from the command line - everything works, but I need put to autostart.

thanks.

@carver, welcome to the community!

What?

Example - table 101:

# in /etc/config/network

config route
	option interface '<network_name>'
	option target '0.0.0.0'
	option netmask '0.0.0.0'
	option gateway '192.168.101.1'
	option table '101'

See: https://openwrt.org/docs/guide-user/network/routes_configuration

To be clear, I think you mean: /etc/config/network

3 Likes

thanks for the answer.
i found my mistakes.

my erroneous entries chain like:

config switch_vlan
        option device 'eth0'
        option vlan '101'
        option ports '0t 1t'
        list comment 'port internet, eth0.101'

config interface 'wan1'
        option ifname 'eth0.101'
        option proto 'static'
        option ipaddr '192.168.101.2'
        option netmask '255.255.255.0'
        option gateway '192.168.101.1'
        option disabled_type 'bridge'
        list comment 'mwan3 does not like bridges, as far as the documentation goes'
        option peerdns '0'
        option metric '10'

config route
        option interface 'eth0.101'
        option target '0.0.0.0'
        option netmask '0.0.0.0'
        option gateway '192.168.101.1'
        option table '101'

and such a record does not work too

config interface 'eth0.101'
        option ifname 'eth0.101'

config route
        option interface 'eth0.101'

working chain

config interface 'wan1'
        option ifname 'eth0.101'

config route
        option interface 'wan1'

some kind of problem with config parsing algorithm.
need a wan1, although with the command line and in ifconfig - eth0.101 is used

so all OK. Thanks

1 Like

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