Discussion:
networkd dhcp client - serialize / run stand alone / inject or restart dhcp client
(too old to reply)
Dimitri John Ledkov
2018-03-09 09:30:11 UTC
Permalink
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.

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.

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?
--
Regards,

Dimitri.
Lennart Poettering
2018-03-20 10:36:26 UTC
Permalink
Post by Dimitri John Ledkov
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.
Post by Dimitri John Ledkov
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.
Post by Dimitri John Ledkov
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
Loading...