This article provides information about configuring and verifying the Dynamic Host Configuration Protocol (DHCP) relay for legacy EX Series switches.
To configure an EX Series switch with support for ELS to act as a DHCP Relay Agent, refer to Minimum DHCP Relay Agent Configuration.
[Client PC] --- ge-0/0/0 [EX 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.
Configuration
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 vlan.10 set interfaces vlan 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 vlan unit 20 family inet address 20.20.20.1/24 set vlans vlan20 l3-interface vlan.20 set forwarding-options helpers bootp server 20.20.20.2 set forwarding-options helpers bootp interface vlan.10
Note:
The VLAN.10 Routed VLAN Interface (RVI) is configured for bootp relay, so that the bootp 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 bootp packets should be forwarded.
You can also configure a separate server under the "bootp interface vlan.X" stanza only for that specific VLAN.
You can also specify a global server IP address (as above), which is applicable for all RVI interfaces.
Verifying the DHCP Relay Configuration
juniper@EX> show configuration forwarding-options helpers { bootp { server 20.20.20.2; interface { vlan.20; } } }
Verifying Relay Agent Activity
juniper@EX> show helper statistics bootps: Received packets: 4 Forwarded packets: 4 Dropped packets: 0 Due to no interface in fud database: 0 Due to no matching routing instance: 0 Due to an error during packet read: 0 Due to an error during packet send: 0 Due to invalid server address: 0 Due to no valid local address: 0 Due to no route to server/client: 0
To see DHCP packets entering or exiting an interface, you can use the monitor traffic interface <interface-name> command.
To debug relay agent activity on EX:
[edit] set forwarding-options helpers traceoptions file helper set forwarding-options helpers traceoptions flag bootp set forwarding-options helpers traceoptions level level
After the forwarding activity is completed, you can view the /var/log/helper file. By default, helper activity is logged in /var/log/fud, which is viewed by using show log fud.
Troubleshooting Tip: If no IP address is obtained after debugging and the traceoptions file is not pointing to an issue with packets being dropped, ensure that:
Routes are in place toward the DHCP server
No firewall filters are dropping DHCP packets
You can also create firewall filters to count packets from the DHCP/bootp well-known ports to confirm whether the device is receiving packets back from the server or not, or if the issue resides with the host itself. For DHCP client packets toward the server, the port should be 67; for DHCP packets from the server toward the client, the destination port should be 68.
Caution
Debugs using traceoptions should be used with care, especially on a busy router or switch. It is advisable to turn them on only for specific features at any given time, and for specific flag and level options of interest and turn them off when no longer needed. Else, this can cause high CPU activity and affect other processes.
Monitoring live output by using "monitor start <trace-file-name>" can generate excess network traffic if there is too much data; so avoid it in a busy production environment and use the trace files for viewing later.
2020-02-13: Article reviewed for accuracy; no changes required.
2022-05-31: Article title updated to indicate that the information applies to legacy EX Series switches; changed categories to reflect only legacy platforms; added troubleshooting tip to create firewall filters based on destination port