[systemd-devel] networkd dhcp client - serialize / run stand alone / inject or restart dhcp client

Lennart Poettering lennart at poettering.net
Tue Mar 20 10:36:26 UTC 2018


On Fr, 09.03.18 10:30, Dimitri John Ledkov (xnox at ubuntu.com) wrote:

> I have a request to start/stop/restart the dhcp lease client, and/or
> run networkd dhcp client stand alone, or somehow serialize dhcpclient
> lease and inject that for networkd-dhcp to pick that up and restart.
> 
> For example, Ubuntu initramfs currently does not have networkd in it,
> but it can bring interfaces up with dhcp.
> 
> And i'm not sure if there is a way to pass/inject the dhcp lease to
> networkd as a runtime state to pick up from there. Ideally without
> re-acquiring the lease once again.

Yes, the lease is serialized to /run. The format is not considered
public API and not documented. But then again, it hasn't changed in
quite a while.

> I'm currently pondering if I should be trying to get networkd running
> in the initramfs (without systemd in the initramfs), or like generate
> a runtime networkd config for post-pivot to root.

I'd recommend to run systemd in the initrd really. That's your best
option. Or just just use dracut right-away.

> Ideally, it would be nice to ship a "one-shot" dhcp lease acquire
> helper binary, that could be shipped in the initramfs, which does
> everything using the internal networkd dhcp lease and serializes the
> state in /run/. Such that post-pivot, the full networkd can notice
> that lease file and start running the longterm dhcp client.
> 
> Think, something like $ ipconfig -c dhcp eth0 -> as shipped by klibc-utils
> 
> Would such a util, be in-scope, for systemd-networkd?

I am quite sure we shouldn't have that. This is too specific, and the
better approach is to just use networkd/systemd in the initrd I am
sure...

I think if you need this it'd be best to just synthesize those lease
files yourself, and ignore that they aren't official API.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list