Network Operations · Topic 6 of 8

DHCP and IPv6 Address Assignment

Understand how DHCP leases addresses, scopes, reservations, exclusions, options and relay agents, and how IPv6 hosts use SLAAC and DHCPv6 to get addresses.

  • 5 min
  • Includes a diagram
In a nutshell
  • DORA: Discover, Offer, Request, Acknowledge.
  • DHCP uses UDP 67 (server) and 68 (client).
  • A scope is the address range. An exclusion removes addresses from it. A reservation ties an address to a MAC.

What it is

Hosts need an Internet Protocol (IP) address, a subnet mask, a default gateway and a Domain Name System (DNS) server to work on a network. The Dynamic Host Configuration Protocol (DHCP) hands these out automatically so no one has to type them on every device.

Internet Protocol version 6 (IPv6) adds another approach, Stateless Address Autoconfiguration (SLAAC), where a host builds its own address. The exam asks you to configure a DHCP server for a scenario and to tell the IPv6 methods apart.

Clientno address yetdiscoverDHCP serverscope of addressesofferClientgets a lease

How it works

The DHCP exchange

DHCP uses four messages, remembered as DORA.

ClientDiscover broadcastServerServerOfferClientClientRequestServerServerAcknowledgeClientaddress leased
StepMessageMeaning
DDiscoverClient broadcasts to find a server
OOfferServer proposes an address and settings
RRequestClient asks to use the offered address
AAcknowledgeServer confirms the lease

DHCP uses User Datagram Protocol (UDP) port 67 on the server and port 68 on the client. If no server answers, a Windows client may give itself an Automatic Private IP Addressing (APIPA) address in the 169.254.0.0/16 range.

DHCP server settings

SettingPurpose
ScopeThe range of addresses the server may hand out for one subnet
Lease timeHow long a client may keep an address before renewing
ExclusionAddresses inside the scope that the server must not hand out, such as those used by static devices
ReservationA fixed address that is always given to a particular Media Access Control (MAC) address
OptionsExtra settings sent with the lease, such as default gateway, DNS servers, Network Time Protocol (NTP) servers and domain name

Use a reservation for printers and servers that need a stable address but still managed centrally. Use an exclusion for devices configured by hand with static addresses. Static assignment is common for routers, firewalls and servers, but every address must be recorded to avoid duplicates.

A short lease time suits networks where clients come and go, such as guest Wi-Fi. A long lease suits stable office networks.

DHCP relay

Clients in two subnets broadcast Discover messages that routers do not forward; a router or Layer 3 switch acting as relay agent forwards the request as a unicast to one DHCP server in another subnet that has a scope per subnet. DHCP discovery is a broadcast, and routers do not forward broadcasts. A DHCP relay agent, also called an IP helper, runs on a router or Layer 3 switch. It receives the broadcast and forwards it as a unicast to a DHCP server on another subnet.

Clientother subnetbroadcastRouterrelay or IP helperunicastDHCP serverother subnet

This lets one central server serve many subnets, each with its own scope.

SLAAC for IPv6

With SLAAC, an IPv6 host listens for a router advertisement from the local router. The advertisement contains the network prefix, and the host builds the rest of its address on its own, with no server keeping a record.

SLAAC supplies the address and gateway, but it does not necessarily supply DNS servers, so a network may add other information through DHCP for IPv6 (DHCPv6).

DHCPv6

DHCPv6 works in two ways. Stateful DHCPv6 assigns addresses and keeps a record of leases, like IPv4 DHCP. Stateless DHCPv6 gives only other settings, such as DNS servers, while the host builds its address with SLAAC.

DHCPv6 uses UDP port 547 on the server and 546 on the client.

MethodGives the addressNeeds a server
SLAACHost builds it from the router advertisementNo
Stateless DHCPv6Host builds it, server gives extra settingsYes, for settings
Stateful DHCPv6Server assigns itYes

What to remember for the exam

  • DORA: Discover, Offer, Request, Acknowledge.
  • DHCP uses UDP 67 (server) and 68 (client).
  • A scope is the address range. An exclusion removes addresses from it. A reservation ties an address to a MAC.
  • Options deliver the gateway, DNS servers and other settings.
  • A relay agent or IP helper forwards DHCP broadcasts to a server on another subnet.
  • A 169.254.x.x address means the client got no DHCP answer.
  • SLAAC lets an IPv6 host build its own address from a router advertisement.
  • Stateful DHCPv6 assigns addresses. Stateless DHCPv6 gives only extra settings.
Exam tip

If clients on one VLAN get 169.254 addresses while the others work, check the relay or IP helper setting and the scope for that subnet first.

Common mistakes

Mixing up reservations and exclusions. A reservation gives a device a fixed address from DHCP. An exclusion keeps the server away from addresses used elsewhere.

Forgetting the relay. The DHCP server is on another subnet, but there is no IP helper to carry the broadcast.

Overlapping scopes or static addresses. Static devices inside a scope cause duplicate addresses unless excluded.

Setting lease times too long on guest networks. Addresses run out when many short visits take addresses.

Assuming SLAAC provides every setting. It builds the address and learns the gateway, but DNS may need DHCPv6.

Watch out

A rogue DHCP server on the network can hand out wrong gateways and DNS servers. Switches can restrict DHCP replies to trusted ports, as covered in the security chapter.

Check yourself

Work through these three.

  • What do the letters in DORA stand for?

    Discover, Offer, Request and Acknowledge.

  • Why is a DHCP relay needed?

    Routers do not forward broadcasts, so the relay passes client requests to a DHCP server on another subnet.

  • How does a host get an IPv6 address with SLAAC?

    It receives the prefix in a router advertisement and builds its own address.

Topic 6 of 8 in Network Operations

Test yourself on Network Operations

The full CompTIA Network+ N10-009 question bank has 910 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 CompTIA. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.