Hi!
I configured OpenWrt with a DHCP client on the WAN interface. My ISP provides me with a 'static IP' which is obtained via DHCP (don't ask me the details).
Basically, I 'think' I have a 7 days lease, after that I just get the same IP from my ISP.
The problem is that I can't find a way to get the length of the lease from Luci or from the command line, I just see on the home page the 'expires time' and the current up time, and I can do some math.
I can't also check when the renewal has been attempted: in the system logs, I can't see any udhcpc log right now. I verified at least at 75% of the lease time.
The udhcpc is running with the WAN interface (eth1), I can see that with 'ps -w' but I can't really get the lease time from it
root@OpenWrt:~# logread | grep -i "wan"
Thu Jun 27 21:28:04 2024 daemon.notice netifd: wan (2157): udhcpc: sending renew to server 192.168.10.254
Thu Jun 27 21:28:04 2024 daemon.notice netifd: wan (2157): udhcpc: lease of 192.168.10.66 obtained from 192.168.10.254, lease time 43200
Fri Jun 28 03:28:04 2024 daemon.notice netifd: wan (2157): udhcpc: sending renew to server 192.168.10.254
Fri Jun 28 03:28:04 2024 daemon.notice netifd: wan (2157): udhcpc: lease of 192.168.10.66 obtained from 192.168.10.254, lease time 43200
Fri Jun 28 09:28:05 2024 daemon.notice netifd: wan (2157): udhcpc: sending renew to server 192.168.10.254
Fri Jun 28 09:28:05 2024 daemon.notice netifd: wan (2157): udhcpc: lease of 192.168.10.66 obtained from 192.168.10.254, lease time 43200
It may have fallen off the edge of the limited log space, especially if the lease is 7 days (a lot of other stuff will be logged).
Close... 50%... if unsuccessful, it tries again, first at 87.5%, and finally again at 100% (when it must release the lease if it does not get a renewal).
It may have fallen off the edge of the limited log space, especially if the lease is 7 days (a lot of other stuff will be logged).
75% was some hours ago and I didn't saw anything logged (and no renewal happened), I also enlarged the log space...
Close... 50%... if unsuccessful, it tries again, first at 87.5%, and finally again at 100% (when it must release the lease if it does not get a renewal).
But this may explain it, if the second attempt is at 87.5% I have to wait a bit more.
The DHCP client will keep trying to contact the DHCP server many times between T1 (50%) and T2 (87,5%), then it will start broadcasting to find other DHCP servers which can prolong the lease.
Well I don't think this is happening
T2 just passed (now the 'expires' time is less than 21 hours) but I still don't see any log from udhcpc.
I see however the process running:
While this works, it is not ideal because I have some seconds of down time (some apps for example stopped working for some seconds).
So now that I'm not waiting anymore I can do some experiments: I switched to a static IP instead of DHCP client (knowing that my IP is always the same) and things are working: internet connectivity works and no udhcpc process is running of course.
What could happen in this case? On LAN side usually this works fine, so I guess this may work and simply remove the need of a DHCP renewal in my case.
Just an update: more than 2 weeks have passed and I did set the static IP. It seems to work fine, no disconnections, interface is up since more than 2 weeks so I guess my ISP is fine with this.
While solving the issue would have been good, I think the static IP solution is even better in my case