DHCP and iPhones lease times

Evening amigos , my question is about a router, configured with a DHCP lease time set at 9 hours(32400 seconds) but I see iphones showing as 2000+ hours lease times when they connect so !!!!!!? oh for those who care to read and answer it is a D-Link 2680. Any thoughts will be welcomed, my lappy gets 9 hours, my android phone get's 9 hours but the iPhones hog all the few dynamic addresses.
4.8kWp 12x400W Longhi 9.6 kWh battery Giv-hy 5.0 Inverter, WSW facing Essex . Aint no sunshine ☀️ Octopus gas fixed dec 24 @ 5.74 tracker again+ Octopus Intelligent Flux leccy

Comments

  • securityguy
    securityguy Posts: 2,464 Forumite
    Part of the Furniture 1,000 Posts Combo Breaker
    edited 18 March 2014 at 12:19AM
    Here's someone with a similar problem:

    http://forum.tp-link.com/showthread.php?1429-dhcp-lease-time-problem-with-iphones

    and

    http://www.dd-wrt.com/phpBB2/viewtopic.php?p=530225

    I can probably see more detail than most, as I don't use the DHCP server on my router, I run ISC dhcpd on a pair of Pis. They're configured as follows:
    # one week (7 * 86400 = 604800)
    max-lease-time 604800;
    # three hours (3 * 3600)
    default-lease-time 10800;
    

    Equipment that doesn't ask for a specific lease time is given the default of 3 hours, but anyone who actually asks for something else will get it up to a week. So a printer gets three hours:
    lease 10.X.Y.62 {
      starts 1 2014/03/17 23:02:38;
      ends 2 2014/03/18 02:02:38;
      // lots of other stuff 
    }
    

    as does a Pure internet radio:
    lease 10.X.Y.36 {
      starts 1 2014/03/17 23:03:43;
      ends 2 2014/03/18 02:03:43;
      // lots of other stuff
    }
    


    but an iPhone presumably asks for a lot more, because it gets a week:
    lease 10.X.Y.61 {
      starts 1 2014/03/17 23:02:38;
      ends 1 2014/03/24 23:02:38;
      // lots of other stuff
    }
    

    So I would suspect that your router is setting its default lease time to 9 hours, but permits longer leases. 2000 hours is a very long time, but I suspect it's asking for (and getting) 90 days: 2160 hours. And indeed, if I restart my iPhone while running tcpdump to look at the DHCP requests, that's the case (with some deletions as a semblance of privacy):
    23:13:23.093231 IP (tos 0x0, ttl 255, id 56464, offset 0, flags [none], proto UDP (17), length 328)
        0.0.0.0.bootpc > broadcasthost.bootps: BOOTP/DHCP, Request from 30:f7:c5:xx:xx:xx (oui Unknown), length 300, xid 0x96340f68, Flags [none]
    	  Client-Ethernet-Address 30:f7:c5:xx:xx:xx (oui Unknown)
    	  Vendor-rfc1048 Extensions
    	    Magic Cookie 0x63825363
    	    DHCP-Message Option 53, length 1: Request
    	    Parameter-Request Option 55, length 6: 
    	      Subnet-Mask, Default-Gateway, Domain-Name-Server, Domain-Name
    	      Option 119, Option 252
    	    MSZ Option 57, length 2: 1500
    	    Client-ID Option 61, length 7: ether 30:f7:c5:xx:xx:xx
    	    Requested-IP Option 50, length 4: XXXX
    	    Lease-Time Option 51, length 4: 7776000
    	    Hostname Option 12, length 15: "XXXX"
    

    Note the lease time option of 7776000, which is, indeed, 90 days.

    When my DHCP server offers the iPhone a lease, it's been clamped to 7 das (604800 seconds).
    23:13:23.094454 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 330)
        xxx.yyy.zzz.bootps > broadcasthost.bootpc: BOOTP/DHCP, Reply, length 302, xid 0x96340f68, Flags [Broadcast]
    	  Your-IP XXXX
    	  Client-Ethernet-Address 30:f7:c5:xx:xx:xx (oui Unknown)
    	  Vendor-rfc1048 Extensions
    	    Magic Cookie 0x63825363
    	    DHCP-Message Option 53, length 1: ACK
    	    Server-ID Option 54, length 4:XXXX
    	    Lease-Time Option 51, length 4: 604800
    	    Subnet-Mask Option 1, length 4: 255.255.255.0
    	    Default-Gateway Option 3, length 4: XXXX
    	    Domain-Name-Server Option 6, length 12: XXXX,YYYY,ZZZZ
    	    Domain-Name Option 15, length 18: "xxx.yyy.zzz"
    

    So I would say that your iPhone is asking for a very long lease, and your router isn't firm enough in saying no. Your 9 hours configuration options sets the default, not the maximum. You either need to find an option to clamp it to a lower value, or make your DHCP pool larger (after all, 10.0.0.0/8 is there for the taking, and would give you sixteen million addresses).

    Roll on IPv6!
  • debitcardmayhem
    debitcardmayhem Posts: 12,532 Forumite
    Part of the Furniture 10,000 Posts Name Dropper Photogenic
    edited 18 March 2014 at 12:44AM
    Cheers for the response secg, I know the answer but I was looking for a way to implement it on this worthless router(it's not strictly mine) I was hoping to tie the burger to deny the "guests(apple being what it is, and their well known respect for standards:cool:)". I guess I will just have to give(loan) them a spare router I have.

    One thought I had having read your post was that the owner of the router has several iDevices which are given static addresses, I wonder if the router is behaving badly on the manufacturer mac address , but even so I can't do be-all about that either,but I may test it tomorrow.

    Edited

    I don't think that I can telent into the box to edit the DHCp config but I will try that also tomorrow
    4.8kWp 12x400W Longhi 9.6 kWh battery Giv-hy 5.0 Inverter, WSW facing Essex . Aint no sunshine ☀️ Octopus gas fixed dec 24 @ 5.74 tracker again+ Octopus Intelligent Flux leccy
  • securityguy
    securityguy Posts: 2,464 Forumite
    Part of the Furniture 1,000 Posts Combo Breaker
    Poking around on the only Dlink kit on my network (a DSL-320) it seems to be running udhcpd (telnet in, type the undocumented "sh", now you're in Busybox, look at the config files). As udhcpd is part of busybox, that makes sense. It doesn't appear to explicitly support overriding the requested lease time.

    However, looking at some old source (serverpacket.c in udhcpd 0.9.8, at first blush it looks like requests for more than the default are clamped to the default:
    if ((lease_time = get_option(oldpacket, DHCP_LEASE_TIME))) {
                    memcpy(&lease_time_align, lease_time, 4);
                    lease_time_align = ntohl(lease_time_align);
                    if (lease_time_align > server_config.lease)
                            lease_time_align = server_config.lease;
                    else if (lease_time_align < server_config.min_lease)
                            lease_time_align = server_config.lease;
            }
    

    But who knows?
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 350.1K Banking & Borrowing
  • 252.8K Reduce Debt & Boost Income
  • 453.1K Spending & Discounts
  • 243K Work, Benefits & Business
  • 597.4K Mortgages, Homes & Bills
  • 176.5K Life & Family
  • 256K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.1K Discuss & Feedback
  • 37.6K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.