On 7/20/2020 11:08, Thomas Haller wrote: > On Mon, 2020-07-20 at 10:50 -0500, Moby via networkmanager-list wrote: >> I just upgraded a Leap 15.1 machine to 15.2. I am using >> NetworkManager >> to manage networking on that machine. >> >> Prior to the upgrade, I was able to see DHCP lease information in >> /var/lib/NetworkManager/dhclient*.lease files. >> >> After the upgrade, I see /var/lib/NetworkManager/internal*lease file, >> but it contains just the IP address and no other information that was >> obtained via DHCP. >> >> I see that I can obtain all the DHCP information via nmcli device >> show. >> My question is where is this information stored? Or is all the >> information kept in memory now by NetworkManager and only the address >> is >> written to the internal*lease file (this seems hard to believe, I >> would >> think NetworkManager would want to store the leased IP and, at a >> minimum, DNS and gateway information as well). >> >> >> The installation of NetworkManager is pretty much out of the box, no >> custom dhcp client etc. is configured to be used by NetworkManager. >> >> Thank you in advance for your help, > > Hi Moby, > > it's all as you said, with the "hard to believe" part to be the case. > > NetworkManager has different DHCP implementations. You can configure > them via "dhcp" option. See `man NetworkManager.conf`. > > A while ago, the default changed from "dhclient" to "internal". I > presume that what happend on your OpenSUSE upgrade. If you wish, you > can still get the previous plugin, by explicitly configuring it in > NetworkManager.conf. Maybe one day the "dhclient" plugin will be > dropped entirely, but that is still far away, so if you wish, you may > use that. > > dhclient has the "advantage", in that you can write additional > configuration to /etc/dhcp. That makes it more powerful, but also such > options are not accessible via the regular NetworkManager API (and > NetworkManager doesn't really know what you are doing there). > > For the internal plugin, NM doesn't need any of the information from > the lease, except the IP address from the last time. When NM tries to > obtain a lease, it will preferably ask to get that IP address. No other > information from the lease is used, and thus no other information is > persisted. > > > There is no official file-based API to get the options of the DHCP > lease. These lease files are internal. > You could call `nmcli -f DHCP4 device show "$DEVICE"`, or of course get > it yourself from D-Bus -- with a tool/script of your choice. > > > best, > Thomas
Thank you Thomas, that explains a lot. I shall modify my code to parse the output of nmcli -f ... as you say instead of trying to read from some sort of persistent store directly. Regards, --Moby _______________________________________________ networkmanager-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/networkmanager-list
