Dynamic Host Configuration Protocol (DHCP) : Relates To Lab 7
Dynamic Host Configuration Protocol (DHCP) : Relates To Lab 7
(DHCP)
Relates to Lab 7.
Module about dynamic assignment of IP addresses with DHCP.
IP address
(32 bit)
ARP
RARP
Ethernet MAC
address
(48 bit)
BOOTP
BOOTstrap Protocol (BOOTP)
From 1985
Host can configure its IP parameters at boot time.
3 services.
IP address assignment.
Detection of 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
DHCP
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
BOOTP Interaction
(a)
Argon
00:a0:24:71:e4:44
BOOTP Server
BOOTP Request
00:a0:24:71:e4:44
Sent to 255.255.255.255
(c)
Argon
128.143.137.144
00:a0:24:71:e4:44
DHCP Server
TFTP
filename
128.143.137.100
Argon
128.143.137.144
00:a0:24:71:e4:44
(b)
DHCP Server
BOOTP Response:
IP address: 128.143.137.144
Server IP address: 128.143.137.100
Boot file name:filename
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
Hardware Type
Number of Seconds
Hardware Address
Hop Count
Length
Unused (in BOOTP)
Flags (in DHCP)
Transaction ID
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
(Thereare>100differentoptions)
Message Fields
Contd.
Transaction ID: A random number used to match this boot request with the response it
generates.
Seconds: Set by the client. It is the elapsed time in seconds since the client started its boot
process.
Flags field: The most significant bit of the flags field is used as a broadcast flag. All other bits
must be set to zero, and are reserved for future use. Normally, DHCP servers attempt to
deliver DHCP messages directly to a client using unicast delivery. The destination address in
the IP header is set to the DHCP your IP address and the MAC address is set to the DHCP
client hardware address. If a host is unable to receive a unicast IP datagram until it knows its
IP address, then this broadcast bit must be set (=1) to indicate to the server that the DHCP
reply must be sent as an IP and MAC broadcast. Otherwise this bit must be set to zero.
10
Contd.
Client IP address: Set by the client. Either its known IP address, or 0.0.0.0.
Your IP address: Set by the server if the client IP address field was0.0.0.0.
Server IP address: Set by the server.
Router IP address: This is the address of a BOOTP relay agent, not a
general IP router to be used by the client. It is set by the forwarding agent
when BOOTP forwarding is being used
Client hardware address: Set by the client. DHCP defines a client identifier
option that is used for client identification. If this option is not used the client
is identified by its MAC address.
11
Contd.
12
Value
Message Type
DHCPDISCOVER
DHCPOFFER
DHCPREQUEST
DHCPDECLINE
DHCPACK
DHCPNAK
DHCPRELEASE
DHCPINFORM
13
Message Types
14
Contd.
15
DHCP Operation
DHCP Client
00:a0:24:71:e4:44
DCHP DISCOVER
DHCP Server
DHCPDISCOVER
Sent to 255.255.255.255
DHCP Server
DHCP Client
00:a0:24:71:e4:44
DCHP OFFER
DHCPOFFER
DHCP Server
DHCPOFFER
DHCP Server
16
DHCP Operation
DHCP Client
00:a0:24:71:e4:44
DHCP Server
DHCPREQUEST
DCHP DISCOVER
DHCPACK
DHCP Server
DHCP Client
00:a0:24:71:e4:44
DHCP Server
DHCPREQUEST
Renewing a Lease
(sent when 50% of lease has expired)
If DHCP server sends DHCPNACK, then address is released.
DHCPACK
DHCP Server
17
DHCP Operation
DHCP Client
00:a0:24:71:e4:44
DHCP Server
DHCPRELEASE
DCHP RELEASE
DHCP Server
18
19
Contd.
The client receives one or more DHCPOFFER messages from one or
more servers.
The client chooses one based on the configuration parameters offered
and broadcasts a DHCPREQUEST message that includes the server
identifier option to indicate which message it has selected and the
requested IP address option, taken from your IP address in the
selected offer.
In the event that no offers are received, if the client has knowledge of a
previous network address, the client may reuse that address if its lease
is still valid, until the lease expires.
20
Contd.
21
Contd.
The combination of client hardware and assigned network
address constitute a unique identifier for the client's lease and
are used by both the client and server to identify a lease
referred to in any DHCP messages.
The your IP address field in the DHCPACK messages is filled
in with the selected network address.
22
Contd.
The client receives the DHCPACK message with configuration
parameters.
The client performs a final check on the parameters, for example with
ARP for allocated network address, and notes the duration of the lease
and the lease identification cookie specified in the DHCPACK
message. At this point, the client is configured.
If the client detects a problem with the parameters in the DHCPACK
message (the address is already in use on the network, for example),
the client sends a DHCPDECLINE message to the server and restarts
the configuration process.
23
Contd.
The client should wait a minimum of ten seconds before restarting the
configuration process to avoid excessive network traffic in case of looping.
On receipt of a DHCPDECLINE, the server must mark the offered address
as unavailable (and possibly inform the system administrator that there is
a configuration problem).
If the client receives a DHCPNAK message, the client restarts the
configuration process.
24
Contd.
The client may choose to relinquish its lease on a network
address by sending a DHCPRELEASE message to the
server.
The client identifies the lease to be released by including its
network address and its hardware address.
25
Lease Renewal
When a server sends the DHCPACK to a client with IP address and
configuration parameters, it also registers the start of the lease time for
that address.
This lease time is passed to the client as one of the options in the
DHCPACK message, together with two timer values, T1 and T2.
The client is rightfully entitled to use the given address for the duration of
the lease time.
26
Contd.
On applying the receive configuration, the client also starts the timers T1
and T2. At this time, the client is in the BOUND state.
Times T1 and T2 are options configurable by the server but T1 must be
less than T2, and T2 must be less than the lease time.
According to RFC 2132, T1 defaults to (0.5 * lease time) and T2 defaults
to (0.875 * lease time).
27
Contd.
When timer T1 expires, the client will send a DHCPREQUEST (unicast) to the
server that offered the address, asking to extend the lease for the given
configuration. The client is now in the RENEWING state
The server would usually respond with a DHCPACK message indicating the new
lease time, and timers T1 and T2 are reset at the client accordingly.
The server also resets its record of the lease time.
Under normal circumstances, an active client would continually renew its lease in
this way indefinitely, without the lease ever expiring.
28
Contd.
If no DHCPACK is received until timer T2 expires, the client
enters the REBINDING state.
Client now broadcasts a DHCPREQUEST message to extend
its lease.
This request can be confirmed by a DHCPACK message from
any DHCP server on the network.
29
Contd.
If the client does not receive a DHCPACK message after its
lease has expired, it has to stop using its current TCP/IP
configuration.
The client may then return to the INIT state, issuing a
DHCPDISCOVER broadcast to try and obtain any valid
address.
30
31
DHCP Pros
32
DHCP Cons
Uses UDP, an unreliable and insecure protocol.
DNS cannot be used for DHCP configured hosts.
33