Re: How to obtain lease duration, renew time and rebind time?
Shahid Mahmood
Wed May 25 18:12:05 2016
On Wed, May 25, 2016 at 1:25 PM, Shahid Mahmood <shahid.avaya@xxxxxxxxx>
wrote:
>
>
> On Wed, May 25, 2016 at 1:01 PM, Roy Marples <roy@xxxxxxxxxxxx> wrote:
>
>> On 25/05/2016 17:03, Shahid Mahmood wrote:
>> > Hi,
>> > How can I obtain lease duration, renew time and rebind time from the
>> > currently running dhcpcd session?
>>
>> $ dhcpcd -V4 | grep "dhcp.*time"
>> 051 dhcp_lease_time uint32 request
>> 058 dhcp_renewal_time uint32 request
>> 059 dhcp_rebinding_time uint32 request
>>
>> $ sudo dhcpcd -U4 wlp4s0 | grep "dhcp.*time"
>> dhcp_lease_time=3600
>>
>> Roy
>>
>
> Thanks, but seems to be not working for me:
>
> # dhcpcd -U4 -f ./dhcpcd.conf -c /<script> eth0
> eth0: reading lease `/var/db/dhcpcd-eth0.lease'
> eth0: executing `<script>' DUMP
> #
>
> My dhcpcd.conf file:
> release
> debug
> noipv4ll
> timeout 60
> vendorclassid xxxxx
> option ntp_servers, vendor_encapsulated_options, dhcp_lease_time
> option domain_name_servers, domain_name, domain_search, host_name,
> sip_server, site_specific
> noipv6
>
> Command line:
> #dhcpcd -f ./dhcpcd.conf -c <script> eth0
>
> Although I do see this information printed on the terminal at command line:
> ...
> eth0: leased 192.168.10.102 for 60 seconds
> eth0: renew in 30 seconds, rebind in 52 seconds
> eth0: writing lease `/var/db/dhcpcd-eth0.lease'
> eth0: adding IP address 192.168.10.102/24 broadcast 192.168.10.255
> eth0: adding route to 192.168.10.0/24
> ...
>
OK. I found the answer is passed to the hook script in the form of
variables:
new_dhcp_lease_time=60
new_dhcp_rebinding_time=52
new_dhcp_renewal_time=30
so 'dump -U' not needed.
Thanks!
-shahid
Archive administrator: postmaster@marples.name