Week 9 · Lesson 5

DHCP

Every time a laptop joins a network, it needs four things before it can do anything: an IP address, a subnet mask, a default gateway, and a DNS server. Typing those by hand on hundreds of devices is impossible. DHCP hands them out automatically through a fixed four-message exchange called DORA. This lesson covers the process, the exact ports, the Cisco configuration, and the relay trick that lets one server serve many subnets.

CCNA 200-301 IP Services Verified 2026-10-11
Part 1

Why DHCP exists

DHCP (Dynamic Host Configuration Protocol) gives a host its network settings automatically, at the moment it joins. This is often called zero-config networking: plug in, and it works. Without DHCP, an administrator would have to type the same four values on every device and fix them by hand whenever the network changed.

Definition — what DHCP hands out. A DHCP server can provide a client with: (1) an IP address, (2) a subnet mask, (3) a default gateway, and (4) one or more DNS servers. It can also supply a lease duration and many optional parameters.

DHCP is the reason a visiting phone can join a Wi-Fi network without anyone configuring it. It removes the most error-prone manual task in networking: keeping addresses unique and correct across every device.

IP address

The address the host uses on the local segment.

Subnet mask

Which addresses are local and which must be reached through a router.

Default gateway

The router interface to send traffic for anywhere else.

Note. A fifth parameter completes the picture: one or more DNS servers. Without it the host can reach addresses but never names — which is Lesson 2 and 3’s problem.
Part 2

Ports and the DORA process

DHCP runs over UDP, and both endpoints are servers of a sort, so it uses two distinct port roles:

EndpointUDP portRole
DHCP server67Listens for client requests and sends offers and acknowledgments.
DHCP client68Sends requests and receives the server’s replies.
Exam tip. The classic mnemonic is “6–7–8, server–client” but the direction is what matters: the server listens on 67 and the client uses 68. A DHCP client message therefore goes 68 → 67, and a server reply goes 67 → 68. DHCP is UDP, never TCP.

Because a brand-new client has no IP address yet, the very first message is a broadcast. The client sends from source address 0.0.0.0 to destination address 255.255.255.255, asking if any DHCP server is listening.

Definition — DORA. Discover → Offer → Request → Acknowledgment. The message names are DHCPDISCOVER, DHCPOFFER, DHCPREQUEST, and DHCPACK.
DORA step by step
1 / 4

      

Step 3 is broadcast on purpose. In a network with more than one DHCP server, the client may receive several offers. Broadcasting the request names the server whose offer it accepts and lets every other server withdraw theirs. Only after the DHCPACK in step 4 does the client actually configure its interface.

Part 3

Lease time and renewal

DHCP does not give an address away forever — it leases it. An address is valid for the lease duration (commonly 8 days on a LAN, or just hours on a busy Wi-Fi network). The lease is what lets addresses be recycled when devices leave. Move the slider to see the two renewal points.

Lease timeline · set the lease length
T1 50%
T2 87.5%

Exam tip. The simple version to remember for the exam: a DHCP client renews its lease at 50% of the lease time.
Part 4

DHCP options

DHCP encodes settings as numbered options, defined in RFC 2132. Four appear constantly in CCNA material. Select each one.

Option numbers · select one

OptionNameProvides
1Subnet MaskThe client’s subnet mask.
3RouterThe default gateway address.
6Domain Name ServerOne or more DNS server addresses.
51IP Address Lease TimeHow long the address may be used.
Remember. Option 3 is the gateway even though it is called “Router”. Option 6 is DNS. Option 1 is the mask. Option 51 is the lease. These numbers are stable and widely tested.
Part 5

DHCP on Cisco IOS, and the relay

A Cisco router can act as a DHCP server for a directly connected LAN. First reserve the addresses that must stay static (routers, servers, printers), then define the pool. This example serves the 192.168.1.0/24 network:

! 1. Reserve the static range so DHCP never hands it out
R1(config)# ip dhcp excluded-address 192.168.1.1 192.168.1.10

! 2. Create the pool and give it a name
R1(config)# ip dhcp pool LAN-POOL

! 3. Network, gateway, and DNS for this pool
R1(dhcp-config)# network 192.168.1.0 255.255.255.0
R1(dhcp-config)# default-router 192.168.1.1
R1(dhcp-config)# dns-server 8.8.8.8
R1(dhcp-config)# exit
R1(config)# end

! 4. Verify who has been assigned what
R1# show ip dhcp binding

The ip dhcp excluded-address range keeps .1 through .10 out of the pool, so the gateway (.1) and any servers are never handed to a client. The default-router command sets option 3; dns-server sets option 6; network supplies option 1; and the router fills in option 51 with its default lease time.

DHCP relay (ip helper-address)

Here is the problem DHCP would otherwise have: the first message is a broadcast, and routers do not forward broadcasts between subnets. If the DHCP server sits on a different subnet than the clients, the clients’ broadcasts never reach it.

Definition — DHCP relay agent. A relay agent is a router interface configured with ip helper-address <server-ip>. It converts the client’s DHCP broadcast into a unicast addressed to the DHCP server on another subnet, and relays the reply back.
! On the gateway interface that faces the clients
R1(config)# interface gigabitEthernet0/0
R1(config-if)# ip helper-address 192.168.2.10

The helper address is placed on the interface closest to the clients — the LAN gateway interface — and points at the DHCP server. With it in place, one central DHCP server can serve many subnets, each relayed by its own gateway.

Will the client reach the server? · change the setup

      

Exam tip. If clients on a subnet configured for DHCP get 169.254.x.x addresses instead of real ones, they have fallen back to APIPA (link-local) because no DHCP reply arrived. On a routed network the most common cause is a missing ip helper-address on the gateway interface. Check that first.
Part 6

Troubleshooting

Pick the symptom you are seeing and the table below gives you the cause and the check.

DHCP fault finder · choose a symptom

SymptomLikely causeCheck / fix
Client gets 169.254.x.x (APIPA)No DHCP reply reached the client.Verify the server is up and reachable; check for a missing relay.
No offer on a different subnetBroadcast cannot cross a router and no relay is configured.Add ip helper-address <server> on the client-facing gateway interface.
Some clients fail, others workDHCP pool exhausted — all leases are in use.Check show ip dhcp binding; enlarge the pool, shorten the lease, or free addresses.
Client ignores an address it already hasA static address falls inside the pool range.Reserve it with ip dhcp excluded-address.
Diagnostic habit. When a host has no working address, ask two questions in order: (1) is the address in the 169.254.0.0/16 range? If yes, DHCP failed. (2) Is the server on the same subnet? If no, is there an ip helper-address? That sequence solves most DHCP tickets.
Part 7 · Your turn

Review

Check what you have learned with these review questions.

Review · 6 questions

Sources

Sources & references

  1. Droms, R. RFC 2131: Dynamic Host Configuration Protocol (1997). rfc-editor.org/rfc/rfc2131.
  2. Alexander, S. & Droms, R. RFC 2132: DHCP Options and BOOTP Vendor Extensions (1997). rfc-editor.org/rfc/rfc2132.
  3. IANA. Service Name and Transport Protocol Port Number Registry (DHCP 67/68). iana.org.
  4. Cisco. CCNA (200-301) Exam Topics, IP Services (DHCP configuration and relay). cisco.com.

Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.