3

When using dhclient, the current lease info, including expiration time, is in /var/lib/dhclient/dhclient.leases, and contains something similar to

lease { interface "enp3s0"; fixed-address [redacted]; option subnet-mask 255.255.254.0; option dhcp-lease-time 3523; option routers [redacted]; option dhcp-message-type 5; option dhcp-server-identifier 96.113.84.141; option domain-name-servers 127.0.0.1,75.75.75.75,75.75.76.76; option domain-search "[redacted]"; option dhcp-renewal-time 2016; option broadcast-address 255.255.255.255; option dhcp-rebinding-time 3073; option domain-name "hsd1.or.comcast.net."; renew 3 2022/06/22 23:59:57; rebind 4 2022/06/23 00:23:15; expire 4 2022/06/23 00:30:45; } 

However, my system uses NetworkManager which, based on my research, uses its own internal DHCP client. Looking in /var/lib/NetworkManager I see

$ sudo ls /var/lib/NetworkManager/ internal-79cbd87e-9d65-4aa4-8768-88b460fd372c-enp3s0.lease NetworkManager-intern.conf seen-bssids internal-79cbd87e-9d65-4aa4-8768-88b460fd372c-ens1.lease NetworkManager.state timestamps internal-bdaf2eb0-de2e-4573-a415-214629c7b757-enp3s0.lease secret_key 

which looks promising. However, the lease files contain only the IP address.

$ sudo cat /var/lib/NetworkManager/internal-79cbd87e-9d65-4aa4-8768-88b460fd372c-enp3s0.lease # This is private data. Do not parse. ADDRESS=[redacted] 

Simple question: Where does NetworkManager keep the lease data so it knows when it needs to renew the lease?

2
  • have you ever found the solution of this issues Commented Sep 5, 2023 at 9:07
  • @deen No, I gave up on CentOS, switched to Debian (no regrets) and switched to pfSense for my firewall/DHCP Commented Sep 14, 2024 at 0:15

1 Answer 1

4

Seen here, newer versions of NetworkManager will expose this information in /run/NetworkManager/devices/$IFINDEX. If you have an older version (or just prefer running programs to parsing files) you can interrogate NetworkManager for this information using

$ nmcli -f DHCP4 device show $IFNAME 

where $IFINDEX is the numerical index NetworkManager has assigned to your interface and $IFNAME is its name.

(I suspect you already know this because the question on networkmanager-list had the same wording as here, but I doubt we'll be the last two people with this exact question)

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.