[systemd-devel] dhcp address change callback?

Lennart Poettering lennart at poettering.net
Mon Jan 25 05:27:20 PST 2016


On Mon, 25.01.16 05:08, J Decker (d3ck0r at gmail.com) wrote:

> On Mon, Jan 25, 2016 at 4:43 AM, Lennart Poettering
> <lennart at poettering.net> wrote:
> > On Sat, 23.01.16 14:22, Johannes Ernst (johannes.ernst at gmail.com) wrote:
> >
> >> Is there a way to receive a callback when a dhcp client-side IP address changes?
> >>
> >> Use case: dynamic DNS update.
> >
> > On Linux changes regarding IP configuration are reported via rtnl (aka
> > routing netlink). This works regardless how the IP address was
> > required, and without any extra API from networkd.
> >
> 
> that's somewhat more useful information than 'there's hooks in C for
> it' Is there some standard daemon that listens and can bind to these
> events?
> And even so; can't a few lines (configuration defintion, a variable to
> store a scriptname, and a call to exec the script like using a systemd
> unit to setup a network be added to a single place that already does
> the change?  Even if it's a systemd service that's added that in turn
> listens to rtnl?

Well, in systemd, a couple of daemons subscribe to rtnl, including
networkd and resolved among others. However, none of them provide you
with a concept of hooks for invoking scripts when events happen.

NetworkManager provides you some support for this, and other daemons
might too, but they also take over control of an interface completely,
not sure if that's what you want.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list