IP Services · Topic 3 of 9

The Role of DHCP and DNS

Understand what DHCP and DNS each do on a network, how a host gets an address through DORA, how names resolve, and where the two services differ.

  • 5 min
  • Exam objective 4.3
In a nutshell
  • DHCP automates addressing. DNS resolves names.
  • DORA is Discover, Offer, Request, Acknowledge.
  • DHCP uses UDP 67 for the server and UDP 68 for the client.

What it is

DHCP gives devices their addressing, and DNS turns names into addresses.

They are often mentioned together, but they solve different problems.

DHCP (Dynamic Host Configuration Protocol) automatically supplies the settings a device needs. Without it, someone would type an address, mask, gateway and DNS server into every device.

A server hands these out from a scope or pool. Each set is leased for a set time, and the device must renew the lease to keep it.

A DHCP server can supply:

  • an IP address and subnet mask
  • a default gateway
  • one or more DNS server addresses
  • the lease length
  • other options, such as a domain name

DNS (Domain Name System) is the network's phone book. People remember names, and devices need addresses.

DNS uses port 53. Ordinary queries use UDP. TCP is used for large replies and zone transfers.

How it works

A host gets its address from DHCP, then asks DNS to resolve the names it needs.

DHCP: the four steps

A host with no address follows a short conversation known as DORA.

Clientno address1 Discover broadcastDHCP serverUDP 67DHCP server2 OfferClientUDP 68Client3 Request broadcastDHCP serverDHCP server4 AcknowledgeClientlease starts
StepMessageWhat happens
DDiscoverThe client broadcasts: is there a DHCP server?
OOfferA server proposes an address and settings
RRequestThe client asks to use the offered address
AAcknowledgeThe server confirms the lease

The client has no address yet, so it sends from 0.0.0.0 to the broadcast address. The server listens on UDP port 67 and the client on UDP port 68. The Request is also a broadcast, so other servers that made offers know the client chose someone else.

Watch out

A Discover is a broadcast, and a router does not forward broadcasts. A server on another subnet needs a relay, covered in the DHCP client and relay topic.

Halfway through the lease, the client asks to renew, usually from the same server.

A client that never gets an answer to its first Discover often falls back to a link-local address starting with 169.254.

A DHCP server on a router

An administrator defines the scope, excludes addresses that must stay fixed, and can reserve an address for a device.

ip dhcp excluded-address 192.168.10.1 192.168.10.20
ip dhcp pool LAN10
 network 192.168.10.0 255.255.255.0
 default-router 192.168.10.1
 dns-server 8.8.8.8
 lease 7

The lease value is in days by default. The excluded range keeps the first twenty addresses free for fixed devices.

DNS: how a name is resolved

The host checks its own cache first, then asks its configured resolver.

Hostneeds an addressqueryResolverDNS serverasks up the treeAuthoritative serverowns the nameanswer with TTLHost

The authoritative server holds the official answer. The reply carries a TTL, which says how long everyone may cache it.

The record types to recognise:

RecordMaps
AName to IPv4 address
AAAAName to IPv6 address
CNAMEAlias to another name
MXMail server for a domain
NSName server for a domain
PTRAddress back to a name

DNS on a Cisco router

A router can resolve names you type at the command line.

ip domain lookup
ip name-server 8.8.8.8
ip domain name example.com
ip host LAB1 10.1.1.1
  • ip name-server points the router at a DNS server.
  • ip host creates a local name-to-address entry.
  • no ip domain lookup stops the long pause when you mistype a command and the router tries to resolve it as a hostname.

What to remember for the exam

Eight facts separate the two services.

  • DHCP automates addressing. DNS resolves names.
  • DORA is Discover, Offer, Request, Acknowledge.
  • DHCP uses UDP 67 for the server and UDP 68 for the client.
  • Discover is a broadcast, so a server on another subnet needs a relay.
  • DHCP can supply a gateway and DNS server along with the address.
  • Addresses are leased and must be renewed.
  • DNS uses port 53. An A record is IPv4 and an AAAA record is IPv6.
  • DNS answers carry a TTL that controls caching.
Exam tip

A ping to an IP address works but a ping to a name fails? Suspect DNS, not routing.

Common mistakes

These five confusions are the usual ones.

Mixing up the two services. A host can have a good DHCP address and still fail to browse if its DNS server is wrong.

Forgetting the broadcast limit. The fix is a relay on the router, not a bigger scope.

Skipping exclusions. If the pool includes the gateway or a printer's fixed address, DHCP can hand it to a second device and cause a conflict.

Thinking DHCP is permanent. A lease expires, so a long server outage eventually strips clients of addresses.

Confusing A and PTR. A goes from name to address. PTR goes from address to name.

Check yourself

Work through these three prompts.

  • What does each letter of DORA stand for, and which messages are broadcasts?

    DORA is Discover, Offer, Request, Acknowledge. The Discover and the Request are broadcasts.

  • What is the difference between a DNS resolver and an authoritative server, and why does a TTL exist?

    The resolver is the DNS server the host asks, while the authoritative server holds the official answer. The TTL says how long everyone may cache the reply.

  • Why might a host with a valid DHCP address still fail to reach a website by name?

    DHCP and DNS are separate services, so the host's DNS server can be wrong even though its DHCP address is good.

Topic 3 of 9 in IP Services

Test yourself on IP Services

The full Cisco CCNA 200-301 question bank has 1,206 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.