DHCP Relay — Delivering DHCP Across Multiple Networks¶
DHCP Relay is a mechanism that allows Dynamic Host Configuration Protocol (DHCP) clients to obtain IP addresses from a DHCP server located on a different subnet. Since DHCP Discover messages are broadcast packets and routers do not forward broadcasts by default, a DHCP Relay Agent receives the broadcast request, converts it into a unicast message, and forwards it to the DHCP server. DHCP Relay enables organisations to deploy centralised DHCP servers while supporting multiple Virtual Local Area Networks (VLANs), branch offices, and enterprise networks. Every Linux administrator, DevOps engineer, Cloud Architect, Platform Engineer, Site Reliability Engineer (SRE), and Network Engineer should understand DHCP Relay.
Learning Path¶
Course Progress
What You'll Learn¶
After completing this lesson, you'll be able to:
- Understand DHCP Relay
- Learn why DHCP Relay is needed
- Understand broadcast limitations
- Learn the DHCP Relay process
- Understand Relay Agents
- Configure DHCP Relay
- Troubleshoot DHCP Relay issues
Prerequisites¶
Complete:
Why Learn DHCP Relay?¶
Imagine an enterprise with:
- 20 VLANs
- 15 Branch Offices
- One Central DHCP Server
Without DHCP Relay:
Instead:
What is DHCP Relay?¶
A DHCP Relay Agent forwards DHCP messages between clients and a DHCP server located on another subnet.
Instead of:
The relay agent performs:
Why is DHCP Relay Needed?¶
DHCP clients send:
Broadcast packets:
Without a relay:
Broadcast Limitation¶
Example:
Client:
DHCP Server:
Separated by a router.
Broadcast:
The DHCP server never receives the request.
DHCP Relay Solution¶
Router configured as:
Workflow:
DHCP Relay Agent¶
A DHCP Relay Agent is typically:
- Router
- Layer 3 Switch
- Firewall
- Gateway
Responsibilities:
- Receive Broadcast
- Add Relay Information
- Forward to DHCP Server
- Return Reply to Client
DHCP Relay Workflow¶
Client
↓
DHCP Discover (Broadcast)
↓
Relay Agent
↓
DHCP Discover (Unicast)
↓
DHCP Server
↓
DHCP Offer
↓
Relay Agent
↓
Client
The remaining Discover, Offer, Request, Acknowledgment (DORA) steps follow the same path.
Complete DORA with Relay¶
Client
↓
Discover (Broadcast)
↓
Relay Agent
↓
Discover (Unicast)
↓
DHCP Server
↓
Offer
↓
Relay Agent
↓
Client
↓
Request
↓
Relay Agent
↓
Server
↓
ACK
↓
Relay Agent
↓
Client
GIADDR (Gateway IP Address)¶
When forwarding the request, the relay agent inserts:
Example:
The DHCP server uses this information to determine:
Scope Selection¶
Example:
GIADDR:
DHCP Server selects:
The correct IP address is assigned to the client.
Enterprise Example¶
Network:
A single DHCP server provides addresses for every VLAN.
Branch Office Example¶
The branch router relays DHCP requests to headquarters.
Cloud Perspective¶
Traditional DHCP Relay is less common in public cloud environments because cloud platforms provide managed DHCP services for virtual networks.
However, DHCP Relay may still be used in:
- Hybrid Cloud
- VMware Environments
- Private Clouds
- Enterprise Data Centres
Kubernetes Perspective¶
Kubernetes Pods typically receive IP addresses from the Container Network Interface (CNI), not DHCP.
Worker nodes, however, often obtain their network configuration through DHCP or cloud-managed networking.
Linux Perspective¶
Linux can function as a DHCP Relay using software such as:
- ISC DHCP Relay (
dhcrelay) - Kea DHCP Relay
Display network interfaces.
Display routing table.
Check listening ports.
Example (ISC DHCP Relay):
Relay to a specific DHCP server:
Actual command-line options may vary depending on the DHCP relay implementation.
DHCP Relay Example¶
The client receives an address even though the server is on another subnet.
Advantages of DHCP Relay¶
- Centralised DHCP Management
- Lower Infrastructure Cost
- Supports Multiple VLANs
- Easier Administration
- Better Scalability
- Simplified Branch Office Design
Limitations¶
- Requires Layer 3 device configuration
- Relay failure affects DHCP for connected networks
- Incorrect GIADDR configuration can result in wrong address assignments
- Relay depends on connectivity to the DHCP server
Hands-on Lab¶
Task 1¶
Display network interfaces.
Task 2¶
Display routing table.
Task 3¶
Check listening network services.
Task 4¶
Draw a network containing:
- Client
- Switch
- Router (Relay Agent)
- DHCP Server
Show the DORA process.
Task 5¶
Explain why DHCP broadcasts cannot cross routers.
Task 6¶
Explain the purpose of the GIADDR field.
Task 7¶
Design a DHCP architecture for:
- Five VLANs
- One Central DHCP Server
Task 8¶
Research DHCP Relay configuration on:
- Cisco IOS
- Linux
- Windows Server
Compare the approaches.
Linux Commands¶
| Command | Purpose |
|---|---|
ip addr | Display network interfaces |
ip route | Display routing table |
ss -tuln | Display listening network ports |
dhcrelay | Run DHCP Relay (if installed) |
Common Mistakes¶
❌ Assuming routers forward DHCP broadcasts.
✅ Configure a DHCP Relay Agent.
❌ Forgetting to configure the relay destination.
✅ Specify the correct DHCP server address.
❌ Incorrect DHCP scope selection.
✅ Verify the GIADDR matches the correct subnet.
❌ Blocking DHCP traffic with firewalls.
✅ Allow DHCP and relay communication.
❌ Running separate DHCP servers unnecessarily.
✅ Use centralised DHCP with relay where appropriate.
Best Practices¶
- Centralise DHCP servers whenever practical.
- Configure DHCP Relay on Layer 3 gateways.
- Verify GIADDR values during troubleshooting.
- Create separate DHCP scopes for each subnet.
- Monitor DHCP lease usage.
- Document relay configurations and DHCP scopes.
Interview Questions¶
Beginner¶
- What is DHCP Relay?
- Why is DHCP Relay required?
- What is a Relay Agent?
- Why can't DHCP broadcasts cross routers?
Intermediate¶
- Explain the DHCP Relay workflow.
- What is GIADDR?
- How does a DHCP server select the correct scope?
- Compare DHCP Relay with deploying multiple DHCP servers.
Architect Level¶
- Design a centralised DHCP architecture for a company with 50 VLANs.
- How would you troubleshoot clients that fail to obtain addresses through a relay?
- Explain DHCP Relay in hybrid enterprise and cloud environments.
Summary¶
In this lesson, you learned:
- DHCP Relay
- Broadcast Limitations
- Relay Agents
- GIADDR
- Centralised DHCP
- Multi-Subnet DHCP
- Enterprise DHCP Design
- Linux DHCP Relay Commands
DHCP Relay enables clients on different subnets to receive IP addresses from a centralised DHCP server. By forwarding DHCP broadcasts as unicast messages and identifying the originating subnet through the GIADDR field, relay agents simplify network management, reduce infrastructure costs, and support scalable enterprise network designs.
Key Takeaways¶
- DHCP broadcasts do not cross routers.
- A DHCP Relay Agent forwards client requests to remote DHCP servers.
- The relay agent inserts the GIADDR to identify the client's subnet.
- Centralised DHCP reduces administrative overhead.
- DHCP Relay is widely used in VLAN-based enterprise networks.
- Proper relay configuration ensures clients receive addresses from the correct scope.
What's Next?¶
In the next lesson, you'll learn about Split DNS.
You'll explore:
- What Split DNS is
- Internal vs External DNS
- Private and Public DNS Zones
- Enterprise DNS Architecture
- Hybrid Cloud DNS
- Security Benefits
- Best Practices
By the end of the lesson, you'll understand how organisations provide different DNS responses for internal and external users while improving security, performance, and manageability.