Dynamic Host Configuration Protocol (DHCP)

University of Jordan
Faculty of Engineering & Technology
Computer Engineering Department
Advance Networks Laboratory 0907529
Exp.9 Dynamic Host Configuration Protocol (DHCP)
Describe the operation of DHCP in a small-to-medium-sized business network.
Configure a router as a DHCP server.
Configure a router as a DHCP client.
Troubleshoot a DHCP configuration in a switched network.
1. Introduction
Every device that connects to a network needs a unique IP address. Network administrators
assign static IP addresses to routers, servers, printers, and other network devices whose locations
(physical and logical) are not likely to change. These are usually devices that provide services to
users and devices on the network; therefore, the addresses assigned to them should remain
constant. Additionally, static addresses enable administrators to manage these devices remotely. It
is easier for network administrators to access a device when they can easily determine its IP
However, computers and users in an organization often change locations, physically and
logically. It can be difficult and time consuming for administrators to assign new IP addresses
every time an employee moves. Additionally, for mobile employees working from remote
locations, manually setting the correct network parameters can be challenging. Even for desktop
clients, the manual assignment of IP addresses and other addressing information presents an
administrative burden, especially as the network grows.
Introducing a Dynamic Host Configuration Protocol (DHCP) server to the local network
simplifies IP address assignment to both desktop and mobile devices. Using a centralized DHCP
server enables organizations to administer all dynamic IP address assignments from a single
server. This practice makes IP address management more effective and ensures consistency
across the organization, including branch offices.
2. DHCPv4 Operation
DHCPv4 assigns IPv4 addresses and other network configuration information dynamically.
Because desktop clients typically make up the bulk of network nodes, DHCPv4 is an extremely
useful and timesaving tool for network administrators.
A dedicated DHCPv4 server is scalable and relatively easy to manage. However, in a small
branch or SOHO location, a Cisco router can be configured to provide DHCPv4 services without
the need for a dedicated server. A Cisco IOS feature set (called ”Easy IP)” offers an optional,
full-featured DHCPv4 server.
DHCPv4 includes three different address allocation mechanisms to provide flexibility when
assigning IP addresses:
Prepared By: Eng.Alaa Arabiyat
Page 1 of 9
Manual Allocation - The administrator assigns a pre-allocated IPv4 address to the client,
and DHCPv4 communicates only the IPv4 address to the device.
Automatic Allocation - DHCPv4 automatically assigns a static IPv4 address
permanently to a device, selecting it from a pool of available addresses. There is no lease
and the address is permanently assigned to the device.
Dynamic Allocation - DHCPv4 dynamically assigns, or leases, an IPv4 address from a
pool of addresses for a limited period of time chosen by the server, or until the client no
longer needs the address.
Dynamic allocation is the most commonly used DHCPv4 mechanism, as shown in the figure
below. Administrators configure DHCPv4 servers to set the leases to time out at different
intervals. The lease is typically anywhere from 24 hours to a week or more. When the lease
expires, the client must ask for another address, although the client is typically reassigned the
same address.
Lease Origination
When the client boots (or otherwise wants to join a network), it begins a four step process to
obtain a lease. As shown in the Figure below , a client starts the process with a broadcast
DHCPDISCOVER message with its own MAC address to discover available DHCPv4 servers.
The DHCPDISCOVER message finds DHCPv4 servers on the network. Because the client has no
valid IPv4 information at bootup, it uses Layer 2 and Layer 3 broadcast addresses to
communicate with the server.
When the DHCPv4 server receives a DHCPDISCOVER message, it reserves an available IPv4
address to lease to the client. The server also creates an ARP entry consisting of the MAC address
of the requesting client and the leased IPv4 address of the client. As shown in the Figure below,
the DHCPv4 server sends the binding DHCPOFFER message to the requesting client. The
DHCPOFFER message is sent as a unicast, using the Layer 2 MAC address of the server as the
source address and the Layer 2 MAC address of the client as the destination.
When the client receives the DHCPOFFER from the server, it sends back a DHCPREQUEST
message as shown in the Figure below. This message is used for both lease origination and lease
renewal. When used for lease origination, the DHCPREQUEST serves as a binding acceptance
notice to the selected server for the parameters it has offered and an implicit decline to any other
servers that may have provided the client a binding offer.
Prepared By: Eng.Alaa Arabiyat
Page 2 of 9
DHCP Acknowledgment (DHCPACK)
On receiving the DHCPREQUEST message, the server verifies the lease information with an
ICMP ping to that address to ensure it is not being used already, creates a new ARP entry for the
client lease, and replies with a unicast DHCPACK message as shown in the Figure below.
Lease Renewal
As shown in the Figure below, when the lease has expired, the client sends a DHCPREQUEST
message directly to the DHCPv4 server that originally offered the IPv4 address. If a DHCPACK
is not received within a specified amount of time, the client broadcasts another DHCPREQUEST
so that one of the other DHCPv4 servers can extend the lease.
DHCP Acknowledgment (DHCPACK)
On receiving the DHCPREQUEST message, the server verifies the lease information by returning
a DHCPACK, as shown below.
Prepared By: Eng.Alaa Arabiyat
Page 3 of 9
3. Configuring a Basic DHCPv4 Server
A Cisco router running Cisco IOS software can be configured to act as a DHCPv4 server. The
Cisco IOS DHCPv4 server assigns and manages IPv4 addresses from specified address pools
within the router to DHCPv4 clients. The topology shown below is used to illustrate this
Step 1. Excluding IPv4 Addresses
The router functioning as the DHCPv4 server assigns all IPv4 addresses in a DHCPv4 address
pool unless configured to exclude specific addresses. Typically, some IPv4 addresses in a pool
are assigned to network devices that require static address assignments. Therefore, these IPv4
addresses should not be assigned to other devices. To exclude specific addresses, use the ip dhcp
excluded-address command.
A single address or a range of addresses can be excluded by specifying the low-address and highaddress of the range. Excluded addresses should include the addresses assigned to routers,
servers, printers, and other devices that have been manually configured.
Step 2. Configuring a DHCPv4 Pool
Configuring a DHCPv4 server involves defining a pool of addresses to assign. The ip dhcp pool
pool-name command creates a pool with the specified name and puts the router in DHCPv4
configuration mode, which is identified by this prompt Router(dhcp-config)#.
Step 3. Configuring Specific Tasks
The figure below lists the tasks to complete the DHCPv4 pool configuration. Some of these are
optional, while others must be configured. The address pool and default gateway router must be
configured. Use the network statement to define the range of available addresses.
Use the default-router command to define the default gateway router. Typically, the gateway is
the LAN interface of the router closest to the client devices. One gateway is required, but you can
list up to eight addresses if there are multiple gateways.
Prepared By: Eng.Alaa Arabiyat
Page 4 of 9
Other DHCPv4 pool commands are optional. For example, the IPv4 address of the DNS server
that is available to a DHCPv4 client is configured using the dns-server command. The domainname domain command is used to define the domain name. The duration of the DHCPv4 lease
can be changed using the lease command. The default lease value is one day.
Disabling DHCPv4
The DHCPv4 service is enabled, by default, on versions of Cisco IOS software that support it. To
disable the service, use the no service dhcp global configuration mode command. Use the
service dhcp global configuration mode command to re-enable the DHCPv4 server process.
Enabling the service has no effect if the parameters are not configured.
The operation of DHCPv4 can be verified using the show ip dhcp binding command.
This command displays a list of all IPv4 address to MAC address bindings that have been
provided by the DHCPv4 service. The second command, show ip dhcp server statistics,
is used to verify that messages are being received or sent by the router. This command
displays count information regarding the number of DHCPv4 messages that have been
sent and received. As seen in the figure below in the output for these commands,
currently there are no bindings and the statistics indicate no messages sent or received. At
this point no devices have requested DHCPv4 services from router R1.
Prepared By: Eng.Alaa Arabiyat
Page 5 of 9
The commands are issued after PC1 and PC2 have been powered on and have completed
the booting process. Notice that the binding information now displays that the IPv4
addresses of and have been bound to MAC addresses. The
statistics are also displaying DHCPDISCOVER, DHCPREQUEST, DHCPOFFER, and
DHCPACK activity.
The ipconfig /all command shown below, when issued on PC1, displays the TCP/IP
parameters. Because PC1 was connected to the network segment, it
automatically received a DNS suffix, IPv4 address, subnet mask, default gateway, and
DNS server address from that pool. No router interface configuration is required. If a PC
is connected to a network segment that has a DHCPv4 pool available, the PC can obtain
an IPv4 address from the appropriate pool automatically.
Prepared By: Eng.Alaa Arabiyat
Page 6 of 9
What is DHCP Relay?
In a complex hierarchical network, enterprise servers are usually located in a server farm. These
servers may provide DHCP, DNS, TFTP, and FTP services for the network. Network clients are
not typically on the same subnet as those servers. In order to locate the servers and receive
services, clients often use broadcast messages.
In the figure below, PC1 is attempting to acquire an IPv4 address from a DHCP server using a
broadcast message. In this scenario, router R1 is not configured as a DHCPv4 server and does not
forward the broadcast. Because the DHCPv4 server is located on a different network, PC1 cannot
receive an IP address using DHCP.
In the figure below, PC1 is attempting to renew its IPv4 address. To do so, the ipconfig /release
command is issued. Notice that the IPv4 address is released and the address is shown to be Next, the ipconfig /renew command is issued. This command causes PC1 to broadcast a
DHCPDISCOVER message. The output shows that PC1 is unable to locate the DHCPv4 server.
Because routers do not forward broadcasts, the request is not successful.
Prepared By: Eng.Alaa Arabiyat
Page 7 of 9
As a solution to this problem, an administrator can add DHCPv4 servers on all the subnets.
However, running these services on several computers creates additional cost and administrative
A better solution is to configure a Cisco IOS helper address. This solution enables a router to
forward DHCPv4 broadcasts to the DHCPv4 server. When a router forwards address
assignment/parameter requests, it is acting as a DHCPv4 relay agent. In the example topology,
PC1 would broadcast a request to locate a DHCPv4 server. If R1 was configured as a DHCPv4
relay agent, it would forward the request to the DHCPv4 server located on subnet
As shown below, the interface on R1 receiving the broadcast is configured with the ip helperaddress interface configuration mode command. The address of the DHCPv4 server is
configured as the only parameter.
When R1 has been configured as a DHCPv4 relay agent, it accepts broadcast requests for the
DHCPv4 service and then forwards those requests as a unicast to the IPv4 address
The show ip interface command is used to verify the configuration.
As shown below, PC1 is now able to acquire an IPv4 address from the DHCPv4 server.
Prepared By: Eng.Alaa Arabiyat
Page 8 of 9
4. Configure DHCPv4 Client
Sometimes, Cisco routers in small office/home office (SOHO) and branch sites have to be
configured as DHCPv4 clients in a similar manner to client computers. The method used depends
on the ISP. However, in its simplest configuration, the Ethernet interface is used to connect to a
cable or DSL modem. To configure an Ethernet interface as a DHCP client, use the ip address
dhcp interface configuration mode command.
In the figure below, assume that an ISP has been configured to provide select customers with IP
addresses from the network range. After the G0/1 interface is configured with
the ip address dhcp command, the show ip interface g0/1 command confirms that the interface
is up and that the address was allocated by a DHCPv4 server.
You can find the lab problem sheet and the packet tracer activities on the lab website.
CCNA Routing and Switching - Cisco Networking Academy.
Prepared By: Eng.Alaa Arabiyat
Page 9 of 9
Download PDF
Similar pages