Achievable logoAchievable logo
CCNA
Sign in
Sign up
Purchase
Textbook
Practice exams
Support
How it works
Exam catalog
Mountain with a flag at the peak
Textbook
Introduction
1. Introduction to networking
2. Administering Ethernet LANs
3. IP connectivity
4. Network services
4.1 Access Control Lists (ACLs)
4.2 Network Address Translation (NAT)
4.3 Dynamic Host Configuration Protocol (DHCP)
4.4 Domain Name Service (DNS)
4.5 Quality of Service (QoS)
4.6 Network Time Protocol (NTP)
5. IPv6
6. Wireless networking
7. Network management and administering network devices
8. Network security fundamentals
9. Network automation and programmability
Wrapping up
Achievable logoAchievable logo
4.3 Dynamic Host Configuration Protocol (DHCP)
Achievable CCNA
4. Network services
Our CCNA course is currently in development and is a work-in-progress.

Dynamic Host Configuration Protocol (DHCP)

8 min read
Font
Discuss
Share
Feedback

This chapter covers one of the most common ways to assign IP addresses to hosts on a network.

In the early days of networking, there weren’t many hosts on a network. That made it practical to manually configure an IP address on each host’s NIC (network interface card) in its operating system. You could enter the IP address, Subnet Mask, and Default Gateway directly in Windows (or whatever OS the host was running).

Manually assigning an IP address, Subnet Mask, and Default Gateway on a host is called assigning a Static IP address.

It’s called “Static” because the address stays the same (it survives a reboot) until you change it or remove it.

This is the same idea as configuring an IP address and Subnet Mask on a router interface: you’re assigning a “Static” IP address to that interface.

You would do this one host at a time. That worked when there were only a few devices, but modern networks often have hundreds (or thousands) of hosts. At that scale, manually assigning and maintaining IP addresses becomes impractical.

A more scalable approach is to assign IP addresses dynamically. The protocol that supports this is the Dynamic Host Configuration Protocol (DHCP).

With DHCP:

  • Hosts that need an IP address, Subnet Mask, and Default Gateway are called DHCP Clients.
  • DHCP Clients request that information from a DHCP Server.
  • A DHCP Server is a server running a DHCP application. It has one or more pools of IP addresses (typically one pool per subnet), with the Subnet Mask and Default Gateway pre-configured for each pool.

When a DHCP Client requests addressing information, the DHCP Server leases an available IP address (plus the Subnet Mask and Default Gateway) to the client for a specific period of time.

When the lease expires, the client can negotiate again with the server. Depending on the situation, it may receive the same IP address again or a new one.

Before an IP address is assigned:

  • The DHCP Server checks to make sure it isn’t leasing a duplicate address.
  • The client also checks before it commits to using the offered address.

Because the DHCP Server keeps assignment information in its database, you get a centralized, dynamic way to track addressing. The main manual work is:

  • Pre-configuring the DHCP pools on the server
  • Ensuring client NICs are set to obtain an IP address automatically (via DHCP)

It’s important to understand the steps a DHCP Client uses to receive an IP address from a DHCP Server. This is the “D.O.R.A.” process:

Discover

Offer

Request

Acknowledgement

Please study the table below:

Client or Server Action Description
Client Discover The Client sends a Broadcast Frame containing a DHCP_DISCOVER message in search of a DHCP Server to receive an IP address, Subnet Mask and Default Gateway
Server Offer The Server receives the DISCOVER message from the Client and looks for an IP address to lease to the Client. If there are IPs available, it will send all the pertinent information back to the Client in a DHCP_OFFER message.
Client Request The Client receives the OFFER and sends an ARP Request on the LAN for the IP address that was offered. If it doesn’t receive a response, then that means no one else is currently using it. The Client will then send a DHCP_REQUEST to the Server, committing to the request of the IP that was offered.
Server Acknowledgement The Server receives the REQUEST from the Client and before it releases the IP address that was requested, it sends out 2 pings to that IP to make sure that no one is currently using it. If it doesn’t receive a reply, then it will finally send a DHCP_ACK message to the Client, letting it know that it is ok to use the IP address.

Two design approaches for DHCP

There are two design approaches to deploying a DHCP Server:

  • Place the DHCP Server in the same network as the clients.
  • Place the DHCP Server in a different network than the clients.

The second approach introduces an important detail we’ll work through.

Deploying a DHCP Server in the same network as the clients

When the DHCP Server is in the same network (or VLAN) as the clients, the process is straightforward.

DHCP Clients begin by sending DHCP_DISCOVER messages as Broadcast Frames. They do this because:

  • They don’t have an IP address yet.
  • You don’t want to hardcode a DHCP Server IP address on every host.
  • You want the host to be able to join different networks without needing prior knowledge of the DHCP Server’s address.

Because the DHCP Server is in the same broadcast domain, those DHCP_DISCOVER Broadcast Frames can reach it at Layer 2, and the D.O.R.A. process can complete.

Image 217

Image Title - DHCP Clients on the same network as the DHCP server completing the D.O.R.A. process

The challenge comes when the DHCP Server is on a different network than the clients.

Deploying a DHCP Server on different network than the clients

When DHCP Clients and the DHCP Server are on different networks, there’s a common roadblock.

Consider what happens when a client sends a DHCP_DISCOVER Broadcast Frame into the network while searching for a DHCP Server.

Image 218

Image Title - PC A sending a DHCP_DISCOVER Broadcast Frame in search of a DHCP Server

As shown in the image, if there are no DHCP servers in the same network as PC A, PC A won’t be able to obtain an IP address.

The key point is that the DHCP_DISCOVER message is a Broadcast Frame. Broadcasts only propagate within the same broadcast domain/VLAN.

When the router receives this Broadcast Frame, it won’t forward it. By default, routers do not forward broadcasts. As a result, the DHCP Server in the 172.16.1.0/24 network will never receive PC A’s DHCP_DISCOVER message.

To solve this, we need the router to pass the client’s DHCP discovery traffic to the DHCP Server in another network. That’s where DHCP relay comes in.

Dhcp relay agents

To forward a DHCP_DISCOVER message from a DHCP Client to a DHCP Server in a different network, you use a DHCP Relay Agent.

A DHCP Relay Agent takes the Layer 2 DHCP_DISCOVER Broadcast Frame and converts it into a Unicast IP packet so it can be routed (or “relayed”) to the DHCP Server.

A router can be configured as a DHCP Relay Agent. The requirements are:

  • The Router must have its router interface(s) within the same network (Broadcast Domain) as the DHCP Clients.
  • The router must have a valid route to the DHCP Server.

The command to configure a router as a DHCP Relay Agent is shown below. This command must be entered under the router interface that faces the DHCP Clients:

Command DHCP Server’s IP address
ip helper-address 172.16.1.250

interface gigabitethernet0/0
ip helper-address 172.16.1.250

Let’s look at how the D.O.R.A. process completes after adding this configuration:

Image 219

Image Title - PC A and DHCP Server completing the DORA process after the configuration of the DHCP Relay Agent on R1

The “ip helper-address” (DHCP Relay Agent) command must be enabled on the router interface facing the DHCP Clients (typically the clients’ Default Gateway) because that interface can receive the clients’ DHCP_DISCOVER frames within the same broadcast domain.

Once the relay agent is configured, the router can convert those broadcast frames into a unicast IP packet and route it to the DHCP Server.

The DHCP Server can determine which pool to use because the router sources the relayed packet using the IP address of its interface in the client subnet. That tells the server which subnet the request came from, so it can lease an IP address from the correct pool.

For the same reason, the server also knows where to send the DHCP_OFFER.

Configuring a router to be a DHCP client

Sometimes you can’t reserve a Static IP address for a router interface, so the interface must receive an IP address from a DHCP Server. This is common with home internet or broadband/residential service. Many home routers work this way.

Let’s look at how to configure this on a Cisco router.

Image 220

Image Title - R1 in need of an IP address from the ISP Router via DHCP

In this scenario:

  • R1 needs an IP address on its GigabitEthernet0/1 interface via DHCP.
  • The ISP router has a DHCP pool configured and will lease an IP address to R1.

Yes, routers can also be configured to behave like DHCP Servers. They can have DHCP pools configured on them and lease out IP addresses to clients.

To configure a router interface to obtain an IP address via DHCP, go under the interface and enter:

ip address dhcp

That’s it. The router will go through the D.O.R.A. process with the DHCP Server like any other DHCP Client.

This is an interface specific command, so you must be in Interface Configuration mode for the interface that should receive an IP address via DHCP.

Image 221

Image Title - Screenshot of configuring R1 to be a DHCP Client

Static IP address assignment

  • Manual configuration of IP address, Subnet Mask, Default Gateway on each host
  • Address remains unchanged until manually altered
  • Impractical for large networks

Dynamic Host Configuration Protocol (DHCP)

  • Automates IP address, Subnet Mask, Default Gateway assignment
  • DHCP Clients request info from DHCP Server
  • Server uses pre-configured address pools (one per subnet)

DHCP lease process

  • Server leases IP info for a set time
  • Lease renewal may result in same or new IP address
  • Server and client both check for duplicate addresses before assignment

DHCP D.O.R.A. process

  • Discover: Client broadcasts DHCP_DISCOVER to find server
  • Offer: Server replies with DHCP_OFFER containing address info
  • Request: Client ARPs for offered IP, then sends DHCP_REQUEST if available
  • Acknowledgement: Server pings IP, then sends DHCP_ACK if unused

DHCP server deployment approaches

  • Server in same network as clients:
    • DHCP_DISCOVER broadcast reaches server directly
    • Simple D.O.R.A. process
  • Server in different network:
    • Broadcasts do not cross routers by default
    • DHCP_DISCOVER does not reach remote server

DHCP relay agents

  • Router configured as DHCP Relay Agent (ip helper-address command)
  • Converts DHCP_DISCOVER broadcast to unicast IP packet
  • Forwards to DHCP Server in another network
  • Server identifies correct pool by source interface IP

Configuring router as DHCP client

  • Router interface can obtain IP via DHCP (ip address dhcp command)
  • Used when static IP not available (e.g., home/broadband routers)
  • Command is interface-specific; set in Interface Configuration mode

Routers as DHCP servers

  • Routers can be configured to provide DHCP services
  • Can lease IP addresses to connected clients

Sign up for free to take 10 quiz questions on this topic

Previous
Next  | 4.4 Domain Name Service (DNS)
All rights reserved ©2016 - 2026 Achievable, Inc.

Dynamic Host Configuration Protocol (DHCP)

This chapter covers one of the most common ways to assign IP addresses to hosts on a network.

In the early days of networking, there weren’t many hosts on a network. That made it practical to manually configure an IP address on each host’s NIC (network interface card) in its operating system. You could enter the IP address, Subnet Mask, and Default Gateway directly in Windows (or whatever OS the host was running).

Manually assigning an IP address, Subnet Mask, and Default Gateway on a host is called assigning a Static IP address.

It’s called “Static” because the address stays the same (it survives a reboot) until you change it or remove it.

This is the same idea as configuring an IP address and Subnet Mask on a router interface: you’re assigning a “Static” IP address to that interface.

You would do this one host at a time. That worked when there were only a few devices, but modern networks often have hundreds (or thousands) of hosts. At that scale, manually assigning and maintaining IP addresses becomes impractical.

A more scalable approach is to assign IP addresses dynamically. The protocol that supports this is the Dynamic Host Configuration Protocol (DHCP).

With DHCP:

  • Hosts that need an IP address, Subnet Mask, and Default Gateway are called DHCP Clients.
  • DHCP Clients request that information from a DHCP Server.
  • A DHCP Server is a server running a DHCP application. It has one or more pools of IP addresses (typically one pool per subnet), with the Subnet Mask and Default Gateway pre-configured for each pool.

When a DHCP Client requests addressing information, the DHCP Server leases an available IP address (plus the Subnet Mask and Default Gateway) to the client for a specific period of time.

When the lease expires, the client can negotiate again with the server. Depending on the situation, it may receive the same IP address again or a new one.

Before an IP address is assigned:

  • The DHCP Server checks to make sure it isn’t leasing a duplicate address.
  • The client also checks before it commits to using the offered address.

Because the DHCP Server keeps assignment information in its database, you get a centralized, dynamic way to track addressing. The main manual work is:

  • Pre-configuring the DHCP pools on the server
  • Ensuring client NICs are set to obtain an IP address automatically (via DHCP)

It’s important to understand the steps a DHCP Client uses to receive an IP address from a DHCP Server. This is the “D.O.R.A.” process:

Discover

Offer

Request

Acknowledgement

Please study the table below:

Client or Server Action Description
Client Discover The Client sends a Broadcast Frame containing a DHCP_DISCOVER message in search of a DHCP Server to receive an IP address, Subnet Mask and Default Gateway
Server Offer The Server receives the DISCOVER message from the Client and looks for an IP address to lease to the Client. If there are IPs available, it will send all the pertinent information back to the Client in a DHCP_OFFER message.
Client Request The Client receives the OFFER and sends an ARP Request on the LAN for the IP address that was offered. If it doesn’t receive a response, then that means no one else is currently using it. The Client will then send a DHCP_REQUEST to the Server, committing to the request of the IP that was offered.
Server Acknowledgement The Server receives the REQUEST from the Client and before it releases the IP address that was requested, it sends out 2 pings to that IP to make sure that no one is currently using it. If it doesn’t receive a reply, then it will finally send a DHCP_ACK message to the Client, letting it know that it is ok to use the IP address.

Two design approaches for DHCP

There are two design approaches to deploying a DHCP Server:

  • Place the DHCP Server in the same network as the clients.
  • Place the DHCP Server in a different network than the clients.

The second approach introduces an important detail we’ll work through.

Deploying a DHCP Server in the same network as the clients

When the DHCP Server is in the same network (or VLAN) as the clients, the process is straightforward.

DHCP Clients begin by sending DHCP_DISCOVER messages as Broadcast Frames. They do this because:

  • They don’t have an IP address yet.
  • You don’t want to hardcode a DHCP Server IP address on every host.
  • You want the host to be able to join different networks without needing prior knowledge of the DHCP Server’s address.

Because the DHCP Server is in the same broadcast domain, those DHCP_DISCOVER Broadcast Frames can reach it at Layer 2, and the D.O.R.A. process can complete.

Image 217

Image Title - DHCP Clients on the same network as the DHCP server completing the D.O.R.A. process

The challenge comes when the DHCP Server is on a different network than the clients.

Deploying a DHCP Server on different network than the clients

When DHCP Clients and the DHCP Server are on different networks, there’s a common roadblock.

Consider what happens when a client sends a DHCP_DISCOVER Broadcast Frame into the network while searching for a DHCP Server.

Image 218

Image Title - PC A sending a DHCP_DISCOVER Broadcast Frame in search of a DHCP Server

As shown in the image, if there are no DHCP servers in the same network as PC A, PC A won’t be able to obtain an IP address.

The key point is that the DHCP_DISCOVER message is a Broadcast Frame. Broadcasts only propagate within the same broadcast domain/VLAN.

When the router receives this Broadcast Frame, it won’t forward it. By default, routers do not forward broadcasts. As a result, the DHCP Server in the 172.16.1.0/24 network will never receive PC A’s DHCP_DISCOVER message.

To solve this, we need the router to pass the client’s DHCP discovery traffic to the DHCP Server in another network. That’s where DHCP relay comes in.

Dhcp relay agents

To forward a DHCP_DISCOVER message from a DHCP Client to a DHCP Server in a different network, you use a DHCP Relay Agent.

A DHCP Relay Agent takes the Layer 2 DHCP_DISCOVER Broadcast Frame and converts it into a Unicast IP packet so it can be routed (or “relayed”) to the DHCP Server.

A router can be configured as a DHCP Relay Agent. The requirements are:

  • The Router must have its router interface(s) within the same network (Broadcast Domain) as the DHCP Clients.
  • The router must have a valid route to the DHCP Server.

The command to configure a router as a DHCP Relay Agent is shown below. This command must be entered under the router interface that faces the DHCP Clients:

Command DHCP Server’s IP address
ip helper-address 172.16.1.250

interface gigabitethernet0/0
ip helper-address 172.16.1.250

Let’s look at how the D.O.R.A. process completes after adding this configuration:

Image 219

Image Title - PC A and DHCP Server completing the DORA process after the configuration of the DHCP Relay Agent on R1

The “ip helper-address” (DHCP Relay Agent) command must be enabled on the router interface facing the DHCP Clients (typically the clients’ Default Gateway) because that interface can receive the clients’ DHCP_DISCOVER frames within the same broadcast domain.

Once the relay agent is configured, the router can convert those broadcast frames into a unicast IP packet and route it to the DHCP Server.

The DHCP Server can determine which pool to use because the router sources the relayed packet using the IP address of its interface in the client subnet. That tells the server which subnet the request came from, so it can lease an IP address from the correct pool.

For the same reason, the server also knows where to send the DHCP_OFFER.

Configuring a router to be a DHCP client

Sometimes you can’t reserve a Static IP address for a router interface, so the interface must receive an IP address from a DHCP Server. This is common with home internet or broadband/residential service. Many home routers work this way.

Let’s look at how to configure this on a Cisco router.

Image 220

Image Title - R1 in need of an IP address from the ISP Router via DHCP

In this scenario:

  • R1 needs an IP address on its GigabitEthernet0/1 interface via DHCP.
  • The ISP router has a DHCP pool configured and will lease an IP address to R1.

Yes, routers can also be configured to behave like DHCP Servers. They can have DHCP pools configured on them and lease out IP addresses to clients.

To configure a router interface to obtain an IP address via DHCP, go under the interface and enter:

ip address dhcp

That’s it. The router will go through the D.O.R.A. process with the DHCP Server like any other DHCP Client.

This is an interface specific command, so you must be in Interface Configuration mode for the interface that should receive an IP address via DHCP.

Image 221

Image Title - Screenshot of configuring R1 to be a DHCP Client

Key points

Static IP address assignment

  • Manual configuration of IP address, Subnet Mask, Default Gateway on each host
  • Address remains unchanged until manually altered
  • Impractical for large networks

Dynamic Host Configuration Protocol (DHCP)

  • Automates IP address, Subnet Mask, Default Gateway assignment
  • DHCP Clients request info from DHCP Server
  • Server uses pre-configured address pools (one per subnet)

DHCP lease process

  • Server leases IP info for a set time
  • Lease renewal may result in same or new IP address
  • Server and client both check for duplicate addresses before assignment

DHCP D.O.R.A. process

  • Discover: Client broadcasts DHCP_DISCOVER to find server
  • Offer: Server replies with DHCP_OFFER containing address info
  • Request: Client ARPs for offered IP, then sends DHCP_REQUEST if available
  • Acknowledgement: Server pings IP, then sends DHCP_ACK if unused

DHCP server deployment approaches

  • Server in same network as clients:
    • DHCP_DISCOVER broadcast reaches server directly
    • Simple D.O.R.A. process
  • Server in different network:
    • Broadcasts do not cross routers by default
    • DHCP_DISCOVER does not reach remote server

DHCP relay agents

  • Router configured as DHCP Relay Agent (ip helper-address command)
  • Converts DHCP_DISCOVER broadcast to unicast IP packet
  • Forwards to DHCP Server in another network
  • Server identifies correct pool by source interface IP

Configuring router as DHCP client

  • Router interface can obtain IP via DHCP (ip address dhcp command)
  • Used when static IP not available (e.g., home/broadband routers)
  • Command is interface-specific; set in Interface Configuration mode

Routers as DHCP servers

  • Routers can be configured to provide DHCP services
  • Can lease IP addresses to connected clients

More from Network services

  • Network Address Translation (NAT)
  • Domain Name Service (DNS)
  • Quality of Service (QoS)
  • Network Time Protocol (NTP)