DHCP
DHCP
PROTOCOL (DHCP)
Dynamic Assignment of IP
addresses
Dynamic assignment of IP addresses is desirable for
several reasons:
• IP addresses are assigned on-demand
• Avoid manual IP configuration
• Support mobility of laptops
2
Solutions for dynamic assignment of IP addresses
3
2. BOOTstrap Protocol (BOOTP)
• From 1985
• Host can configure its IP parameters at boot time.
• Three services.
IP address assignment.
Detectionof the IP address for a serving machine.
The name of a file to be loaded and executed by the client
machine (boot file name)
• Not only assign IP address, but also default router, network mask, etc.
• Sent as UDP messages (UDP Port 67 (server) and 68 (host))
• Use limited broadcast address (255.255.255.255):
• These addresses are never forwarded
4
3. Dynamic Host Configuration Protocol (DHCP)
• From 1993
• An extension of BOOTP, very similar to DHCP
• Same port numbers as BOOTP
• Extensions:
Supports temporary allocation (“leases”) of IP
addresses
DHCP client can acquire all IP configuration
parameters needed to operate
• DHCP is the preferred mechanism for dynamic
assignment of IP addresses
• DHCP can interoperate with BOOTP clients.
5
DHCP Interaction (simplified)
Argon
00:a0:24:71:e4:44 DHCP Server
DHCP Request
00:a0:24:71:e4:44
Sent to 255.255.255.255
Argon
128.143.137.144
00:a0:24:71:e4:44 DHCP Server
DHCP Response:
IP address: 128.143.137.144
Default gateway: 128.143.137.1
Netmask: 255.255.0.0
6
DHCP Message Format
Hardware Address
OpCode Hardware Type Hop Count
Length
Unused (in BOOTP)
Number of Seconds
Flags (in DHCP)
Transaction ID
Client IP address
Your IP address
Server IP address
Gateway IP address
Options
7
(There are >100 different options)
DHCP Message Format Cont.
• OpCode: 1 (Request), 2(Reply)
Note: DHCP message type is sent in an option
1 DHCPDISCOVER
2 DHCPOFFER
3 DHCPREQUEST
4 DHCPDECLINE
5 DHCPACK
6 DHCPNAK
7 DHCPRELEASE
8 DHCPINFORM
9
Other options (selection)
• Other DHCP information that is sent as an option:
10
DHCP Operation(or Phases)
DHCP Client
00:a0:24:71:e4:44 DHCP Server
DHCP Server
DHCP Client
00:a0:24:71:e4:44 DHCPOFFER DHCP Server
DHCP Server
11
DHCP Operation Cont.
DHCP Client
00:a0:24:71:e4:44 DHCP Server
DHCPREQUEST
3. DCHP DISCOVER
DHCPACK
DHCP Client
00:a0:24:71:e4:44 DHCP Server
DHCPREQUEST
Renewing a Lease
DHCPACK
(sent when 50% of lease
has expired)
If DHCP server sends
DHCPNACK, then
DHCP Server
address is released. 12
DHCP Operation Cont.
DHCP Client
00:a0:24:71:e4:44 DHCP Server
4. DCHP RELEASE DHCPRELEASE
DHCP Server
13