DHCP Server, Relay, and Snooping
Key Takeaways
- DHCP uses the DORA process—Discover, Offer, Request, Ack—over UDP with the server on port 67 and the client on port 68.
- A local DHCP server works when the server and clients share a broadcast domain; a DHCP relay (helper) is required when they are on different subnets or VLANs.
- Address pools define network, gateway, DNS, and lease; the gateway option is critical so hosts install a correct default route.
- DHCP Option 82 (relay agent information) lets the relay insert circuit or remote-ID data so the server can make policy or audit decisions.
- DHCP snooping treats switch ports as trusted or untrusted to block rogue DHCP servers and build a binding table used by related security features.
DHCP Server, Relay, and Snooping
Quick Answer: DHCP assigns IP, mask, gateway, DNS, and lease using DORA (Discover → Offer → Request → Ack). The server listens on UDP 67; the client uses UDP 68. Use a local DHCP server when clients and the server share a broadcast domain; use DHCP relay when they do not. DHCP snooping marks ports trusted/untrusted to stop rogue servers.
IP addressing by hand does not scale for campus user VLANs, guest Wi-Fi, or temporary labs. HCIA-Datacom expects you to explain how Dynamic Host Configuration Protocol (DHCP) delivers parameters, when a Huawei device must relay instead of answer locally, what belongs in an address pool, and how DHCP snooping protects the network from unauthorized servers. These topics appear both as pure concept items and as “why did the PC get no address?” troubleshooting scenarios.
Why DHCP matters on campus networks
Without DHCP, every host needs a static IP, mask, default gateway, and DNS—error-prone and slow. DHCP centralizes those parameters in a pool so clients configure themselves at boot or when their lease expires. On Huawei campus designs you commonly see:
| Deployment | Typical role of the Huawei device |
|---|---|
| Small branch | Router or Layer 3 switch runs the DHCP server for connected user VLANs |
| Multi-VLAN campus | Core/aggregation runs the server; access Layer 3 switches or gateway interfaces relay client broadcasts |
| Secure access | Access switches enable DHCP snooping so only trusted uplinks may offer addresses |
| Guest / BYOD | Separate pools or relays per VLAN with shorter leases and restricted gateways |
Exam stems often hide a simple topology fact: DHCP Discover is a broadcast. Broadcasts do not cross routers. If the client VLAN and the DHCP server IP are in different Layer 3 domains, something must relay the request—or the client never receives an Offer.
Ports and message direction
Memorize the transport pair before any CLI:
| Role | UDP port | Typical direction in DORA |
|---|---|---|
| DHCP server | 67 | Receives Discover/Request; sends Offer/Ack |
| DHCP client | 68 | Sends Discover/Request; receives Offer/Ack |
Clients that do not yet have an IP address use 0.0.0.0 as the source and often 255.255.255.255 as the destination for Discover. After a lease is granted, renewals can be unicast to the server that owns the binding. ACL and firewall questions may filter UDP 67/68; blocking them breaks address assignment even when routing is perfect.
The DORA process
DHCP acquisition for a new client is taught as four steps:
- Discover — Client broadcasts “I need an address.” Any listening DHCP server may respond.
- Offer — Server proposes an IP (and typically other options) from a pool, often after checking that the address is free (for example via ICMP/ARP conflict detection on many platforms).
- Request — Client broadcasts which offer it accepts (important when multiple servers replied).
- Ack — Chosen server confirms the lease; client applies IP, mask, gateway, DNS, and lease timers.
| Step | Who sends | Purpose |
|---|---|---|
| Discover | Client | Locate servers; no usable unicast IP yet |
| Offer | Server | Propose parameters from a pool |
| Request | Client | Accept one offer; decline others |
| Ack | Server | Bind the address for the lease period |
Related messages you should recognize by name:
- Nak — Server refuses a Request (wrong network, expired, or policy deny); client restarts discovery.
- Decline — Client rejects an offered address it believes is already in use.
- Release — Client returns the address early (graceful shutdown).
- Inform — Client that already has an IP asks only for other options (less common on HCIA stems).
Exam trap: Confusing Offer with Ack. The client does not finish configuration after Offer alone; it must Request and receive Ack. Another trap is assuming DORA works unchanged across a router without a relay—Discover never reaches a remote server.
Address pools, gateway option, and lease
A DHCP address pool is the policy object that defines what clients receive. Conceptual fields on Huawei VRP and most platforms:
| Pool element | What it controls |
|---|---|
| Network / mask (or address range) | Which subnet and which IPs may be leased |
| Excluded addresses | Gateways, servers, printers kept static |
| Gateway (router option) | Default gateway the client installs |
| DNS server list | Name resolution targets |
| Domain name | Optional DNS search domain |
| Lease | How long the binding is valid before renew/rebind |
| Static bindings | Optional MAC-to-IP reservations for specific hosts |
The gateway option is frequently tested because a client can receive a valid IP and still have “no Internet” if the gateway is wrong or missing. The lease balances address reuse (short lease for guest Wi-Fi) against control-plane load (longer lease for stable offices). Halfway through the lease, clients typically attempt renewal with the original server; if that fails, they rebind more broadly before the lease fully expires.
Conceptual VRP-oriented workflow (commands vary slightly by version; understand the objects):
- Enable the DHCP service globally.
- Create a pool tied to a subnet or interface network.
- Configure gateway, DNS, and lease inside the pool.
- Exclude the interface IP and other static hosts.
- Bind the pool to the correct interface/VLANIF so offers match the client subnet.
If the server interface IP is not in the pool’s network, clients may get offers that do not match their broadcast domain—another classic misconfiguration.
DHCP server versus DHCP relay
| Mode | When to use | What the device does |
|---|---|---|
| DHCP server | Server function lives on the same router/L3 switch that owns the client subnet (or on a host in that broadcast domain) | Answers Discover with Offer/Ack from a local pool |
| DHCP relay | Real server is on another subnet/VLAN; client broadcasts cannot reach it | Receives Discover on the client interface, unicasts it to one or more server IPs, and returns replies toward the client |
Relay is sometimes called a helper in multi-vendor language. On the client-facing interface you point to the remote DHCP server address(es). The relay rewrites and forwards the request so the server sees a giaddr (gateway IP address) of the client subnet—critical so the server selects the correct pool for that network.
Design rule for the exam: Same broadcast domain → server (or any host server on that LAN) can answer. Different broadcast domains (routed VLANs, remote data center server) → relay required on the first-hop gateway for that client VLAN.
Multiple server IPs on a relay provide redundancy: if the primary DHCP server is down, a secondary may still answer. The client still completes a single DORA conversation with whichever server wins.
Option 82 (relay agent information)
DHCP Option 82 lets the relay agent insert information before forwarding the packet to the server. Sub-options commonly discussed at associate level:
- Circuit ID — Identifies the interface, VLAN, or port path the client is attached to.
- Remote ID — Identifies the relay device itself (hostname, MAC, or configured string).
Why it matters:
| Benefit | Explanation |
|---|---|
| Pool or policy selection | Server can map “port X / VLAN Y” to a specific range or class |
| Audit and troubleshooting | Logs show which access port requested which lease |
| Anti-spoofing designs | Combined with snooping and binding tables in secured campuses |
HCIA does not require deep Option 82 TLV encoding, but you must know that Option 82 is added by the relay, not by ordinary clients, and that servers must be configured to accept and interpret it when the feature is enabled end-to-end.
DHCP snooping: defending against rogue servers
A rogue DHCP server (malware, misconfigured PC, or unauthorized appliance) can hand out wrong gateways and redirect traffic (man-in-the-middle). DHCP snooping on access switches classifies ports:
| Port trust state | Behavior |
|---|---|
| Trusted | DHCP server messages (Offer/Ack) allowed—typically uplinks toward the real server or relay |
| Untrusted | Client-facing ports; server messages arriving here are dropped; client Discovers/Requests are permitted and inspected |
Snooping builds a binding table of MAC, IP, VLAN, port, and lease data from legitimate exchanges. That table feeds related features (IP source guard, dynamic ARP inspection concepts) in broader security designs. For HCIA focus:
- Enable snooping globally and per VLAN as required.
- Trust only the path toward the authorized DHCP server or relay.
- Leave access ports untrusted by default.
- Verify bindings when a host “has IP but cannot pass traffic” after a security change.
Exam trap: Enabling snooping without marking the uplink trusted blacks out all DHCP Offers—every client fails to get an address even though the server is healthy. Another trap: trusting all ports “to make it work,” which defeats the protection.
Troubleshooting checklist (HCIA style)
| Symptom | Likely cause |
|---|---|
| No address; client stays APIPA/169.254 or retries forever | No server/relay; snooping blocking Offers; wrong VLAN; UDP 67/68 filtered |
| Address from wrong subnet | Relay giaddr/pool mismatch; wrong interface pool binding |
| IP OK, no default route | Missing gateway option in pool |
| IP OK, names fail | Missing or wrong DNS option |
| Intermittent after hours | Lease/renewal issues or exhausted pool |
| Only some ports work after security deploy | Snooping trust mis-set on those ports |
Use display commands on VRP to inspect pool usage, relay statistics, and snooping bindings when labs allow—exam questions often describe the same symptoms in prose.
Practice goals before the next section
- Sketch DORA and label UDP 67 versus 68 on each message.
- Decide server versus relay for three topologies (same VLAN, remote server, dual servers).
- List pool options required for full Internet access (IP, mask, gateway, DNS).
- Mark trusted and untrusted ports on a two-tier access/aggregation diagram.
Master these behaviors here; the next section uses address translation (NAT) so private DHCP ranges can reach public networks without consuming a public IP per host.
In the DHCP DORA process, which message does the client send after receiving one or more Offers to indicate which lease it accepts?
Clients in VLAN 20 use gateway 10.20.0.1. The only DHCP server is at 10.99.0.10 on a different subnet. What must be configured on the client VLAN’s first-hop gateway?
Which UDP ports does standard IPv4 DHCP use for server and client respectively?
After DHCP snooping is enabled on an access switch, authorized DHCP Offers arrive only on the uplink toward the real server, yet no client receives an address. What is the most likely misconfiguration?