4.3 Explain what DHCP and DNS do for hosts
CCNA 200-301 v1.1 · 4.0 IP Services
DHCP gives a host its address, mask, default gateway and DNS servers. DNS turns names such as www.cisco.com into addresses. Without the first, hosts cannot join the network; without the second, users cannot find anything on it. For the CCNA you explain both exchanges, the record types and how to check them on a host and a router.
What you must know
- Describe the DHCP exchange (Discover, Offer, Request, Acknowledge) and what a lease contains.
- Explain why DHCP needs a relay across subnets.
- Describe how a DNS lookup works: resolver, recursive server, authoritative server, cache.
- Name the common DNS records: A, AAAA, CNAME, MX, PTR, NS.
- Configure IOS as a DNS client and check names on a host.
DHCP
A host without an address broadcasts a Discover. A server answers with an Offer, the host broadcasts a Request for it, and the server confirms with an Acknowledge. The lease holds the address, mask, default gateway, DNS servers, domain name and lease time. The host renews at half the lease. Because the Discover is a broadcast, a router must relay it (ip helper-address) when the server is on another subnet.
First PC1 leases its settings (1); only then can it query the DNS server it was given (2).
DNS
A host's resolver sends a query to its configured DNS server, usually over UDP 53 (TCP 53 for large answers and zone transfers). That recursive server answers from its cache or asks the root, then the top-level domain servers, then the domain's authoritative server, and caches the answer for its TTL.
| Record | Maps |
|---|---|
| A | Name → IPv4 address |
| AAAA | Name → IPv6 address |
| CNAME | Alias → canonical name |
| MX | Domain → mail server |
| PTR | Address → name (reverse lookup) |
| NS | Domain → its name servers |
ip domain-lookup
ip name-server 10.0.50.53
ip domain-name example.local
!
! or, in a lab, stop typos becoming lookups:
no ip domain-lookupCommands
ipconfig /all (Windows) | Address, mask, gateway, DHCP server, lease times and DNS servers. |
nslookup www.cisco.com | Asks the configured DNS server and shows the answer and which server gave it. |
ipconfig /displaydns, ipconfig /flushdns | Show or clear the Windows DNS cache. |
show ip dhcp binding | On an IOS DHCP server: the leases given. |
show hosts | On IOS: the name server and cached names. |
Exam traps
- DHCP uses UDP 67 (server) and 68 (client); DNS uses UDP 53, and TCP 53 for zone transfers.
- A host with an address but no DNS server can ping by address but not by name.
- A PTR record is for reverse lookups (address to name).
no ip domain-lookupstops IOS from treating a mistyped command as a hostname to resolve.
Check yourself
- Users can ping 8.8.8.8 but cannot open websites by name. What do you check?
- The DNS server in the host's settings (
ipconfig /all) and whether it answers (nslookup). - Which DNS record gives a name's IPv6 address?
- AAAA.
- Why does a DHCP server on another subnet need a relay?
- The Discover is a broadcast and routers do not forward broadcasts;
ip helper-addressturns it into a unicast to the server.
More topics in 4.0 IP Services
- 4.1 Configure and verify NAT for inside hosts using static mappings and address pools
- 4.5 Describe syslog, including facilities and severity levels
- 4.6 Configure and verify DHCP client and relay
- 4.7 Explain QoS per-hop behavior: classification, marking, queuing, congestion handling, policing, shaping
- 4.8 Configure and verify remote device access with SSH
- 4.9 Describe what TFTP and FTP do on a network