Infrastructure Services · Topic 4 of 6

Troubleshooting IPv4 and IPv6 DHCP

Troubleshoot DHCP on IOS XE: client, server and relay roles, DHCP options, the DORA exchange, and IPv6 SLAAC, stateless and stateful DHCPv6 with relays.

  • 5 min
In a nutshell
  • DHCP uses UDP 67 for the server and UDP 68 for the client.
  • The four messages are Discover, Offer, Request and Acknowledgement.
  • ip helper-address on the client interface relays the broadcast to a server.

What it is

DHCP gives hosts an address and other network settings automatically, and a Cisco router can act as the client, the server or the relay.

A client asks for settings. A server answers from a pool. A relay forwards requests from a subnet that has no server to a server on another subnet.

IPv6 can hand out settings in three ways, and the router advertisement flags tell the host which one to use.

Clientbroadcast discoverreachesRelayip helper addressunicast to serverDHCP serveroffers from pool

How it works

IPv4 DHCP uses a four step exchange, and the relay is the usual point of failure.

The IPv4 exchange

The client and server use UDP port 68 and port 67. The four messages are Discover, Offer, Request and Acknowledgement, often called DORA.

The client broadcasts Discover. The server replies with an Offer. The client sends a Request for that offer, and the server confirms it with an Acknowledgement.

IOS DHCP server

R1(config)# ip dhcp excluded-address 10.1.1.1 10.1.1.10
R1(config)# ip dhcp pool LAN
R1(dhcp-config)# network 10.1.1.0 255.255.255.0
R1(dhcp-config)# default-router 10.1.1.1
R1(dhcp-config)# dns-server 10.1.1.2
R1(dhcp-config)# domain-name example.com
R1(dhcp-config)# lease 7

The excluded range stops the server handing out addresses that are used by routers and servers. Lease 7 means seven days. A router interface can also be a client with ip address dhcp.

DHCP relay

A broadcast does not cross a router. The relay is configured on the interface that faces the clients.

R2(config)# interface GigabitEthernet0/1
R2(config-if)# ip helper-address 10.2.2.2

The router receives the broadcast, and sends it as a unicast to the server, adding its own interface address as the gateway address. The server uses that address to choose the right pool. A missing or wrong ip helper-address is a very common fault.

DHCP options

Options carry extra information.

OptionUse
3Default router
6DNS servers
15Domain name
43Vendor information, such as a controller address for access points
150TFTP server address, used by Cisco IP phones
R1(dhcp-config)# option 150 ip 10.1.1.5

Troubleshooting IPv4

Check each step of the path.

  • Is the client getting a Discover through to the server?
  • Does the relay on the client interface point to the correct server?
  • Does the pool match the subnet, and are addresses left?
  • Is a conflict stopping an address from being used?
  • Does a firewall or ACL block UDP 67 and 68?
R1# show ip dhcp binding
R1# show ip dhcp pool
R1# show ip dhcp conflict
R1# show ip dhcp server statistics
R1# debug ip dhcp server packet

show ip dhcp binding lists leases. show ip dhcp conflict lists addresses the server found already in use. show ip dhcp pool shows how many addresses are leased.

IPv6 address assignment

IPv6 hosts learn from router advertisements (RA). Two flags in the RA choose the method.

MethodRA flagsAddress fromOther settings from
SLAACNeither flagHost builds it from the prefixRA, for example the prefix
Stateless DHCPv6Other config flagSLAACDHCPv6 server
Stateful DHCPv6Managed config flagDHCPv6 serverDHCPv6 server
R1(config)# ipv6 dhcp pool V6POOL
R1(config-dhcpv6)# address prefix 2001:DB8:1::/64
R1(config-dhcpv6)# dns-server 2001:DB8:2::53
R1(config)# interface GigabitEthernet0/0
R1(config-if)# ipv6 address 2001:DB8:1::1/64
R1(config-if)# ipv6 nd managed-config-flag
R1(config-if)# ipv6 dhcp server V6POOL

For stateless DHCPv6, use ipv6 nd other-config-flag instead of the managed flag. The pool then only gives the other settings, such as DNS.

DHCPv6 clients use UDP port 546, and servers and relays use UDP 547. Clients find a server using the multicast address FF02::1:2.

A DHCPv6 relay is configured on the client interface.

R2(config-if)# ipv6 dhcp relay destination 2001:DB8:2::2
R2# show ipv6 dhcp binding
R2# show ipv6 dhcp interface
RouterRA with managed flagtellsHostask DHCPv6solicit on FF02::1:2DHCPv6 serverassigns address

The IPv6 checks follow the same pattern.

  • Does the RA carry the right flag?
  • Does the relay point to the server?
  • Is the pool right for the prefix?
Exam tip

Start with the client side. If show ip dhcp binding shows nothing, the request probably never reached the server.

What to remember for the exam

Eight facts cover most questions on this topic.

  • DHCP uses UDP 67 for the server and UDP 68 for the client.
  • The four messages are Discover, Offer, Request and Acknowledgement.
  • ip helper-address on the client interface relays the broadcast to a server.
  • ip dhcp excluded-address keeps addresses out of the pool.
  • Option 150 gives a TFTP server address to phones.
  • The managed config flag means stateful DHCPv6. The other config flag means stateless.
  • DHCPv6 uses UDP 546 for clients and 547 for servers.
  • show ip dhcp binding and show ip dhcp conflict help find faults.
Watch out

Place ip helper-address on the interface that faces the clients, not on the one that faces the server.

Common mistakes

These five mistakes appear often.

No helper address. The client broadcast never reaches the server.

Helper on the wrong interface. The router does not see the client broadcast on that interface.

Pool does not match the subnet. The server finds no pool for the relayed request.

Missing exclusions. The server hands out the address of the default gateway.

Wrong RA flag. The host uses SLAAC and never asks DHCPv6.

Check yourself

Work through these three questions.

  • What are the four messages in the DHCP exchange?

    Discover, Offer, Request and Acknowledgement.

  • Where is ip helper-address configured?

    On the router interface that faces the clients, pointing to the DHCP server.

  • Which RA flag makes a host use stateful DHCPv6?

    The managed config flag, set with ipv6 nd managed-config-flag.

Topic 4 of 6 in Infrastructure Services

Test yourself on Infrastructure Services

The full Cisco CCNP 300-410 ENARSI question bank has 857 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Cisco. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.