- Forward


Dynamic Host Configuration Protocol (DHCP)
An Introduction


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu

Print

Motivation
Back SMYC Forward
  • Information the Host Needs:
    • Its IP address
    • The IP addresses of local caching DNS name servers
  • Two Ways to Provide this Information:
    • Static (e.g., in a configuration file)
    • At startup (e.g., using DHCP -- RFC2131, BOOTP RFC951, NIP)
The Underlying Transport Layer Protocol
Back SMYC Forward
  • Client to Server:
    • UDP on port 67
  • Server to Client:
    • UDP on port 68
Bootstrap Process
Back SMYC Forward
  1. Client broadcasts a DHCP discovery message
  2. One or more servers send (usually broadacsts though there can be exceptions) a DHCP offer message
  3. The client accepts one of the offers and broadcasts a DHCP request message
  4. The server that sent the accepted offer sends (usually broacasts though there can be exceptions) a DHCP acknowledgement; the other servers mark the IPs as available (thereby withdrawing the offers)
Orderly Shutdown Process
Back SMYC Forward
  1. The client sends a DHCP release message to the server
  2. The server returns the IP to the pools
Leases
Back SMYC Forward
  • Rationale:
    • Since a client might "crash", the server needs to be able to reclaim IP addresses
  • Tradeoff:
    • Short leases allow IP addresses to be reclaimed quickly
    • Long leases avoid the overhead of frequent renewals
Important Parts of the Acknowledgement Message
Back SMYC Forward
  1. Subnet mask
  2. IP of the default gateway/router
  3. IP lease time
  4. IP of the DHCP server
  5. IP of DNS servers
Message Format
Back SMYC Forward
  • Op Code/Message Type (1 octet)
  • Hardware/physical address type (1 octet)
  • Hardware/physical address length (1 octet)
  • Hops (1 octet)
    • Client sets to 0; optionally used by relay agents
  • Transaction ID (4 octets)
    • Chosen randomly by the client
  • Seconds elapsed (2 octets)
  • Flags (2 octets)
  • Client IP Address (4 octets)
    • Used when in the BOUND, RENEW, or REBINDING states
  • "Your" IP Address (4 octets)
    • The IP address being given to the client
  • Server's IP Address (4 octets)
    • In an offer message
  • Relay agent's IP address (4 octets)
    • If a relay agent is being used
  • Client's hardware/physical Address (16 octets)
  • Server host name (64 octets)
    • Optional; terminated by a null character
  • Boot file name (128 octets)
    • Terminated by a null character; generic/null for discovery, path name for offers
  • Options (variable)
Allocating IP Addresses
Back SMYC Forward
  • Using a Table:
    • The DHCP server uses a configuration file to associate IP addresses with MAC addresses
  • Using a Pool:
    • Server assigns addresses "on demand" (hence can use them more efficiently)
Things to Know
Back SMYC Forward
  • Clients:
    • Can request their last-known IP address
    • Typically requests a "new" IP address when the lease is half complete
  • Servers:
    • As hinted at above, can relay the request to another agent
  • Security:
    • DHCP does not include an authentication mechanism (though RFC 3118 does)
  • Layer:
    • DHCP is an application layer protocol since it uses UDP
Tradeoffs: Some Real-World Data
Back SMYC Forward

Number of Active Leases at Different Times of Day (over Four Days) at Georgia Tech (for Four Different Lease Times)

dhcp_address-space-utilization Source: Khadilkar et. al (2007)
Dynamically Adjusting Lease Times
Back SMYC Forward
  • Single Adaptation:
    • Set a long initial lease time (e.g., 90 minutes to correspond to the length of a course) and reduce the time for subsequent requests (e.g., to 30 minutes)
    • At Georgia Tech, compared to fixed 90 minute leases, this resulted in 5% more addresses being used but reduced expirations by 11% and renewals by 29%
  • Exponential Adaptation:
    • Issue short leases to initial requests and double the time for each renewal
    • At Georgia Tech, compared to fixed 90 minute leases, did not increase peak address usage and reduced expirations by 37% and renewals by 78%
There's Always More to Learn
Back -