Introduction
In large networks, especially those spread across multiple subnets, efficient IP address management becomes crucial. DHCP (Dynamic Host Configuration Protocol) plays a vital role in this, automating the assignment of IP addresses and other network configuration details. However, DHCP typically operates within a single subnet, which can be limiting in complex network environments. This is where DHCP Relay comes into play, extending the reach of DHCP servers across multiple subnets. In this article, we will delve into the concept of DHCP Relay, its importance in UniFi environments, and how to configure it effectively.
Table of Contents
What is DHCP Relay?
DHCP Relay is a network function that allows DHCP requests from clients in one subnet to be forwarded to a DHCP server located in another subnet. This function is essential in scenarios where the network is divided into multiple VLANs or subnets, and a centralized DHCP server is used. Instead of deploying a DHCP server on every subnet, a DHCP Relay agent can be configured to forward requests to a centralized server, streamlining IP management and reducing administrative overhead.

Importance of DHCP Relay in UniFi Networks
In UniFi networks, especially those deployed in enterprise environments, VLAN segmentation is common to separate different types of traffic—such as guest Wi-Fi, VoIP, and internal communication. Each VLAN typically operates in its own subnet. Without DHCP Relay, each VLAN would require its own DHCP server, leading to increased complexity and resource usage. By implementing DHCP Relay, a single DHCP server can serve multiple VLANs, simplifying the network architecture and ensuring consistent IP address assignment across the entire network.
How DHCP Relay Works
When a client device on a subnet without a DHCP server sends out a broadcast request for an IP address, the DHCP Relay agent intercepts this request. The agent then forwards the request to a DHCP server on another subnet, including information about the original subnet where the request originated. The DHCP server responds with an IP address offer, which the relay agent then forwards back to the client. This process ensures that clients on different subnets can still obtain IP addresses from a centralized DHCP server.

Configuring DHCP Relay in UniFi
Configuring DHCP Relay in a UniFi network involves several steps. Here’s a step-by-step guide:
1. Plan Your Network Subnets and VLANs
- Before configuring DHCP Relay, ensure that your network subnets and VLANs are properly planned. Each VLAN should have its own subnet, and the DHCP server should be configured to serve IP addresses for each subnet.
2. Set Up the DHCP Server
- Configure your DHCP server with scopes for each subnet. Each scope should include the IP address range, subnet mask, and other necessary configuration details (such as default gateway and DNS servers) for that subnet.
3. Enable DHCP Relay on UniFi Devices
- Log into your UniFi Controller and navigate to the network settings for the relevant devices (typically the UniFi Security Gateway or UniFi Dream Machine).
- Go to the Networks section and select the network or VLAN where you want to enable DHCP Relay.
- In the DHCP Mode drop-down, select DHCP Relay.
- Enter the IP address of your centralized DHCP server. This tells the UniFi device where to forward DHCP requests.
- Save your settings.

4. Configure Firewall Rules (If Necessary)
- Depending on your network configuration, you may need to adjust firewall rules to allow DHCP traffic between the relay agent and the DHCP server. Ensure that UDP traffic on ports 67 and 68 (used by DHCP) is permitted between the relevant subnets.
5. Test Your Configuration
- After configuring DHCP Relay, test the setup by connecting devices to different VLANs and verifying that they receive correct IP addresses from the centralized DHCP server. Use tools like
ipconfigon Windows orifconfigon Linux/macOS to confirm the assigned IP addresses.
Troubleshooting Common Issues
- No IP Address Assignment: If clients are not receiving IP addresses, ensure that the DHCP server is reachable from the subnet where the clients are located. Check firewall rules and verify that the relay agent is correctly forwarding requests to the DHCP server.
- Incorrect IP Address Range: Ensure that the DHCP server is configured with the correct scopes for each subnet. If a client receives an IP address from the wrong range, verify that the relay agent is properly configured with the correct server IP address.
- Multiple DHCP Servers: If there are multiple DHCP servers on the network, ensure that they are not serving overlapping subnets, as this can cause IP conflicts and connectivity issues.
Conclusion
DHCP Relay is a powerful tool in UniFi networks, enabling centralized IP address management across multiple subnets and VLANs. By leveraging DHCP Relay, network administrators can simplify their infrastructure, reduce costs, and maintain a consistent configuration across the entire network. Whether you are managing a small office or a large enterprise, understanding and implementing DHCP Relay in your UniFi network can significantly enhance your network’s efficiency and scalability.
This guide should serve as a comprehensive resource for setting up and optimizing DHCP Relay in UniFi environments.
FAQ
-
What is DHCP relay in UniFi?
DHCP relay allows UniFi devices to forward DHCP requests from clients to a DHCP server located on a different subnet. This enables centralized IP address management in routed or VLAN-segmented networks.
-
When should I use DHCP relay with UniFi?
Use DHCP relay when your DHCP server is not on the same Layer 2 network as your clients. This is common in networks with multiple VLANs, where a UniFi gateway or switch forwards the DHCP request to a central server like Windows Server or a pfSense box.
-
How do I configure DHCP relay in UniFi?
In UniFi:
1. Go to Settings > Networks.
2. Edit the VLAN or subnet.
3. Enable DHCP Relay and enter the IP address of your DHCP server. Save and apply changes. Make sure firewall rules allow UDP 67 and 68. -
Can I use DHCP relay with VLANs in UniFi?
Yes, DHCP relay works well with VLANs. Assign the VLAN ID to the network, enable DHCP relay, and make sure the DHCP server has a scope for that VLAN. All routing must be properly configured for inter-VLAN communication.
-
Why is DHCP not working even after enabling relay?
Common causes include:
Incorrect DHCP server IP
Firewall rules blocking UDP 67/68
VLAN tagging misconfigured
No scope for the requested subnet on the DHCP server
Check logs on the DHCP server and the UniFi controller to verify the relay is being received. -
Does the UniFi Dream Machine support DHCP relay?
As of 2024, full DHCP relay support may be limited or missing on the original UniFi Dream Machine (UDM). For full functionality, use a UniFi Gateway like the UDM Pro or a dedicated UniFi router like the UXG series.
-
Can I use multiple DHCP servers with UniFi DHCP relay?
Yes, you can enter multiple DHCP server IPs separated by commas. However, this setup is usually reserved for high-availability environments. Be cautious, as clients may get IPs from either server depending on timing and availability.
-
Does DHCP relay work across site-to-site VPNs?
Not reliably. DHCP relies on broadcast or relay within routed networks, and broadcasts typically don’t traverse VPN tunnels. Use a local DHCP server or set static reservations in those cases.

