0% found this document useful (0 votes)
1 views

lecture 8

The document provides an overview of the Dynamic Host Configuration Protocol (DHCP), explaining its role in automatically assigning IP addresses to devices in a network. It details the DHCP message format, operation, and state transitions, emphasizing how DHCP facilitates both permanent and temporary IP address assignments. Additionally, it introduces Network Address Translation (NAT) as a solution for managing address allocation in networks with limited public IP addresses.

Uploaded by

hmzhqsab2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

lecture 8

The document provides an overview of the Dynamic Host Configuration Protocol (DHCP), explaining its role in automatically assigning IP addresses to devices in a network. It details the DHCP message format, operation, and state transitions, emphasizing how DHCP facilitates both permanent and temporary IP address assignments. Additionally, it introduces Network Address Translation (NAT) as a solution for managing address allocation in networks with limited public IP addresses.

Uploaded by

hmzhqsab2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

Lecture 8

DYNAMIC HOST
CONFIGURATION
PROTOCOL(DHCP)
Third Year
Second Semester
IT Department
Prepared by:
Eng. Mohammed H. Al-Marhabi

1
 Introduction

■ We have seen that a large organization or an ISP can receive a


block of addresses directly from ICANN and a small organization
can receive a block of addresses from an ISP.
■ After a block of addresses are assigned to an organization, the
network administration can manually assign addresses to the
individual hosts or routers.
■ However, address assignment in an organization can be done
automatically using the Dynamic Host Configuration
Protocol (DHCP).
■ DHCP is an application-layer program, using the client-server
model, that actually helps TCP/IP at the network layer.
2
 Introduction(cont.)

■ DHCP has found such widespread use in the Internet that it


is often called a plug-and-play protocol.
■ DHCP can be used in many situations.
– A network manager can configure DHCP to assign
permanent IP addresses to the host and routers.
– DHCP can also be configured to provide temporary, on
demand, IP addresses to hosts. The second capability can
provide a temporary IP address to a traveler to connect
her laptop to the Internet while she is staying in the
hotel.

3
 Introduction(cont.)

■ It also allows an ISP with 1000 granted addresses to provide


services to 4000 households, assuming not more than one-forth
of customers use the Internet at the same time. In addition to
its IP address, a computer also needs to know the network
prefix (or address mask).
■ Most computers also need two other pieces of information, such
as the address of a default router to be able to communicate
with other networks and the address of a name server to be
able to use names instead of addresses (DNS).
■ In other words, four pieces of information are normally needed:
the computer address, the prefix, the address of a router, and
the (DNS) address
4
 DHCP Message Format

■ DHCP is a client-server protocol in which the client sends a


request message and the server returns a response
message.
■ Before we discuss the operation of DHCP, let us show the
general format of the DHCP message in Figure (next slide).
■ Most of the fields are explained in the figure, but we need
to discuss the option field, which plays a very important
role in DHCP.

5
 DHCP Message Format

6
 Option Format

■ The 64-byte option field has a dual purpose.


■ It can carry either additional information or some specific vendor information.
■ The server uses a number, called a magic cookie, in the format of an IP
address with the value of 99.130.83.99.
■ When the client finishes reading the message, it looks for this magic cookie.
If present, the next 60 bytes are options.
■ An option is composed of three fields: a 1-byte tag field, a 1-byte length field,
and a variable-length value field.
■ There are several tag fields that are mostly used by vendors. If the tag field is
53, the value field defines one of the 8 message types shown in Figure (next
slide). We show how these message types are used by DHCP.

7
 Option Format

8
Operation of DHCP

9
10
 Operation of DHCP (1)

■ The joining host creates a DHCPDISCOVER message in which only


the transaction- ID field is set to a random number. No other field
can be set because the host has no knowledge with which to do
so. This message is encapsulated in a UDP user datagram with the
source port set to 68 and the destination port set to 67. We will
discuss the reason for using two well-known port numbers later.
The user datagram is encapsulated in an IP datagram with the
source address set to 0.0.0.0 (“this host”) and the destination
address set to 255.255.255.255 (broadcast address).
■ The reason is that the joining host knows neither its own address
nor the server address.

11
 Operation of DHCP (2)

■ The DHCP server or servers (if more than one) responds with a
DHCPOFFER message in which the your address field defines the
offered IP address for the joining host and the server address field
includes the IP address of the server. The message also includes
the lease time for which the host can keep the IP address.
■ This message is encapsulated in a user datagram with the same
port numbers, but in the reverse order. The user datagram in turn
is encapsulated in a datagram with the server address as the
source IP address, but the destination address is a broadcast
address, in which the server allows other DHCP servers to receive
the offer and give a better offer if they can.

12
 Operation of DHCP (3)

■ The joining host receives one or more offers and selects the
best of them. The joining host then sends a DHCPREQUEST
message to the server that has given the best offer. The fields
with known value are set.
■ The message is encapsulated in a user datagram with port
numbers as the first message.
■ The user datagram is encapsulated in an IP datagram with the
source address set to the new client address, but the
destination address still is set to the broadcast address to let
the other servers know that their offer was not accepted.

13
 Operation of DHCP (4)

■ Finally, the selected server responds with a DHCPACK message


to the client if the offered IP address is valid. If the server
cannot keep its offer (for example, if the address is offered to
another host in between), the server sends a DHCPNACK
message and the client needs to repeat the process.
■ This message is also broadcast to let other servers know that
the request is accepted or rejected.

14
 Transition States

■ The previous scenarios we discussed for the operation of the


DHCP were very simple.
■ To provide dynamic address allocation, the DHCP client acts as
a state machine that performs transitions from one state to
another depending on the messages it receives or sends.
■ Figure (next slide) shows the transition diagram with the main
states.

15
 Transition States(cont.)

16
 Transition States(cont.)
■ When the DHCP client first starts, it is in the INIT
state (initializing state).
■ The client broadcasts a discover message. When it
receives an offer, the client goes to the SELECTING
state. While it is there, it may receive more offers.
■ After it selects an offer, it sends a request message
and goes to the REQUESTING state.
■ If an ACK arrives while the client is in this state, it
goes to the BOUND state and uses the IP address.

17
 Transition States(cont.)

■ When the lease is 50 percent expired, the client tries to renew it


by moving to the RENEWING state. If the server renews the lease,
the client moves to the BOUND state again. If the lease is not
renewed and the lease time is 75 percent expired, the client
moves to the REBINDING state. If the server agrees with the lease
(ACK message arrives), the client moves to the BOUND state and
continues using the IP address; otherwise, the client moves to the
INIT state and requests another IP address.
■ Note that the client can use the IP address only when it is in the
BOUND, RENEWING, or REBINDING state. The above procedure
requires that the client uses three timers: renewal timer (set to 50
percent of the lease time), rebinding timer (set to 75 percent of
the lease time), and expiration timer (set to the lease time).
18
Network Address
Resolution (NAT)

19
 Network Address
Resolution (NAT)
■ The distribution of addresses through ISPs has created a new
problem. Assume that an ISP has granted a small range of
addresses to a small business or a household.
■ If the business grows or the household needs a larger range, the
ISP may not be able to grant the demand because the addresses
before and after the range may have already been allocated to
other networks.
■ In most situations, however, only a portion of computers in a
small network need access to the Internet simultaneously. This
means that the number of allocated addresses does not have to
match the number of computers in the network.

20
 Network Address
Resolution (NAT)
■ For example, assume that in a small business with 20
computers the maximum number of computers that access the
Internet simultaneously is only 4.
■ Most of the computers are either doing some task that does not
need Internet access or communicating with each other.
■ This small business can use the TCP/IP protocol for both internal
and universal communication.
■ The business can use 20 (or 25) addresses from the private
block addresses (discussed before) for internal communication;
five addresses for universal communication can be assigned by
the ISP.

21
 Network Address
Resolution (NAT)
■ A technology that can provide the mapping between the private
and universal addresses, and at the same time support virtual
private networks is Network Address Translation (NAT).
■ The technology allows a site to use a set of private addresses for
internal communication and a set of global Internet addresses
(at least one) for communication with the rest of the world.
■ The site must have only one connection to the global Internet
through a NAT-capable router that runs NAT software. Figure
(next slide) shows a simple implementation of NAT.

22
 Network Address
Resolution (NAT)

23

You might also like