This topic provides an
overview of DHCP related components.
A DHCP relay agent
is a host that forwards DHCP packets between clients and servers that do not
reside on a shared physical subnet. Relay agent forwarding is distinct from the
normal forwarding of an IP router where IP datagrams are switched between
DHCP clients use
User Datagram Protocol (UDP) broadcasts to send DHCPDISCOVER messages when they
lack information about the network to which they belong.
If a client is on a
network segment that does not include a server, a relay agent is needed on that
network segment to ensure that DHCP packets reach the servers on another
network segment. UDP broadcast packets are not forwarded, because most routers
are not configured to forward broadcast traffic. You can configure a DHCP relay
agent to forward DHCP packets to a remote server by configuring a DHCP relay
profile and configure one or more helper addresses in it. You can assign the
profile to an interface or a VRF.
The figure below
demonstrates the process. The DHCP client broadcasts a request for an IP
address and additional configuration parameters on its local LAN. Acting as a
DHCP relay agent, Router B picks up the broadcast, changes the destination
address to the DHCP server's address and sends the message out on another
interface. The relay agent inserts the IP address of the interface, on which
the DHCP client’s packets are received into the gateway address (giaddr) field
of the DHCP packet, which enables the DHCP server to determine which subnet
should receive the offer and identify the appropriate IP address range. The
relay agent unicasts the messages to the server address, in this case
172.16.1.2 (which is specified by the helper address in the relay profile).
Figure 1. Forwarding UDP
Broadcasts to a DHCP Server Using a Helper Address
DHCP server accepts
address assignment requests and renewals and assigns the IP addresses from
predefined groups of addresses contained within Distributed Address Pools
(DAPS). DHCP server can also be configured to supply additional information to
the requesting client such as subnet mask, domain-name, the IP address of the
DNS server, the default router, and other configuration parameters. DHCP server
can accept broadcasts from locally attached LAN segments or from DHCP requests
that have been forwarded by other DHCP relay agents within the network.
The DHCP client
functionality enables the router interfaces to dynamically acquire the IPv4
address using DHCP.
The DHCP provides
configuration parameters to Internet hosts. DHCP consists of two components:
- a protocol to deliver
host-specific configuration parameters from a DHCP server to a host.
- a mechanism to allocate
network addresses to hosts.
DHCP is built on a
client-server model, where designated DHCP server hosts allocate network
addresses, and deliver configuration parameters to dynamically configured
A relay agent is
required if the client and server are not on the same Layer 2 network. The
relay agent usually runs on the router, and is required because the client
device does not know its own IP address initially. The agent sends out a Layer
2 broadcast to find a server that has this information. The router relays these
broadcasts to the DHCP server, and forwards the responses back to the correct
Layer 2 address so that the correct device gets the correct configuration
DHCP has the ability
to allocate IP addresses only for a configurable period of time, called the
lease period. If the client is required to retain this IP address for a longer
period beyond the lease period, the lease period must be renewed before the IP
address expires. The client renews the lease based on configuration that was
sent from the server. The client unicasts a REQUEST message using the IP
address of the server. When a server receives the REQUEST message and responds
with an ACK message. The lease period of the client is extended by the lease
time configured in the ACK message.
- DHCP client can be enabled
only on management interfaces.
- Either DHCP or static IP can
be configured on an interface.
Service-based Mode Selection
As part of DHCP IPv4
service based mode selection feature, a new mode called DHCP base is
introduced. If an interface is configured in the DHCP base mode, then the DHCP
selects the DHCP server mode to process the client request by matching option
60 (class-identifier) value of the client request with the configured value
under the DHCP base profile.
profile DHCP_BASE base
match option 60 41424355 profile DHCP_SERVER server
default profile DEFAULT_PROFILE server
relay information authenticate inserted
profile DHCP_relay relay
helper-address vrf default 10.10.10.1 giaddr 0.0.0.0
profile DHCP_SERVER server
lease 1 0 0
profile DEFAULT_PROFILE server
lease 1 0 0
interface gigabitEthernet 0/0/0/0 base profile DHCP_BASE
The pool is
configured under server-profile-mode and server-profile-class-sub-mode. The
class-based pool selection is always given priority over profile pool
selection. The DHCPv4 server profile class sub-mode supports configuring DHCP
options except few (0, 12, 50, 52, 53, 54, 58, 59, 61, 82, and 255).