Ian Sharpe - Technical Notes - NTL / dhcpcd Incompatibility


NOTE

The following text is now obsolete as dhcpcd-1.3.22-pl4 contains updates to cope with NTL.

Problem Overview

NTL appears to be rolling out a new dhcpc lease strategy. An initial lease time of one hour is given, which is extended (up to a maximum of 24hrs) on subsequent renewals. dhcpcd has a feature and a bug that stops this working optimally.
  1. Feature: dhcpcd requests a renewal with a lease time option set to the value of the lease time it was initially given - in this case 1hr - so dhcpcd is locked into a cycle of requesting renewals every half hour.
  2. Bug: dhcpcd only calculates T1 and T2 (the times to renew/rebind) if they aren't in the message or haven't been calculated from the lease time already. So the new lease time is effectively ignored and only the values of T1/T2 based on the initial lease time are used.
Note that dhcpcd as delivered will work[1], but when connecting to an NTL dhcp server running the new strategy:

  1. lease renewal requests are more frequent than they should be.
  2. there is a greater chance of getting a different IP address (assuming the computer is regularly shut down). This may also be a feature of the new strategy.

Temporary Fix

A temporary fix (dhcpcd-1.3.22-pl3-ntl.diff) is to:

  1. remove the dhcpIPaddrLeaseTime option from the request in buildmsg.c/buildDhcpRenew
  2. set DhcpOptions.val[dhcpT1value] and DhcpOptions.val[dhcpT2value] to zero at the start of client.c/parseDhcpMsgRecv (if they already exist)

With these changes, on an NTL network, the lease time starts at 1hr and is gradually stepped up to 24hrs on subsequent renewal requests as expected. This should be long enough for a system that is shut down overnight to still retain the original IP address (assuming it is not released with the -k option). In this case the initial lease time will remain at 24hrs.

This is not a complete solution since the info/cache file is not updated when the lease time changes. It is not clear what the strategy on this should be - it seems odd that the lease times are held in the cache, rather than simply being logged. This is a problem that is more properly addressed by the code author if and when a fix to the above glitch is incorporated

Installation

  1. Download dhcpcd-1.3.22-pl3.tar.gz and dhcpcd-1.3.22-pl3-ntl.diff into a work area.
  2. Untar and patch
    tar xzf dhcpcd-1.3.22-pl3.tar.gz
    cd dhcpcd-1.3.22-pl3
    patch -p1 < ../dhcpcd-1.3.22-pl3-ntl.diff
    
  3. Build and install
    # Check configure options with './configure --help
    ./configure
    make
    # May need to be root for next line
    make install
    


[1] Currently NTL are returning hostnames that are not recognised by their DNS, so the -H option cannot be used.
Original at http://www.sharpe-practice.co.uk/isharpe/technote/ntldhcpcd.htm. $Id: ntldhcpcd.htm,v 1.5 2003/02/03 13:50:12 isharpe Exp $