[systemd-devel] "Correct" way to obtain DHCP lease info?

Bruce A. Johnson bjohnson at blueridgenetworks.com
Wed Apr 21 18:24:39 UTC 2021


Is there a correct way to obtain information about the DHCP lease 
received by systemd-networkd's DHCP client functionality? It was easy 
enough to find SERVER_ADDRESS in /var/run/systemd/netif/leases/4, but 
there is a big fat warning stamped at the top of the file:

> # This is private data. Do not parse.
I'd like to be able to make a widget that can tell me which DHCP server 
issued my lease, how much more time I have, etc., mainly because I want 
to be able to ping something that is known to be on the network. I'm 
dealing with a lazy sysadmin who doesn't want to put a gateway on this 
private network, I haven't found a solution using the CLI tools.

Thanks in advance.

-- 
Bruce A. Johnson | Firmware Engineer
Blue Ridge Networks, Inc.
14120 Parke Long Court Suite 103 | Chantilly, VA 20151
Main: 1.800.722.1168 | Direct: 703-633-7332
http://www.blueridgenetworks.com
OpenPGP key ID: 296D1CD6F2B84CAB https://keys.openpgp.org/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20210421/f71f3f8a/attachment.sig>


More information about the systemd-devel mailing list