This article explains how to configure legacy EX Series switches as a Dynamic Host Configuration Protocol (DHCP) server, and lists the optional knobs that can be used.
Defining a DHCP pool
The DHCP pool name is identified by a subnet on the EX switch, which is configured on a physical layer 3 interface or on a VLAN interface (IRB). For example, if the switch has ports on VLAN 20, and interface VLAN 20 has IP address 20.20.20.1/24, then the pool to assign IP addresses for this subnet will be configured as set system services dhcp pool 20.20.20.0/24
.
Alternately the IP address could also be assigned to a physical L3 interface. In either case, when the switch receives DHCP DISCOVER / REQUEST packets on either the layer 2 VLAN 20 ports, or the layer 3 port with an interface IP address, the switch knows to assign IP addresses from the pool identified by 20.20.20.0/24. This is how the switch can map DHCP requests to a specific pool.
You can create more pools for other subnets as needed.
Configuring the DHCP pool parameters
Reference the DHCP pool by name and configure these parameters.
-
Address range for IP assignment
-
Lease time in seconds
-
DHCP Server Identifier
-
Gateway / Router, WINS, DNS addresses
-
DHCP Options if any, etc
Configure L2 ports with correct VLAN assignment, or assign appropriate IP addresses to the layer 3 interface. Attach DHCP clients to those ports.
Example
[edit]
root@4200-48-2# show system services dhcp
pool 20.20.20.0/24 {
address-range low 20.20.20.50 high 20.20.20.100;
default-lease-time 3600;
name-server {
20.20.20.1;
}
wins-server {
20.20.20.1;
}
router {
20.20.20.1;
}
server-identifier 20.20.20.1;
}
[edit]
root@4200-48-2# show system services dhcp | display set
set system services dhcp pool 20.20.20.0/24 address-range low 20.20.20.50
set system services dhcp pool 20.20.20.0/24 address-range high 20.20.20.100
set system services dhcp pool 20.20.20.0/24 default-lease-time 3600
set system services dhcp pool 20.20.20.0/24 name-server 20.20.20.1
set system services dhcp pool 20.20.20.0/24 wins-server 20.20.20.1
set system services dhcp pool 20.20.20.0/24 router 20.20.20.1
set system services dhcp pool 20.20.20.0/24 server-identifier 20.20.20.1
[edit]
root@4200-48-2# show interfaces vlan.20
family inet {
address 20.20.20.1/24;
}
[edit]
root@4200-48-2# show interfaces ge-0/0/0
unit 0 {
family ethernet-switching {
vlan {
members 20;
}
}
}
Attach a PC to ge-0/0/0 and a DHCP assignment takes place.
Verifying the DHCP service
root@4200-48-2> show system services dhcp pool
Pool name Low address High address Excluded addresses
20.20.20.0/24 20.20.20.50 20.20.20.100
root@4200-48-2> show system services dhcp ?
Possible completions:
binding Show DHCP client binding information
conflict Show DHCP address conflict
global Show DHCP global scope information
pool Show DHCP address pool information
statistics Show DHCP statistics
2020-08-25: Article reviewed for accuracy; specific platforms (legacy EX) added; article relevant and valid