Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to check the DHCP lease remaining time

Hello Community,


I am troubleshooting a connectivity issue on my Macbook pro which APPARENTLY ignores the DHCP ACK messages sent in reply to Unicast DHCP Requests (the ones sent when T1 timer expires at 50% of the lease time) from a particular DHCP server.


Do you happen to know the command which shows the current remaining lease time for the assigned DHCP IP address? I need that to confirm my assumptiom.


By checking in the /leases folder you may only see the original lease Start date, which is the time the initial DHCP DORA process took place. When the 'refresh' DHCP requests are sent after 50% of the lease, and consequently the DHCP ACKs from the server are received the value in that file does not change. That means that this command is not good to check what I need.


I.e.:

xxxxxxx-mac:db xxxxxxi$ sudo cat /private/var/db/dhcpclient/leases/en1-1,<omitted-MAC>

Password:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

<key>IPAddress</key>

<string>192.168.1.14</string>

<key>LeaseLength</key>

<integer>600</integer>

<key>LeaseStartDate</key>

<date>2012-03-02T09:16:14Z</date>

<key>PacketData</key>

<data>

AgEGAKA9KL0AAAAAAAAAAMCoAQ7AqAEBAAAAAAAmuxA9XwAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABjglNjNQEFNgTAqAEBMwQAAAJY

AQT///8AAwTAqAEBBgTAqAEBDwRob21lKgTDDQGZ/wAAAAAAAAAAAAAAAAAA

</data>

<key>RouterHardwareAddress</key>

<data>

6L6BA24U

</data>

<key>RouterIPAddress</key>

<string>192.168.1.1</string>

</dict>

</plist>


Even when a subsequent DHCP ACK message is received that value remains unchanged.


I need a command or application which shows instead the actual lease timer.


thanks,


Riccardo

MacBook Pro, Mac OS X (10.7.3)

Posted on Mar 2, 2012 1:59 AM

Reply
8 replies

Mar 2, 2012 6:16 AM in response to Riccardo-S

or maybe since I am new to the community somebody can point me to the easiest way to contact a developer working in that area (am I too naive? 🙂 )


I would like to get in touch with somebody in Apple skilled in DCHP operation both from a pure protocol and OS X implementation point of view.


I have the idea that I came across to one of those nasty defect which may potentially be the cause (or one of the cause) of those Wi-FI connectivity issues in Lion that thousands (still counting) users are encountering since their migration to 10.7


Riccardo

Mar 5, 2012 8:03 AM in response to Matt Clifton

apparently I am not getting lucky by putting the question this way.. let me try another approach giving more background details.


PROBLEM:

When I am in a particular location my mac get disconnected from the network every 30 minutes when my DHCP IP address expires. The DHCP server grants 30 minutes IP leases only.

I took some capture (I sniffed DHCP transactions) and I could see that when 50% of the lease time is reached (T1) my mac sends a new unicast DHCP request to the DHCP server which replies immediately with a DHCP ACK confirming 30 more minutes.

Unfortunately I did not find any command to see if the lease gets actually extended.

What I see is that after few minutes (matching the 87.5% T2 timer) my match fires a new DHCP request, which is also answered immediately with a ACK. Then in the last minutes before the 30 minutes threshold I see many other requests which are also all answered. Nevertheless when the origianal 30 minutes lease expires my MAC releases the IP and start a new Discovery process (sending a bcast request). After few seconds the DORA process completes and usually the mac gets the same IP address. The issue for me is that in the meantime my VPN session to my corporate network goes down and all the services associated with that go down too (softphone, presence, chat, email etc).

I did some test in my place and I configured my DHCP server to assign IP addresses with a 30 minutes lease time too. Strangely the issue does not happen. On my place every 15 minutes (again the famous T1 timer = 50% of the lease) my mac sends a request and the DHCP replies with an ACK. This time apparently the lease gets extended as I don't see all the other requests. Needless to say that the IP does not get released at any time.


I compared the wireshark capture to spot any difference between that DHCP ACK I got in that given location and the one I got in my place but they look the same to me.


So the question is, how would you troubleshoot this issue? Which kinds of logs, outputs or debugs should I take?


thanks,


Riccardo

Mar 29, 2012 2:59 AM in response to Riccardo-S

in case somebody is interested I fixed the issue by adding in the ipfw.conf line the following line:


add 00050 allow udp from any to any src-port 67 dst-port 68 in


issue is completely solved after adding this line.


I still think that there is something seriously wrong on OS X as from a technical point of view this solution does not make sense as it simply allow what should be allowed already.


In particular it allows any kind of DHCP server replies (Offer, ACK etc) which go from UDP port 67 to port 68.


However also the initial DORA relies on those ports so the question is: how come that the initial messages to port 68 are allowed but the ones sent for the renewal are not going through and a specific allowing rule is needed?


Also, why I see the issue on some locations only?


Lastly, it is written that on Lion ipfw has been replaced by pf, however ipfw is apparently still alive and kicking.


I guess I will not find any answer to this but at least I got the issue solved.


Riccardo

How to check the DHCP lease remaining time

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.