OpenWrt Forum Archive

Topic: trunk losing default route on wan connection

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

Hi
I'm running a trunk build on a tplink wr4300.  The "WAN" port is connected to a network that provides
DHCP and an internet connection.  When the 4300 is rebooted, it picks up the wan dhcp address, and
the default route is set to the one provided by dhcp - perfect.
After a couple of hours, the default route disappears.  The wan connection is still up, and active, and you
can ping hosts on the same subnet as the default gateway, and even ping the default gateway, but
if you do a netstat -r, there is no longer a default route defined.  There is no entry in the syslog or
kernel log to indicate the reason for the route going away.
This has only started happening since I updated from a trunk build from about 3 months ago, to the current
trunk head.

Any ideas??

Hi,
i am observing the same problem as you. I think it is caused by releasing ip address because. I have very small lease time and it disappear right after its expiring. Reload of network help but it is not solution. WRT does not using dhclient but some another tool for getting dhcp and i dont know how to diagnostic it. Any idea?

I found an easy hack for repairing this problem. This problem is caused by program ubusd. Udhcpc sends JSON data to ubusd but ubus didnt make any changes in system. So i patch it in /lib/netifd/dhcp.script.
     
in function setup_interface() and statement

   for i in $router; do
                proto_add_ipv4_route 0.0.0.0 0 "$i"
        done

you need to add this line

               route add -net 0.0.0.0/0 gw "$i"

to that for loop

Hello, i am experiencing the same problem, but in attitude adjustment 12.09. For some reason, the default route (obtained automatically) to my isp's gateway seems to disappear. The above fix in /lib/netifd/dhcp.script did't work for me

The discussion might have continued from here.