Fwd: Rapid DHCP

Dan Williams dcbw at redhat.com
Sat Jul 30 22:49:19 UTC 2011


On Sat, 2011-07-30 at 11:46 -0400, Genes MailLists wrote:
> On 07/30/2011 10:37 AM, Lennart Poettering wrote:
> > On Sat, 30.07.11 10:31, Genes MailLists (lists at sapience.com) wrote:
> > 
> >>>> http://cafbit.com/entry/rapid_dhcp_or_how_do
> >>>
> 
> > 
> > IIRC connman (i.e. NM's competition) can do the ARP magic, too.
> > 
> > Lennart
> > 
> 
> 
>   Seems like a pretty reasonable thing to do - surely better than just
> waiting for a timeout to decide if the server is not there ... are you
> aware of any gotcha's ?

NM already keeps DHCP information around based on the network you're
connecting to, so we don't need to ARP a bunch of servers just to
determine whether the DHCP server we wanted is still there.  dhclient is
smart enough to attempt to reclaim the lease if it's not already
expired.  Note that the Mac attempts to ARP a number of different DHCP
servers (192.168.2.1, 192.168.4.1, 192.168.1.1) which would be pointless
with NetworkManager, because it's extremely unlikely that the DHCP
server on your wifi network has changed; NM would simply know that the
last DHCP server used *on that wifi network* was 192.168.1.1 and not
bother to try talking to other ones like Mac OS X appears to do.

NM could use the same method of ARPing multiple DHCP servers that Mac OS
X does, but it wouldn't provide much additional benefit, if any, at
least on WiFi networks.  It could be used on wired networks to (a)
determine which wired network you're connected to, and (b) do rapid
DHCP.  Again, NM already knows what DHCP server and what lease was last
used on the specific wifi network you just connected to, and it won't
bother doing a DISCOVER, it'll just jump to RENEW if your lease is still
valid.

What's unique about the method described there is that the Mac
configures the interface with the same IP address it previously had if
the lease is still valid, while NetworkManager waits for the DHCP server
confirm the lease.  So we could presumptuously configure the interface
with the previous address from the lease and then only tear it down if
the DHCP server fails or rejects the renewal.

Of course, none of this helps if your DHCP leases are short, but it
certainly helps if you put your laptop to sleep a lot and wake it up in
the same location.

Dan



More information about the devel mailing list