Chapter18(DHCP)

advertisement
Chapter 18
Host Configuration :
DHCP
Kyung Hee
University
1
18.1 Introduction
 The information that is held in each computer attached
to a TCP/IP internet
Its IP address
Its subnet mask
The IP address of a router
The IP address of a name server
 The above information is usually stored in a
configuration file and accessed by the computer during
the bootstrap process
 In the case of a diskless computer, the operating
system and networking S/W can be stored in ROM. But
the above information cannot be stored in ROM
Kyung Hee
University
2
Previous Protocol
 RARP ( Reverse Address Resolution Protocol)
Provide the IP address for a booted computer
Map a physical address to an IP address
But deprecated today for two reasons

RARP used the broadcast service of the data link layer
–

RARP can provide only the IP address of the computer
–
Kyung Hee
University
So RARP server must be present in each network
Today, a computer requires IP address, subnet mask, IP
address of router, IP address of name server.
3
Previous Protocol (cont’)
BOOTP ( Bootstrap Protocol)
Prerunner of DHCP
Client/Server protocol designed

BOOTP server can be anywhere in the Internet

BOOTP can provide all pieces of information
But BOOTP is a static configuration protocol
BOOTP can not support dynamic configuration
Kyung Hee
University
4
DHCP
Dynamic Host Configuration Protocol
DHCP is a client/server protocol designed to provide the
four pieces of information for a diskless computer or a
computer that is booted for the first time.

Successor to BOOTP and is backward compatible with it
–
Meaning that a host running the BOOTP client can request a
static configuration to a DHCP server
DHCP provides temporary IP addresses for a limited
period of time
Kyung Hee
University
5
18.2 DHCP Operation
1. A client broadcasts a DHCPDISCOVER message using
destination port 67
2. Servers respond with a DHCPOFFER message including an IP
address




Offering the duration of the lease - default : one hour
The server that sends a DHCPOFFER locks the offered IP
address so that it is not available to any other clients
If the client receives no DHCPOFER message, it will try four
more times, each with a SPAN of two seconds.
If there is no reply to any of these DHCPDISCOVERs, the
client sleeps for five minutes before trying again
3. The client chooses one of the offers and sends a
HCPREQUEST message to the selected sever
Kyung Hee
University
6
DHCP Operation (cont’)
4. The server responds with a DHCPACK message and creates
the binding between the client physical address and its IP
address
5. Before 50 percent of the lease period is reached, the client
sends another DHCPREQUEST and asks for renewal
6. If the server responds with a DHCPACK, the client has a new
lease agreement and can reset its timer. If the server
responds with a DHCPNACK, the client must immediately
stop using the IP address and find another server (step 1)
7. If the sever does not respond, the client sends another
DHCPREQUEST when the lease time reaches 87.5 percent. If
the client terminates the lease prematurely, the client sends a
DHCPRELEASE message to the server.
Kyung Hee
University
7
DHCP Operation (cont’)
Client and server on the same network
1. The DHCP server issues an active open command on
UDP port number 67 and waits for a client
2. A booted client issues an active open command on port
number 68.
3. The server responds with either a broadcast or a
unicast message using UDP source port number 67 and
destination port 68
Kyung Hee
University
8
DHCP Operation (cont’)
 Client and server on the same network
Kyung Hee
University
9
DHCP Operation (cont’)
Client and server on two different networks
DHCP request is broadcast because the client does not
know the IP address of server

Broadcast IP datagram cannot pass through any router
To solve above problem, one of the hosts can be used as
a relay, called relay agent.
Kyung Hee
University

Relay agent knows the unicast address of a DHCP server

Listen for broadcast message on port 67
10
DHCP Operation (cont’)
Client and server on two different networks
Kyung Hee
University
11
DHCP Operation (cont’)
Use of UDP ports
Kyung Hee
University
12
DHCP Operation (cont’)
Error Control
DHCP uses UDP, which does not provide error control
Therefore, DHCP must provide error control.

DHCP requires that UDP uses the checksum.
–

The DHCP client uses timers and a retransmission policy if
it does not receive the DHCP reply to a request.
–
Kyung Hee
University
Using of the checksum in UDP is optional
DHCP forces the client to use a random number to set its
timers
13
DHCP Operation (cont’)
 Packet Format
To make DHCP backward compatible with BOOTP, it is
only added a one-bit flag to the packet.
Extra options have been added to the option field
Flag :

Let client specify a forced broadcast reply from the server
Option :

Kyung Hee
University
several options are added
–
Ex) the value 53 for the tag subfield is used to define the type of
interaction between the client and server
–
MAX : 312 bytes
14
DHCP Operation (cont’)
Packet Format
Kyung Hee
University
15
DHCP Operation (cont’)
Flag format and optional format
Kyung Hee
University
16
DHCP Operation (cont’)
Options for DHCP
Kyung Hee
University
17
18.3 Configuration
 The DHCP has been devised to provide static and dynamic address
allocation
 DHCP has two DBs
One for statically binding between physical address and IP
address
The other one with a pool of available IP addresses


When a DHCP client requests a temporary IP addresses, the DHCP
sever assigns an IP address from a pool for a negotiable period of
time
When a DHCP client sends a request to a DHCP server
–
–
At first, checking its static database
If not , selecting an IP address from the available pool
 Leasing
The DHCP server issues a lease for a specific period of time
When the lease expires, the client must either stop using the IP
address or renew the lease
Kyung Hee
University
18
Configuration (cont’)
Optional with tag 53
Kyung Hee
University
19
Configuration (cont’)
DHCP client transition diagram
Kyung Hee
University
20
Configuration (cont’)
 DHCP client transition diagram
INIT state


First sate of client
The client broadcasts a DHCPDISCOVER message
Selecting state


After sending DHCPDISCOVER message, the client goes to the
selecting state.
Server respond with DHCPOFFER message including IP
address
Requesting state



Kyung Hee
University
After receiving DHCPOFFER message, the client goes to the
requesting state.
The client sends a DHCPREQUEST message to the server
The client remains in the requesting state until it receives a
DHCPACK message from the server
21
Configuration (cont’)
Bound state



After receiving DHCPACK message, the client goes to the
bound state
In this state, the client can use IP address until the lease
expires
When 50 percent of the lease period is reached, the client
sends another DHCPREQUEST to ask for renewal and goes to
renewing state
Renewing state


If the client receive a DHCPACK, it resets its timer and goes
back to the bound state
If a DHCPACK is not received, and 87.5 percent of the lease
time expires, the client goes to the rebinding state
Rebinding state


Kyung Hee
University
If the client receive a DHCPNACK or the lease expires, it goes
back to the initializing state
If the client receives a DHCPACK, it goes to the bound state
and resets the timers
22
Configuration (cont’)
Exchanging message
Kyung Hee
University
23
Summary
 Every computer attached to a TCP/IP internet must know its IP address, the IP
address of a router, the IP address of an name server, and its subnet mask.
Dynamic Host Configuration Protocol (DHCP) is a client-server application that
deliver vital network information to either diskless computers or computers at
first boot
 One DHCP packet format is used for both the client request and the server
reply. The DHCP server waits passively for a client request. A server reply can
be broadcast or unicast. A DHCP request or reply is encapsulated in a UDP
user datagram.
 When the DHCP client and server are on different networks, a relay agent is
used to send local DHCP request from a client to remote servers
 When DHCP acts as static configuration protocol, it uses a table that maps IP
addresses to physical addresses. When DHCP acts as a dynamic
configuration protocol, it leases IP addresses to the requesting clients.
 DHCP client is designed as a state machine that uses six main states and
three timers to allow a host to lease an IP address for a specified period time.
Kyung Hee
University
24
Download