Notice when an IP is set or changes

Hello everyone,

Initial situation, I have privileged containers that get an IPv4 and Ipv6 from my router at startup.

Now I am looking for an elegant way to execute a script every time the IP v4 or v6 changes.

Attempts with dhclient hooks have failed so far.

Has anyone ever had a similar requirement and an elegant solution for it?

I am looking forward to your feedback.

Hmm, dhclient hooks would definitely have been my go to solution there, assuming your container is in fact using dhclient (for networkd you’d need to use networkd-dispatcher).

You may be able to do something custom listening for netlink events, but running a daemon just for this seems a bit much.