2

How do I find the DHCP lease time when I am using systemd-networkd?

My network is defined in /etc/systemd/network/eth0.network:

[Match]
Name=eth0

[Network]
DHCP=yes

There are other question on this site asking for the same information but they weren't using systemd-networkd but dhclient or some other method.

I've tried looking in journalctl to no avail. I’m using ArchLinux.

  • Try grep lease /var/log/syslog. – Tomasz Mar 11 '18 at 15:36
  • @tomasz forgot to mention that I’m using ArchLinux which uses journald not syslog. I’ve updated the question – DarkHeart Mar 11 '18 at 23:02
3

Depending on the OS; Enabling debug isn't always necessary.

systemd-networkd should store the lease info under /run/systemd/netif/leases/

i.e.

cat /run/systemd/netif/leases/2

4

Per Lennart's post here, you have to change systemd-networkd log level to debug.
If you wanted to have it on all the time you could use a drop-in unit:

mkdir -p /etc/systemd/system/systemd-networkd.service.d
cat << IN > /etc/systemd/system/systemd-networkd.service.d/10-debug.conf
[Service]
Environment=SYSTEMD_LOG_LEVEL=debug
IN
systemctl daemon-reload
systemctl restart systemd-networkd

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.