EdgeRouter – DHCP Relay


This article describes the steps needed to relay DHCP messages from clients to a DHCP server located on a different subnet.

 book_25x25.png  Notes & Requirements:

Applicable to EdgeOS 1.9.1+ firmware in all EdgeRouter models. Knowledge of the Command Line Interface (CLI) and basic networking knowledge is required. Find a basic article on the subject in the Related Articles below.


Equipment used in this article:

EdgeRouter-X (ER-X)

Table of Contents

  1. Network Diagram
  2. Steps – DHCP Relay
  3. Related Articles

Network Diagram

Back to Top

The network topology is shown below. The following interfaces are in use on the ER:

  1. Ethernet 0 (Eth0)
  2. Ethernet 1 (Eth1)
  3. Ethernet 2 (Eth2)

Steps – DHCP Relay

Back to Top

In this example the ER is running in the default configuration. The ER is connected to two DHCP clients but is not running a DHCP server itself, instead it forwards all DHCP requests to the DHCP server located at

The DHCP relay agent (the ER) sets the gateway address (giaddr) and adds the relay agent information option to the forwarded packet:

  • The giaddr address is used by the dhcp server to identify which subnet (interface) the request originated on.
  • Using this information, the server knows which pool to assign an address from.


CLI_circle.png  Access the command line interface (CLI). You can do this using the CLI button in the GUI or by using a program such as PuTTY.

1. Enter configuration mode.


2. Create the DHCP Relay agent configuration on the relevant interfaces (including the upstream interface).

set service dhcp-relay interface eth0
set service dhcp-relay interface eth1
set service dhcp-relay interface eth2
info_i_25x25.png Note: The DHCP Relay agent needs to be configured to listen on all the interfaces participating in the relaying process. This includes the interfaces connected to the clients (Eth1 and Eth2) but also the interface that connects (upstream) to the DHCP server (Eth0)

3. Define the location of the DHCP Server.

set service dhcp-relay server

4. (Optional) Futher define the relaying options.

A DHCP relay agent may receive a DHCP message from another DHCP relay agent that already contains relaying information (relayed twice). By default the DHCP packet is discarded, but you can customize this behavior with the following command:

set service dhcp-relay relay-options relay-agents-packets [ append | replace | forward | discard ]
  • append append own relay options to packet
  • replace replace existing agent option field
  • forward forward packet unchanged
  • discard discard packet (default action if giaddr not set in packet)

5. Commit the changes.


6. Save the configuration.



Related Articles

Back to Top

Leave a Reply

Your email address will not be published. Required fields are marked *