Specify WAN Lease Time

Hi all,

I am having an issue with my ISP and the WAN DHCP lease times. It seems like the ISP changes their DHCP lease times from 4 hours to 10 minutes depending on network load. This change is broadcast to their hardware but not to my OpenWRT router. I think this causes my OpenWRT router to lose it's IP adress since it requests a new DHCP lease every 2 hours (even during times when the ISP drops it to 10 minutes).
ISP Forum with Detailed Info

Is there a way that I can schedule or force a DHCP renewal every 10 minutes? Maybe a cron job or WAN/WAN6 setting?

It also looks like I could go into a Double NAT situation (no bridge mode) and that would keep things working with the downside of Double NAT.

Thanks

Try running ifup wan in a cron job.

Thanks for the help

I just tried that. It has the unfortunate consequence of forcing WAN/WAN6 down, so it kills any data transfer in progress.

Yep...it will.

Interesting issue.

I ran an ISP DSL router/modem as a modem-only bridged to an AC gigabit router running OpenWrt for several years, and never had a lease issue.

The firewall, DHCP, and wireless were turned off on the ISP device.

The OpenWrt device did all of the work.

No cloning of the ISP device's MAC address to the WAN interface of the OpenWrt device was necessary in my case, but for some ISPs it is.

There are 2 main ISP's in my area. Shaw and Telus. Shaw offers internet via coax and Telus offers Fiber Optic internet.

I ran my own hardware with Shaw for 5-6 years with Zero issues. Their modem was in bridge mode. I got a public IP and ran everything on OpenWRT.

I've been wanting to switch to Telus for the better upload speed; 700 mbps Telus vs 25 mbps Shaw. But Telus seems to reduce their DHCP lease times based on network constraints. That's been causing these random lease issues and internet connectivity.

There's always a double NAT setup but I don't really want to go that route...

So with the Telus fiber connection, you're not able to plug the OpenWrt device directly into the ONT?

I can plug into the ONT, but that leads to the DHCP lease issues. For example, OpenWRT runs amazing plugged directly into the ONT. But randomly the internet completely stops working due to the changing DHCP lease times. It could be 12 hours or it could be 5 days.

There's also the potential for static public IP but I haven't tried that yet.

You should be able to force a renewal by running:

kill -USR1 $(pidof udhcpc)
1 Like

Thanks @dave14305

That seems to work. I can run the kill command during a speed test and there is no impact on the data transfer. I'll set this up as a cron job and see how that goes.

Didn't work on my connection.

The lease didn't renew...2 1/2 hours remaining.

Check your lease time.

Odd... I get this in my system log:

Tue Apr  5 11:35:00 2022 daemon.notice netifd: wan (6971): udhcpc: sending renew to server 10.27.191.25
Tue Apr  5 11:35:00 2022 daemon.notice netifd: wan (6971): udhcpc: lease of 173.183.xx.xx obtained from 10.27.xx.xx, lease time 14400

But the IPv4 upstream on the OpenWRT status page doesn't update with the new lease time:

Protocol: DHCP client
Address: 173.183.xx.xx
Gateway: 173.183.xx.xx
Expires: 1h 59m 51s
Connected: 2h 0m 9s

I'm not so worried if the lease doesn't renew according to OpenWRT. I just want to make sure that if my ISP switches to 10 minute leases, I catch the change with a renewal request.

@dave14305

Would this force a renewal of the ipv6 address I get from my ISP? Thanks

kill -USR1 $(pidof odhcp6c)

No, I don’t think odhcp6c interprets signals the same was Busybox udhcpc does.

Edit: or maybe it will, but with USR2.

Thanks for the help. I think I have my issue resolved and wanted to post a quick update.

I really think it is an issue with DHCP lease time and my ISP (Telus Fiber in Canada). I've been running kill -USR1 $(pidof udhcpc) as suggested by @dave14305 in a cron job every 7 minutes and that seems to have fixed my issue.

The usual log records when the cron job runs are the first 3 lines below. The fourth line appears roughly every 2 hours (coincides with 50% of a 4 hr dhcp lease time) but sometimes appears earlier (<10 minutes). I have a strong feeling that the slightly more than 2 hour windows and the <10 minute windows caused my external IP address to get reassigned to a different user and I would loose my internet connection. It didn't happen to me everyday, but would usually happen between 1 and 4 days. The appearance of the 4th line is the only indication I can find that something has been updated with my external dhcp address.

Thu Apr  7 06:00:00 2022 cron.err crond[8710]: USER root pid 15198 cmd kill -USR1 $(pidof udhcpc)
Thu Apr  7 06:00:00 2022 daemon.notice netifd: wan (6971): udhcpc: sending renew to server 10.27.191.25
Thu Apr  7 06:00:03 2022 daemon.notice netifd: wan (6971): udhcpc: lease of 173.183.xxx.xxx obtained from 10.27.xxx.xxx, lease time 14400
Thu Apr  7 06:00:03 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew

Here is a summary table of just the broadcast renewal lines. I've starred the lines showing short external dhcp changes.

  Tue Apr  5 15:14:03 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew
  Tue Apr  5 17:35:03 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew
  Tue Apr  5 19:49:03 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew
  Tue Apr  5 21:49:03 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew
  Tue Apr  5 23:56:03 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew
  Wed Apr  6 02:00:03 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew
  Wed Apr  6 08:28:03 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew
  Wed Apr  6 10:42:04 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew
**Wed Apr  6 10:49:04 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew
  Wed Apr  6 12:56:04 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew
**Wed Apr  6 13:00:04 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew
  Wed Apr  6 14:56:03 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew
**Wed Apr  6 15:00:03 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew
  Wed Apr  6 17:07:03 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew
**Wed Apr  6 17:14:03 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew
  Wed Apr  6 19:14:03 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew
  Wed Apr  6 21:21:03 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew
  Wed Apr  6 23:28:03 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew
  Thu Apr  7 01:42:03 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew
  Thu Apr  7 06:00:03 2022 daemon.notice netifd: wan (6971): udhcpc: broadcasting renew

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