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?
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\" }"
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...
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).
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.
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.
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