This article provides information on how to configure the Legacy EX-series switch as a DHCP server.
The following steps are used to configure the EX-Series switch as a DHCP server:
- Create DHCP services on the EX switch by creating a DHCP pool:
juniper@EX# set system services dhcp pool 10.0.0.0/24
- Add the lowest IP address and highest IP address in DHCP pool address-range (optional):
juniper@EX# set system services dhcp pool 10.0.0.0/24 address-range low 10.0.0.2 high 10.0.0.252
- Add the router IP address to be supplied with the IP address (optional):
juniper@EX# set system services dhcp pool 10.0.0.0/24 router 10.0.0.1
- Create a virtual interface associated to the DHCP pool:
Juniper@EX# set interface vlan unit 0 family inet address 10.0.0.1/24
- Associate virtual interface to a VLAN where DHCP client’s machines will be connected
Juniper@EX> set vlan default l3-interface vlan.0
Command List Summary:
set system services dhcp pool 10.0.0.0/24 address-range low 10.0.0.2
set system services dhcp pool 10.0.0.0/24 address-range high 10.0.0.252
set system services dhcp pool 10.0.0.0/24 router 10.0.0.1
set interfaces vlan unit 0 family inet address 10.0.0.1/24
set vlans default l3-interface vlan.0
- Repeat steps 1 to 3 to add more DHCP pools for different subnets.
Note: This article is just for setting up DHCP locally on the EX-series switch. You can also configure routed virtual interfaces on the EX switch for each pool; this is covered in the EX-Series documentation and other associated articles.
Verifying DHCP operations on EX switches:
Verify the statistics of DHCP messages between server and the clients
juniper@EX# run show system services dhcp statistics
Packets dropped:
Total 2233
Messages received:
BOOTREQUEST 0
DHCPDECLINE 0
DHCPDISCOVER 2
DHCPINFORM 0
DHCPRELEASE 0
DHCPREQUEST 8
Messages sent:
BOOTREPLY 0
DHCPOFFER 2
DHCPACK 4
DHCPNAK 0
Verify the DHCP IP address allocations (bindings) to DHCP clients:
juniper@EX# run show system services dhcp binding
IP address Hardware address Type Lease expires at
10.0.0.3 00:23:9c:04:e3:43 dynamic 2012-11-14 18:04:40 PDT
10.0.0.4 00:a0:12:00:13:02 dynamic 2012-11-14 18:04:42 PDT
To view the DHCP binding for a specific IP address, the following command has to be issued
juniper@EX> show system services dhcp binding 10.0.0.3 detail
Dynamic binding information:
IP address 10.0.0.3
Hardware address 00:23:9c:04:e3:43
Pool 10.0.0.0/24
Request received on vlan.0
Lease information:
Type DHCP
Obtained at 2012-11-13 18:04:40 PDT
Expires at 2012-11-14 18:04:40 PDT
State active
DHCP options:
Code: 1, Type: ip-address, Value: 255.255.255.0
Code: 28, Type: ip-address, Value: 10.0.0.255
Name: router, Value: [ 10.0.0.1 ]
Debugging DHCP operations on the switches:
Set traceoptions under DHCP to capture packets in log file:
juniper@EX# set system services dhcp traceoptions file
juniper@EX# set system services dhcp traceoptions flag all
To view the log file:
juniper@EX# run file show /var/log/
or
juniper@EX# run monitor start
2020-05-02: Article reviewed for accuracy; added specific platforms (Legacy EX).