Set default-route on 18.06.5

thats I need:
default route to GW 192.168.1.254

Problem:

root@OpenWrt:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.4.254   0.0.0.0         UG    0      0        0 br-4
192.168.1.0     *               255.255.255.0   U     0      0        0 br-1
192.168.2.0     *               255.255.255.0   U     0      0        0 br-2
192.168.3.0     *               255.255.255.0   U     0      0        0 br-3
192.168.4.0     *               255.255.255.0   U     0      0        0 br-4
192.168.5.0     *               255.255.255.0   U     0      0        0 br-5
192.168.6.0     *               255.255.255.0   U     0      0        0 br-6
root@OpenWrt:~#

I have no idea where the default route 192.168.4.254 comes from. 192.168.4.254 is entered in the interface br-4 as GW. In the other networks, however, the x.x.x.254 is also entered as GW.
„route add default gw 192.168.1.254 br-1“ works. Then, there are two defaultsroute.

In „/etc/config/network“, there is one route

config route 'default'
        option interface 'lan'
        option gateway '192.168.1.254'
        option target '0.0.0.0'
        option netmask '0.0.0.0'

„lan“ is on the br-1.

You should be able to configure multiple default routes (gateways) if you give them different metrics using the advanced setting "Use gateway metric". Though linux will only use the default route with the lowest metric.

Maybe you should explain why you need multiple default IPv4 routes? You may need to use policy routing, mwan3 or similar.

thats not the point. My problem is, that I need the default-GW 192.168.1.254 but 192.168.4.254 is set by the system after boot.

Try to add metric: https://openwrt.org/docs/guide-user/network/ipv4/start

Then remove 192.168.4.254 from all configs and/or DHCP replies. Simple.

solved!
after I have entered a metric for all interfaces (and the lowest for br-1) the routing works.
Sorry that I didn't read carefully at first.
Note: now I have many default routes. It's not nice, but it works.
Thanks a lot!

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.

If you use DHCP then you should uncheck "Use default gateway" on interfaces you don't want to use as default gateway.

1 Like

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