Teleinformática y Comunicaciones
Dynamic Host Configuration Protocol
Muna Sikder
Computer Science and Engineering,
University of Dhaka.
‘Dynamic Host Configuration Protocol’ is a means for
networked devices to get their TCP/IP networking
settings from a central server.
DHCP assigns IP addresses and other configuration
parameters automatically.
2
Dynamic assignment of IP addresses is desirable for several
reasons:
◦ IP addresses are assigned on-demand
◦ Avoid manual IP configuration
◦ Support mobility of laptops
Three Protocols:
◦ RARP (until 1985, no longer used)
◦ BOOTP (1985-1993)
◦ DHCP (since 1993)
Only DHCP is widely used today.
3
Configuration parameters for network hosts
IP address
Router’s IP address
Subnet Mask
IP address of a DNS server
Those information is dependent on the individual configuration
of the network.
What about a diskless workstation or a computer with a disk
that is booted for the first time?
4
Before DHCP
RARP
BOOTP
Problems of RARP
◦ Provides only the IP address
◦ RARP client and server must be on the same network because
of it is a data link layer service.
Problems of BOOTP
◦ Is a static configuration protocol
5
➢ DHCP supports three models:
• Dynamic allocation
• Automatic or Reserved allocation
• Static allocation
➢ DHCP is backward compatible with BOOTP.
➢ Is a application layer protocol.
Port for both protocol:
• client : UDP, 68
• Server : UDP,67
6
DHCP Server
DHCP Clients DHCP Clients
DHCP Server
DHCP protocol is a mainly 4-step process:
Hello Mr. Server, I need to
connect
UDP Portto the Internet,
UDP Port UDP Port
DHCP server discover
UDP Port
could
68 you be kind 68 to hook 68 67
Ok dude, I got some in Broadcast
me up with an IP address?
my pool of address, I
lend you it. Check it out? DHCP server offer
Your IP : [Link]
Thank you Mr. Server, I Router
like your offer. I will use DHCP request
it.
Unicast
You’re welcome, here is
your configuration but DHCP acknowledge
it’s only for 3 days.
Internet
7
DHCP Message Use
DHCPDISCOVER Client broadcast to locate available servers
DHCPOFFER Server to client response offering configuration parameters
DHCPREQUEST Client broadcast requesting offered parameters
DHCPDECLINE Client to server notification that IP address is in use
DHCPACK Server to client response confirming a request
DHCPNAK Server to client response denying a request
DHCPRELEASE Client to server request to relinquish IP address
DHCPINFORM Client to server request for configuration parameters
8
Boot
Initializing
DHCPDISCOVER
DHCPOFFER
Selecting
DHCPREQUEST
Requesting
DHCPACK
DHCPRELEASE
Lease time 50% expired Bound
DHCPREQUEST Lease time expired
DHCPNACK
DHCPACK
DHCPACK
Renewing Rebinding
Lease time 87.5% expired
DHCPREQUEST
9
Boot
Initializing
10
[Link]
DHCP Client DHCP Server
open
67
UDP
68
Source IP : [Link]
UDP Source MAC : EA.0D.45.B4 DHCPDISCOVER
Destination IP : [Link]
11
Boot
Initializing
DHCPDISCOVER
Selecting
12
[Link]
DHCP Client DHCP Server
67
UDP
68
Source IP : [Link]
UDP Source MAC : EA.0D.45.B4 DHCPDISCOVER
Destination IP : [Link]
Source IP : [Link]
Destination IP : [Link]
DHCPOFFER Des MAC : EA.0D.45.B4
Client IP : [Link]
13
Boot
Initializing
DHCPDISCOVER
DHCPOFFER
Selecting
14
[Link]
DHCP Client DHCP Server
67
UDP
68
Source IP : [Link]
UDP Source MAC : EA.0D.45.B4 DHCPDISCOVER
Destination IP : [Link]
Source IP : [Link]
Destination IP : [Link]
DHCPOFFER Des MAC : EA.0D.45.B4
Client IP : [Link]
Accept ,request to bind
client physical address and DHCPREQUEST
its offered IP
15
Boot
Initializing
DHCPDISCOVER
DHCPOFFER
Selecting
DHCPREQUEST
Requesting
16
[Link]
DHCP Server
DHCP Client
67
UDP
68 DHCPDISCOVER
UDP
DHCPOFEER
DHCREQUEST
After receiving the ACK,
DHCACK client use offered IP.
17
Boot
Initializing
DHCPDISCOVER
DHCPOFFER
Selecting
DHCPREQUEST
Requesting
DHCPACK
Bound
18
[Link]
DHCP Client DHCP Server
67
68 UDP
DHCPDISCOVER
UDP
DHCPOFEER
DHCREQUEST
After receiving the ACK,
DHCACK client use offered IP.
After 50% of lease time
expires DHCPREQUEST
If the server does not
respond, the request is DHCPREQUEST
repeated.
If server responds with a NACK client
must start all over again.i
19
Boot
Initializing
DHCPDISCOVER
DHCPOFFER
Selecting
DHCPREQUEST
Requesting
DHCPACK
DHCPRELEASE
Lease time 50% expired Bound
DHCPREQUEST
Renewing
20
[Link]
DHCP Server
DHCP Client
67
UDP
68 DHCPDISCOVER
UDP
DHCPOFEER
DHCREQUEST
DHCPACK
DHCREQUEST
DHCPACK
21
Boot
Initializing
DHCPDISCOVER
DHCPOFFER
Selecting
DHCPREQUEST
Requesting
DHCPACK Lease cancelled/
DHCPRELEASE
Lease time 50% expired Bound
DHCPREQUEST
DHCPACK
Renewing
22
[Link]
DHCP Server
DHCP Client 67
UDP
DHCPDISCOVER
DHCPOFEER
68
UDP DHCREQUEST
DHCPACK
DHCREQUEST
DHCPACK
Before 87.5% of lease
time expires DHCPREQUEST
23
Boot
Initializing
DHCPDISCOVER
DHCPOFFER
Selecting
DHCPREQUEST
Requesting
DHCPACK
DHCPRELEASE
Lease time 50% expired Bound
DHCPREQUEST
DHCPACK
Renewing Rebinding
Lease time 87.5% expired
DHCPREQUEST
24
[Link]
DHCP Client DHCP Server
DHCPDISCOVER 67
68 UDP
DHCPOFEER
UDP
DHCREQUEST
DHCPACK
DHCREQUEST
DHCPACK
Before 87.5% of lease
time expires DHCPREQUEST
DHCACK/ DHCPNACK
25
Boot
Initializing
DHCPDISCOVER
DHCPOFFER
Selecting
DHCPREQUEST
Requesting
DHCPACK
DHCPRELEASE
Lease time 50% expired Bound
DHCPREQUEST Lease time expired/
DHCPNACK
DHCPACK
DHCPACK
Renewing Rebinding
Lease time 87.5% expired
DHCPREQUEST
26
[Link]
DHCP Client
DHCP Server
DHCPDISCOVER
67
UDP
68 DHCPOFEER
UDP
DHCREQUEST
DHCPACK
After 50% time expires
DHCREQUEST
DHCPACK
DHCREQUEST After 87.50% time expires
DHCACK/ DHCPNACK
DHCPRELEASE
27
Boot
Initializing
DHCPDISCOVER
DHCPOFFER
Selecting
DHCPREQUEST
Requesting
DHCPACK
DHCPRELEASE
Lease time 50% expired Bound
DHCPREQUEST Lease time expired/
DHCPNACK
DHCPACK
DHCPACK
Renewing Rebinding
Lease time 87.5% expired
DHCPREQUEST
28
Relay agent
[Link]
New DHCP Client
68 UDP UDP 67
Broadcast
Source : [Link] Broadcast
Destination : [Link]
DHCPDISCOVER Source123.45.67.8 Router
Destination : [Link]
Client IP : [Link]
DHCPOFFER
Router Internet
Unicast Unicast
Source : [Link]
Source : [Link] Destination : [Link]
Destination : [Link]
[Link] Client IP: [Link]
DHCPOFFER
DHCP Server
29
DHCP Clients
To overcome thisBoth packets are same. How
does server distinguish which
problem, client uses
packet come from which
Transaction ID. client?
UDP Port Source: :[Link]
[Link]
Source
68 Broadcast DHCP Server
Destination : :[Link]
Destination [Link]
BroadcastID : E1CA52AD
Transaction DHCPOFFER [Link]
Broadcast
DHCPOFFER
Broadcast BroadcastSource : [Link]
DHCPDISCOVER
DHCPDISCOVER
Source : [Link] DHCPOFFERDestination : [Link]
Destination : [Link] Client IP : [Link]
Broadcast
Source : [Link]
Transaction ID : E1CA52AD
Client IP : [Link]
UDP Port DHCPOFFER
Destination : [Link]
68 Client IP : [Link]
Source : [Link]
Destination : [Link]
UDP Port 67
Broadcast
Broadcast Client IP : [Link]
DHCPDISCOVER Transaction ID : A3C5A2CB
DHCPDISCOVER
Source : [Link]
Source : [Link]
Destination : [Link]
UDP Port Destination : [Link]
68 Transaction ID : A3C5A2CB
For this problem server can offer
same IP for both.
30
New DHCP
client DHCP Server
Relay agent DHCP Clients [Link]
[Link]
Client receives 67 UDP UDP Port
? offer and
this DHCPOFFER67
sends DHCPDISCOVER
Discard
DHCPREQUEST
packet.
Router
Internet
UDP Port
DHCPDISCOVER 67
DHCPOFFER
[Link]
DHCP Server 31
32 Bits
Operation Code Hardware Type Hardware Length Hop Count
Transaction ID
Seconds Elapsed F Must Be Zero (MBZ)
Client IP address
Your IP address
Server IP address
Gateway IP address
Client hardware address
(16 bytes)
Server host name
(64 bytes)
Boot file name
(128 bytes)
Options
(up to 312 bytes)
32
Option code – defines the type of packet : request(1) or reply(2)
Transaction ID - a random number that is used by the client to match
incoming DHCP messages with pending requests.
Gateway IP address – contains the IP address of the router filled by
the server in reply message.
Client IP address - used when client knows its IP address.
Your IP address - the DHCP server will place the offered client IP
address in this field, if the client IP address is [Link].
Server IP address - the DHCP server address, if it is known. Otherwise,
it is used in DHCPOFFER and DHCPACK.
Boot filename – contains a string consisting of the full pathname of the
boot file. Client can use this path to retrieve other booting information.
Options – it can carry either additional information or some specific
vendor information.
33
DHCP is a dynamic configure protocol with two database : one
is similar to BOOTP and other is a pool of IP address available
for temporary assignment. DHCP server issues a lease for an IP
address to a client for a specific period of time. DHCP packet
format is similar to that of BOOTP. DHCP should not require a
server on each sub-net. Relay agent that is compatible with
BOOTP can be used.
NIP (Network Information Protocol) has the mechanism of
dynamic allocation. When the NIP client requests an IP address,
NIP server returns a set of IP address that is available in the
network. NIP client selects one IP address from the network,
and checks its availability with ARP.
34
DHCP Clients DHCP Server
UDP Port UDP Port UDP Port
68 68 68 UDP Port
67
Router
Internet
35