RE: DHCP lease renew





-----Original Message-----
From: Thomas Haller [mailto:thaller redhat com]
Sent: Monday, December 24, 2018 16:06
To: Usyskin, Alexander <alexander usyskin intel com>; networkmanager-
list gnome org
Subject: Re: DHCP lease renew

On Mon, 2018-12-24 at 13:43 +0000, Usyskin, Alexander wrote:
-----Original Message-----
From: Thomas Haller [mailto:thaller redhat com]
Sent: Monday, December 24, 2018 11:35
To: Usyskin, Alexander <alexander usyskin intel com>;
networkmanager-
list gnome org
Subject: Re: DHCP lease renew

On Mon, 2018-12-24 at 08:03 +0000, Usyskin, Alexander via
networkmanager-
list wrote:
Hi

I'm trying to force DHCP lease renew for specific interface.
Basically replicate in Linux IpRenewAddress function from Win32
API.
Without NetworkManager it's fairly simple, like "dhclient -r eth4
&& dhclient -1 eth4".
But NetworkManager manages dhclient in different way, so that lead
to an unexpected consequences.

I can't find a way to ask NetworkManager to forcefully renew the
lease. Neither through DBus API, nor from command line.
Is there any way to do such thing?
If not, how can I file an enhancement request?

Please CC me on reply, I'm not subscribed to this list.

Hi,


$ nmcli device reapply $IFNAME

(or, on D-Bus, via Device's Reapply() method).


(or, fully reactivate the profile, like)

  nmcli connection up "$PROFILE"


best,
Thomas

Tried to run reapply (via DBus call, but also tried nmcli), have
"NetworkManager[916]: <info>  [1545650569.2423] audit: op="device-
reapply" interface="eth4" ifindex=2 pid=28554 uid=0 result="success"
"
in syslog, but no DHCP activity observed on the link.

What I'm doing wrong here?

For the record it's Ubuntu 16.04 LTS with nm version 1.2.6

Thanks


Hi,


ah right. Reapply() doesn't restart DHCP. Sorry.

I guess, that leaves you with:

- a full reactivation, like
  nmcli connection up "$PROFILE"

- disable and re-enable DHCP:

  nmlic device modifiy "$IFACE" ipv4.method disabled
  nmlic device modifiy "$IFACE" ipv4.method auto

  This also uses Reapply() D-Bus method under the hood.
  However, I don't know whether that works with 1.2.6, which is
  2 years old.

I can also toggle network card down/up using kernel netlink with same result, I assume.

Maybe you could explain, why you want to request a new lease?

We have HW that tries to maintain network card up if OS is down. It need information from DHCP reply to do it.
Sometimes HW misses DHCP exchange and ask SW to retry. I can't change the HW...


best,
Thomas


Thanks
--
Sasha





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]