Koozali.org: home of the SME Server

External IP lease renewal forces ip-change event

Offline NTILZA

  • 9
  • +0/-0
External IP lease renewal forces ip-change event
« on: August 17, 2022, 04:59:04 AM »
Hello, all.

I was recently forced to transition to a new ISP as my prior ISP was acquired by a national carrier (Rogers).

Rogers DHCP lease is one hour.

Messages log shows the renewal time (roughly half what "ip -4 a s" reports), a ton of ignored DHCPREQUESTs to the IP of the DHCP server, then to 255.255.255.255, and finally a DHCPDISCOVER, DHCPREQUEST (to 255.255.255.255), DHCPOFFER (from the IP of the DHCP server) and finally a DHCPACK.  All pretty much by the book.

But the IP must have been released when the handshake starts, as right after that, this happens:
Code: [Select]
Processing event: ip-changeAlong with everything that entails.  Every hour.  The External IP does not change - I get the same one every time.

I set up a second server to test the behaviour, since I got bit by bug 11930 before the patch came out, and it affected openvpn-bridge as well, which created quite a mess.  I wanted to be sure the behaviour could be duplicated.

Normally, I wouldn't be too concerned, as this is "the way" of DHCP (and my :x new ISP), but it seems to disrupt any real-time goings-on (like Zoom/Teams meetings) and sometimes bad enough that the session needs to be restarted.  And this should not happen.

Does anyone out there with more network savvy think this is a problem, or "de rigueur" where one hour leases are concerned??  Could the IP be held for a few extra seconds so as not to disrupt traffic or trigger ip-change???  (I'm guessing the latter would be an upstream problem, and likely not a problem at all - but I have to ask...)

Thanks in advance for the feedback.

Offline Jean-Philippe Pialasse

  • *
  • 2,761
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: External IP lease renewal forces ip-change event
« Reply #1 on: August 17, 2022, 08:06:35 AM »
I see two workarounds

- using another reason than BOUND in  /etc/dhcp/dhclient-exit-hooks

- add an earlier check to compare old ip to new ip and do nothing if the same.


for first see man /usr/sbin/dhclient-script

for second I think it is a script run by root

you could do
Code: [Select]
if [ "$reason" = "BOUND" ]
then
    oldip=$(/sbin/e-smith/config get ExternalIP)
    if [ "$oldip" = "$new_ip_address" ]; then
        echo "same ip $new_ip_address, doing nothing"
    else
        /sbin/e-smith/signal-event ip-change "$new_ip_address" "$interface"
   fi
fi

Offline NTILZA

  • 9
  • +0/-0
Re: External IP lease renewal forces ip-change event
« Reply #2 on: August 18, 2022, 04:43:19 AM »
Thank you, Jean-Philippe, for the suggestions.  I've implemented the latter to test while I try to wrap my head around the former.  I'll monitor it before I apply it to the production machine and give it a proper stress test.

I'll post again if I find a better solution using dhclient-script or other.

Thank you again for the assistance.