WAN IP renewal with dhcp when IP doesn't change

Started by jonm, August 29, 2023, 01:10:49 PM

Previous topic - Next topic
Why does dhclient / rc.newwanip trigger when the DHCP WAN IP address remains the same? I'm seeing this on my production system and on a test box I just set up. Here I set the lease time really low and we can see the IP stays the same but dhclient says "New IP Address" and rc.newwanip fires, this drops/re-starts OpnVPN connections etc.

Any way to stop this happening? My WAN IP never changes.


<13>1 2023-08-29T12:58:43+02:00 test2.localdomain dhclient 8413 - [meta sequenceId="1"] New IP Address (em0): 10.2.2.2
<13>1 2023-08-29T12:58:43+02:00 test2.localdomain dhclient 9330 - [meta sequenceId="2"] New Subnet Mask (em0): 255.255.255.0
<13>1 2023-08-29T12:58:43+02:00 test2.localdomain dhclient 10372 - [meta sequenceId="3"] New Broadcast Address (em0): 10.2.2.255
<13>1 2023-08-29T12:58:43+02:00 test2.localdomain dhclient 11346 - [meta sequenceId="4"] New Routers (em0): 10.2.2.1
<13>1 2023-08-29T12:58:43+02:00 test2.localdomain dhclient 13159 - [meta sequenceId="5"] Creating resolv.conf
<13>1 2023-08-29T12:58:44+02:00 test2.localdomain opnsense 14149 - [meta sequenceId="6"] /usr/local/etc/rc.newwanip: IP renewal starting (new: 10.2.2.2, old: 10.2.2.2, interface: wan, device: em0, force: yes)
<13>1 2023-08-29T12:58:44+02:00 test2.localdomain opnsense 14149 - [meta sequenceId="7"] /usr/local/etc/rc.newwanip: ROUTING: entering configure using 'wan'
<13>1 2023-08-29T12:58:44+02:00 test2.localdomain opnsense 14149 - [meta sequenceId="8"] /usr/local/etc/rc.newwanip: ROUTING: configuring inet default gateway on wan
<13>1 2023-08-29T12:58:44+02:00 test2.localdomain opnsense 14149 - [meta sequenceId="9"] /usr/local/etc/rc.newwanip: ROUTING: setting inet default route to 10.2.2.1
<13>1 2023-08-29T12:58:44+02:00 test2.localdomain opnsense 14149 - [meta sequenceId="10"] /usr/local/etc/rc.newwanip: plugins_configure monitor (,WAN_DHCP)
<13>1 2023-08-29T12:58:44+02:00 test2.localdomain opnsense 14149 - [meta sequenceId="11"] /usr/local/etc/rc.newwanip: plugins_configure monitor (execute task : dpinger_configure_do(,WAN_DHCP))
<13>1 2023-08-29T12:58:45+02:00 test2.localdomain opnsense 14149 - [meta sequenceId="12"] /usr/local/etc/rc.newwanip: plugins_configure vpn (,wan)
<13>1 2023-08-29T12:58:45+02:00 test2.localdomain opnsense 14149 - [meta sequenceId="13"] /usr/local/etc/rc.newwanip: plugins_configure vpn (execute task : ipsec_configure_do(,wan))
<13>1 2023-08-29T12:58:45+02:00 test2.localdomain opnsense 14149 - [meta sequenceId="14"] /usr/local/etc/rc.newwanip: plugins_configure vpn (execute task : openvpn_configure_do(,wan))
<13>1 2023-08-29T12:58:45+02:00 test2.localdomain opnsense 14149 - [meta sequenceId="15"] /usr/local/etc/rc.newwanip: Resyncing OpenVPN instances for interface WAN.
<13>1 2023-08-29T12:58:45+02:00 test2.localdomain opnsense 14149 - [meta sequenceId="16"] /usr/local/etc/rc.newwanip: plugins_configure newwanip (,wan)
<13>1 2023-08-29T12:58:45+02:00 test2.localdomain opnsense 14149 - [meta sequenceId="17"] /usr/local/etc/rc.newwanip: plugins_configure newwanip (execute task : dnsmasq_configure_do())
<13>1 2023-08-29T12:58:45+02:00 test2.localdomain opnsense 14149 - [meta sequenceId="18"] /usr/local/etc/rc.newwanip: plugins_configure newwanip (execute task : ntpd_configure_do())
<13>1 2023-08-29T12:59:04+02:00 test2.localdomain opnsense 14149 - [meta sequenceId="19"] /usr/local/etc/rc.newwanip: plugins_configure newwanip (execute task : opendns_configure_do())
<13>1 2023-08-29T12:59:04+02:00 test2.localdomain opnsense 14149 - [meta sequenceId="20"] /usr/local/etc/rc.newwanip: plugins_configure newwanip (execute task : openssh_configure_do(,wan))
<13>1 2023-08-29T12:59:04+02:00 test2.localdomain opnsense 14149 - [meta sequenceId="21"] /usr/local/etc/rc.newwanip: plugins_configure newwanip (execute task : unbound_configure_do(,wan))
<13>1 2023-08-29T12:59:07+02:00 test2.localdomain opnsense 14149 - [meta sequenceId="22"] /usr/local/etc/rc.newwanip: plugins_configure newwanip (execute task : vxlan_configure_do())
<13>1 2023-08-29T12:59:07+02:00 test2.localdomain opnsense 14149 - [meta sequenceId="23"] /usr/local/etc/rc.newwanip: plugins_configure newwanip (execute task : webgui_configure_do(,wan))
<13>1 2023-08-29T13:07:01+02:00 test2.localdomain dhclient 35694 - [meta sequenceId="1"] New IP Address (em0): 10.2.2.2
<13>1 2023-08-29T13:07:02+02:00 test2.localdomain dhclient 36371 - [meta sequenceId="2"] New Subnet Mask (em0): 255.255.255.0
<13>1 2023-08-29T13:07:02+02:00 test2.localdomain dhclient 36649 - [meta sequenceId="3"] New Broadcast Address (em0): 10.2.2.255
<13>1 2023-08-29T13:07:02+02:00 test2.localdomain dhclient 37773 - [meta sequenceId="4"] New Routers (em0): 10.2.2.1
<13>1 2023-08-29T13:07:02+02:00 test2.localdomain dhclient 40201 - [meta sequenceId="5"] Creating resolv.conf
<13>1 2023-08-29T13:07:02+02:00 test2.localdomain opnsense 41928 - [meta sequenceId="6"] /usr/local/etc/rc.newwanip: IP renewal starting (new: 10.2.2.2, old: 10.2.2.2, interface: wan, device: em0, force: yes)
<13>1 2023-08-29T13:07:02+02:00 test2.localdomain opnsense 41928 - [meta sequenceId="7"] /usr/local/etc/rc.newwanip: ROUTING: entering configure using 'wan'
<13>1 2023-08-29T13:07:02+02:00 test2.localdomain opnsense 41928 - [meta sequenceId="8"] /usr/local/etc/rc.newwanip: ROUTING: configuring inet default gateway on wan
<13>1 2023-08-29T13:07:02+02:00 test2.localdomain opnsense 41928 - [meta sequenceId="9"] /usr/local/etc/rc.newwanip: ROUTING: setting inet default route to 10.2.2.1
<13>1 2023-08-29T13:07:02+02:00 test2.localdomain opnsense 41928 - [meta sequenceId="10"] /usr/local/etc/rc.newwanip: plugins_configure monitor (,WAN_DHCP)
<13>1 2023-08-29T13:07:02+02:00 test2.localdomain opnsense 41928 - [meta sequenceId="11"] /usr/local/etc/rc.newwanip: plugins_configure monitor (execute task : dpinger_configure_do(,WAN_DHCP))
<13>1 2023-08-29T13:07:03+02:00 test2.localdomain opnsense 41928 - [meta sequenceId="12"] /usr/local/etc/rc.newwanip: plugins_configure vpn (,wan)
<13>1 2023-08-29T13:07:03+02:00 test2.localdomain opnsense 41928 - [meta sequenceId="13"] /usr/local/etc/rc.newwanip: plugins_configure vpn (execute task : ipsec_configure_do(,wan))
<13>1 2023-08-29T13:07:03+02:00 test2.localdomain opnsense 41928 - [meta sequenceId="14"] /usr/local/etc/rc.newwanip: plugins_configure vpn (execute task : openvpn_configure_do(,wan))
<13>1 2023-08-29T13:07:03+02:00 test2.localdomain opnsense 41928 - [meta sequenceId="15"] /usr/local/etc/rc.newwanip: Resyncing OpenVPN instances for interface WAN.
<13>1 2023-08-29T13:07:03+02:00 test2.localdomain opnsense 41928 - [meta sequenceId="16"] /usr/local/etc/rc.newwanip: plugins_configure newwanip (,wan)
<13>1 2023-08-29T13:07:03+02:00 test2.localdomain opnsense 41928 - [meta sequenceId="17"] /usr/local/etc/rc.newwanip: plugins_configure newwanip (execute task : dnsmasq_configure_do())
<13>1 2023-08-29T13:07:03+02:00 test2.localdomain opnsense 41928 - [meta sequenceId="18"] /usr/local/etc/rc.newwanip: plugins_configure newwanip (execute task : ntpd_configure_do())



Because your provider said so as communicated by dhclient.

> force: yes


Cheers,
Franco

Hmm, what mechanism does the provider use to signify 'force'?

In the example I posted the 'provider' is actually just dhcpd running on a test server in my lab. I don't see anything in the dhcp server that specifies forcing a change, unless I'm missing something obvious.

I can see "force" mentioned in dhclient-script:


if [ -n "$alias_ip_address" -a "$new_ip_address" != "$alias_ip_address" ]; then
                add_new_alias
                changes="yes"
        fi
        #if is_default_interface; then
                add_new_resolv_conf
        #fi
        if [ "$changes" = "yes" ] ; then
                /usr/local/sbin/configctl -d interface newip $interface force
        fi
        ;;


...but the new IP is the same as the old IP, so not sure why $changes is yes here.

Any sort of DHCP based refresh of the address (even if it's the same). Some ISPs use insanely short lease times.


Cheers,
Franco