DHCP relay
DHCP Relay provides a way for DHCP clients to communicate with DHCP servers that are not available on the same local subnet/broadcast domain. When you enable DHCP Relay, Magic WAN Connector forwards DHCP discover messages to a predefined DHCP server, and routes the responses back to the original device that sent the discover message.
flowchart LR accTitle: An example of Connector in DHCP Relay mode a(Magic WAN Connector) <--> b(Cloudflare/Magic WAN) <--> c(DHCP server) subgraph Site A d[LAN 1] <--> a e[LAN 2] <--> a end subgraph Site B c end classDef orange fill:#f48120,color: black class a,b,c orange
The above graph shows Connector sending DHCP discover messages to a DHCP server offsite.
To configure DHCP relay:
- Log in to the Cloudflare dashboard ↗ and select your account.
- Go to Magic WAN > Connector on-ramps (beta).
- Select your Connector > Edit.
- Select Network Configuration.
- In LAN configuration, select the LAN where you need to configure DHCP relay.
- Select Edit.
- Select This is a DHCP Relay.
- In Upstream DHCP server addresses, enter the IP address of your DHCP server.
- (Optional) If you need to add more DHCP server addresses, select Add upstream DHCP server address as many times as needed, and enter the new values.
Create a PUT
request to update the LAN where you want to enable DHCP relay:
Example:
Required API token permissions
At least one of the following token permissions
is required:
Magic WAN Write
Magic Transit Prefix Write
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/magic/sites/$SITE_ID/lans/$LAN_ID \ --request PUT \ --header "X-Auth-Email: $CLOUDFLARE_EMAIL" \ --header "X-Auth-Key: $CLOUDFLARE_API_KEY" \ --json '{ "lan": { "static_addressing": { "dhcp_relay": { "server_addresses": [ "192.0.2.1" ] } } } }'
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Products
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark