Disable DHCP release on WAN during shutdown

My ISP (verizon fios) has the annoying habit of issuing new IP addresses when my router releases a WAN lease and reconnects, such as when rebooting.
While I can get by with Dynamic DNS for now, I'm concerned that once they enable IPv6 that any prefix delegations will be unstable if I'm renewing/releasing leases, and that will cause me trouble with some static configurations (wireguard VPN clients).

Is there a way to prevent the DHCP release on the WAN during interface restart or shutdown or system shutdown, and only release with an explicit command?

Not a Verzion FiOS user, but I get a new WAN IP when rebooting, or running ifup wan.

It started with the 21.02 release (didn't happen in 19.07) ...some routers get a new WAN IP, some don't.

Not necessarily a bad thing, especially if you need to force an IP change (DDoS attack, etc.)

Haven't seen a "fix" .

Try flipping the power switch, instead of using shutdown or reboot.

Removing the K??network from /etc/rc.d might work for the soft reboots.

Ah, I see in 21.02.2, this part of K90network:

stop_service() {
	/sbin/wifi down
	ifdown -a
	sleep 1

I'll play with that on a test system and see if getting rid of ifdown or limiting which interfaces are shut down will do what I want.

well, actually it's also shutdown_service() called at reboot time.
But calling ifdown -a really should be doing the cleanups/releases in most cases/most interfaces. The ifdown script (same as ifup script) calls ubus to stop or start the interface, so I think that's where to look next, how to adjust the behavior of the wan interface during ubus network.interface stop "{ \"interface\": \"wan\" }"

Do you reboot or reset the WAN frequently?

Are you having some kind of issue because of it?

I do reboot reasonably frequently, because I'm testing out some things and need a full reboot to confirm all is OK.

And yes, I do get problems, the ISP keeps assigning a new IP address when udhcpc releases the lease before reboot. I would rather not release the lease and let the ISP reassign the one I got on the last boot. (especially once they start assigning/delegating IPv6 prefixes)

Verizon Fios user. IPv6 user. I also have tunnels that have to come up...frequent rebooter.

  • You can't control the other side
  • Unless you have some equipment that doesnt go down, I'm not sure how you could accomplish that (i.e. plug WAN into a switch that won't go down

DHCP is layer 2...so you'll basically have to keep the link up in addition to what you wanna accomplish. But..you're taking the link down on purpose... :man_shrugging:

Lastly, you donno how Verizon configures the subnets. Your last IP may simply be unavailable.

My best bet I think is to avoid explicit DHCPRELEASE, and hope that the Verizon DHCP server reassigns the same lease after a reboot. The lease will still be valid, since it was issued previously and not yet released or expired, assuming the reboot is within the lease period (2hours).

What about avoiding an explicit renew...all while your device has no IP?

This is the part I havent figured out...

Why are you under the impression a release is sent?

You can test by unplugging (you may needed a switch so you can leave the OpenWrt interface up and WAN down...or test vice versa) before you reboot.

Because I've run other OpenWrt instances on my LAN (where their "WAN" is actually on my LAN), and I see them sending DHCPRELEASE messages to my main router during ifdown of their WAN DHCP interface. ifdown (via the interface mechanism and ultimately a ubus message) is doing something (likely SIGUSR2) to udhcpc that provokes it to send DHCPRELEASE to its server before it exits.

1 Like

Then I'm thinking you could just firewall it and reboot...?

Hmm, so that's a clever thought! On my real WAN interface, set up a firewall rule that blocks outbound DHCPRELEASE? And then if I want to do a release by hand, disable that rule temporarily.

Do you already set the norelease option in the wan interface?

uci set network.wan.norelease=1
uci commit network

In theory it should set the correct parameter for Busybox udhcpc.


Thank you @dave14305 ! Insert sheepish grin here, this is exactly what I needed, somehow missed it in all my searches.
I kept finding old reference pages for udhcpc that didn't list the underlying -R flag (which means release).

A similar norelease value will work for dhcpv6 interfaces too (using odhcp6c's -k flag which means do not release).

uci set network.wan6.norelease=1
uci commit network

This might help you with insight into thier side, if needed.

Last night my ONT battery alarm went off...so I reset it by disconnecting the battery and mains power. I did not touch the OpenWrt.

I observed this morning, I had the same public IP. :wink:

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