My host is on a dynamic IP address (IPv4 only), which it receives via
DHCP from my provider. So far, I have been using ISC dhclient for this,
the network interface being marked as unmanaged in its .network file.
But since dhclient isn't maintained any more, I am exploring ways to
replace it with systemd's DHCP client.
While address updates using systemd's DHCP client seem to work just
fine, there is a problem, however. Whenever the host's IP address
changes, some reconfiguration has to be done: running services listening
on sockets opened before the address change have to be restarted or at
least notified, and a dynamic DNS A record has to be updated. With ISC
dhclient, this used to be unproblematic, as it can be configured to
invoke external scripts when it receives a new address from the DHCP server.
As far as I can tell, systemd's DHCPv4 client does not provide any such
hooks. I looked at the D-Bus interface of systemd-networkd
(org.freedesktop.network1), but was unable to spot anything of that
sort. However, as I am unfamiliar with Dbus in general, it is very
possible that I missed something.
I even tried to write a program processing rtnetlink notifications
resulting from address or route changes, however, this approach turned
out to have it's own problems. At this level it is difficult to detect
the point when all changes have been completed and the system has
reached a new stable state, so that reconfiguration can safely commence.
I'd greatly appreciate any helpful comments!
Thomas