OpenWrt Forum Archive

Topic: Remove default Route added after reboot

The content of this topic has been archived on 22 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

I have an issue with mine OpenWrt Barrier Breaker 14.07.

Occurs that everytime I restart router, it creates a default route to wrong path.
It can be removed by issue "route del -net 0.0.0.0 netmask 0.0.0.0 gw 192.168.200.1".
I have altready tried to setup a script in order to remove it, but script does not delete route during boot, just when I manualy start it via lucy, or cli (e.g. "/etc/init.d/rotas start").

Does anyone know how to resolve that?

root@OpenWrt:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.200.1   0.0.0.0         UG    0      0        0 br-wlan
default         192.168.0.1     0.0.0.0         UG    1      0        0 br-lan
192.168.0.0     *               255.255.255.0   U     0      0        0 br-lan
192.168.200.0   *               255.255.255.0   U     0      0        0 br-wlan
START=45

start() {
        echo Fix routes
        route del -net 0.0.0.0 netmask 0.0.0.0 gw 192.168.200.1
        route -n
}

boot() {
        route del -net 0.0.0.0 netmask 0.0.0.0 gw 192.169.200.1
}

Script was added into system startup ("/etc/init.d/rotas enable")

(Last edited by zetto33 on 11 Apr 2015, 14:28)

You should put the relevant part of your script in /etc/rc.local, which is executed after boot.
Probably your init.d script is executed during boot BEFORE another process creates that route, so it doesn't remove any route.

sleep 1
route del -net 0.0.0.0 netmask 0.0.0.0 gw 192.168.200.1
logger -t "Remove route" "All done"
exit 0

If the route is created by some "delayed" process (e.g. after a wireless interface goes up), you can try to increase the sleep time in the script. But you should also try to find out why is that route created.

... and probably you should have posted under General Discussion section smile

Thank you c2sandu, that fixed as workaround.
I will try to check reason this route is created, but so far could not find it on logs. Do you have any tip where I could investigate for root cause?

By the way, if an admin check this thread could you please transfer to General Discussion?

Most probably, that default route was received using DHCP. I can't think of anything else that pushes a default route. So, you should check the configuration of the interface with 192.168.200.x to see if it receives IP parameters via DHCP.

The discussion might have continued from here.