4.2 DHCP and DNS
Key Takeaways
- DHCP automatically assigns IP addresses, subnet masks, default gateways, and DNS servers to clients.
- The DHCP process is DORA: Discover, Offer, Request, Acknowledge (all broadcast-based).
- A DHCP relay agent forwards DHCP broadcasts to a server on a different subnet.
- DNS resolves hostnames to IP addresses — forward lookup maps name to IP, reverse lookup maps IP to name.
- Cisco routers can act as DHCP servers or relay agents.
DHCP and DNS
DHCP (Dynamic Host Configuration Protocol)
DHCP automatically assigns IP configuration to client devices, eliminating the need for manual IP address assignment.
What DHCP Provides
| Parameter | Description |
|---|---|
| IP address | Unique address for the client |
| Subnet mask | Defines the network boundary |
| Default gateway | Router address for traffic leaving the subnet |
| DNS server(s) | Name resolution server addresses |
| Lease time | How long the client can use the address |
| Domain name | The network's domain (e.g., example.com) |
The DORA Process
DHCP uses a four-step process (all using broadcast/multicast at the beginning):
D — Discover (Client → Broadcast)
Client sends DHCPDISCOVER to 255.255.255.255 (broadcast)
Source IP: 0.0.0.0 (client has no IP yet)
Destination: 255.255.255.255
Protocol: UDP 67 (server) / 68 (client)
O — Offer (Server → Client)
Server responds with DHCPOFFER containing an available IP address
The offer includes: IP address, subnet mask, gateway, DNS, lease time
R — Request (Client → Broadcast)
Client broadcasts DHCPREQUEST accepting the offered IP
Broadcast because there may be multiple DHCP servers — this informs ALL servers
A — Acknowledge (Server → Client)
Server sends DHCPACK confirming the lease
Client can now use the IP address
On the Exam: Memorize DORA (Discover, Offer, Request, Acknowledge). Know that DHCP uses UDP ports 67 (server) and 68 (client). The Discover and Request are broadcasts from the client.
Cisco Router as DHCP Server
Router(config)# ip dhcp pool LAN-POOL
Router(dhcp-config)# network 192.168.10.0 255.255.255.0
Router(dhcp-config)# default-router 192.168.10.1
Router(dhcp-config)# dns-server 8.8.8.8 8.8.4.4
Router(dhcp-config)# lease 7 ! 7-day lease
Router(dhcp-config)# exit
Router(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.10 ! Reserve first 10
DHCP Relay Agent
DHCP uses broadcast, but broadcasts don't cross routers. If the DHCP server is on a different subnet, the router must act as a relay agent to forward DHCP broadcasts as unicasts to the server.
Router(config)# interface GigabitEthernet0/1 ! Interface facing the clients
Router(config-if)# ip helper-address 10.0.0.50 ! DHCP server's IP address
The ip helper-address command converts the broadcast DHCPDISCOVER to a unicast and forwards it to the specified server. The server responds directly to the relay agent, which forwards the response to the client.
DHCP Verification
Router# show ip dhcp binding ! View current leases
Router# show ip dhcp pool ! View pool configuration and usage
Router# show ip dhcp server statistics ! DHCP server statistics
DNS (Domain Name System)
DNS resolves human-readable hostnames (www.example.com) to IP addresses (93.184.216.34).
How DNS Works
- User types www.example.com in a browser
- PC checks its local DNS cache first
- If not cached, PC sends a DNS query to its configured DNS server
- DNS server performs recursive lookup if needed:
- Root servers (.com) → TLD servers (example.com) → Authoritative server (www.example.com)
- DNS server returns the IP address to the PC
- PC connects to the IP address
DNS Record Types
| Record | Purpose | Example |
|---|---|---|
| A | Maps hostname to IPv4 address | www.example.com → 93.184.216.34 |
| AAAA | Maps hostname to IPv6 address | www.example.com → 2001:DB8::1 |
| CNAME | Alias pointing to another hostname | blog.example.com → www.example.com |
| MX | Mail server for the domain | example.com → mail.example.com |
| NS | Authoritative nameserver for the domain | example.com → ns1.example.com |
| PTR | Reverse lookup (IP to hostname) | 93.184.216.34 → www.example.com |
DNS on Cisco Devices
Router(config)# ip name-server 8.8.8.8 8.8.4.4 ! Configure DNS servers
Router(config)# ip domain-lookup ! Enable DNS lookups (default)
Router(config)# no ip domain-lookup ! Disable DNS lookups (prevents slow lookups for typos)
On the Exam: DNS uses UDP port 53 for standard queries and TCP port 53 for zone transfers and large responses. Know the DHCP DORA process and that ip helper-address is used for DHCP relay.
What are the four steps of the DHCP process in the correct order?
Which command configures a Cisco router to forward DHCP broadcasts to a server on another subnet?
What DNS record type maps a hostname to an IPv4 address?