This article explains how to configure the Dynamic Host Configuration Protocol (DHCP) relay for EX/QFX switches running Junos ELS (https://apps.juniper.net/feature-explorer/feature-info.html?fKey=5890&fn=Uniform+Enhanced+Layer+2+Software+).
To configure an EX Series switch that supports ELS to act as a DHCP Relay Agent, refer to Minimum DHCP Relay Agent Configuration.
[Client PC] --- ge-0/0/0 [EX/QFX Switch] ge-0/0/1 --- [DHCP Server]
Here:
The Client PC is in VLAN 10.
The DHCP server is in VLAN 20 with the 20.20.20.2 IP address.
The EX switch is configured as a DHCP relay device and performs inter-VLAN routing between VLANs 10 and 20.
set vlans vlan10 vlan-id 10 set interfaces ge-0/0/0 unit 0 family ethernet-switching vlan members vlan10 set vlans vlan10 l3-interface irb.10 set interfaces irb unit 10 family inet address 10.10.10.1/24 set vlans vlan20 vlan-id 20 set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members vlan20 set interfaces irb unit 20 family inet address 20.20.20.1/24 set vlans vlan20 l3-interface irb.20 set forwarding-options dhcp-relay server-group dhcp-server 20.20.20.2 set forwarding-options dhcp-relay active-server-group dhcp-server set forwarding-options dhcp-relay group dhcp interface irb.10
If the client and server are a part of the routing instance, the same DHCP relay configuration may apply but inside the routing instance.
set routing-instances <routing-instance name> forwarding-options dhcp-relay server-group <server-group> x.x.x.xset routing-instances <routing-instance name> forwarding-options dhcp-relay active-server-group <server-group>set routing-instances <routing-instance name> forwarding-options dhcp-relay group <group> interface irb.xx
Note:
The irb.10 Routed VLAN Interface (RVI) is configured for dhcp-relay, so that the DHCP packets in VLAN 10 will be routed to the "20.20.20.2" server in VLAN 20.
Hence you should configure the specific RVIs to which the DHCP packets should be forwarded.
If bootp support is needed, you can include the command: set forwarding-options dhcp-relay overrides bootp-support
The DHCP server should be configured with the default gateway being the IP address owned by VLAN 20 of the DHCP relay (in this example). In scenarios where you are using a Juniper switch as a DHCP server and there is another switch between the DHCP server and the DHCP Relay agent, make sure to configure a static route pointing to the DHCP relay's IRB, except when you are using dynamic routing protocols such as Open Shortest Path First (OSPF) or Border Gateway Protocol (BGP).
2023-6-22: First version
2025-05-06: Adding a note about configuring DHCP server
2026-01-08: Minor, non-technical changes