Create a vlan interface:
set interfaces vlan unit 21 family inet address 192.168.x.2/24
Assign the vlan interface to a vlan :
set vlans vlan_name vlan-id 21
set vlans vlan_name l3-interface vlan.21
Assign the vlan to a physical interface:
set interfaces fe-0/0/0 unit 0 family ethernet-switching vlan members vlan_name
Assign the dhcp-local-server service to the vlan interface:
set system services dhcp-local-server group IoT interface vlan.21
Create the DHCP pool:
set access address-assignment pool Verhaeg_IoT family inet network 192.168.x.0/24
set access address-assignment pool Verhaeg_IoT family inet range r1 low 192.168.x.200
set access address-assignment pool Verhaeg_IoT family inet range r1 high 192.168.x.250
set access address-assignment pool Verhaeg_IoT family inet dhcp-attributes name-server 192.168.x.1
set access address-assignment pool Verhaeg_IoT family inet dhcp-attributes name-server 8.8.4.4
set access address-assignment pool Verhaeg_IoT family inet dhcp-attributes name-server 8.8.8.8
set access address-assignment pool Verhaeg_IoT family inet dhcp-attributes router 192.168.x.1
Don’t forget your security zone to allow dhcp traffic:
set security-zone x interfaces vlan.20 host-inbound-traffic system-services dhcp
Validate clients have received an IP address from the DHCP server:
root@ROU-02> show dhcp server binding
IP address Session Id Hardware address Expires State Interface
192.168.x.201 2 b6:54:ca:26:51:ae 70785 BOUND vlan.21
192.168.x.202 3 c8:34:8e:5f:a4:2d 85932 BOUND vlan.21