This article provides information on how to configure an SRX device (running Junos OS release 12.x or later) as a DHCP server to provide the IP address to the client, when the client-facing interface is part of a VLAN and the VLAN is a part of a routing instance.
Starting with Junos OS release 12.x, the DHCP process has been modified and the new process is JDHCP. Even though both processes run on the device, it is recommended to use JDHCP and not DHCP.
Setup
SRX(ge-0/0/15)---------client
-
Create a virtual router.
set routing-instances JDHCP-VR instance-type virtual-router
-
Configure the Ethernet switching.
set interfaces ge-0/0/15 unit 0 family ethernet-switching vlan members VLAN1
set interfaces vlan unit 1 family inet address 6.6.6.1/24
set vlans VLAN1 vlan-id 10
set vlans VLAN1 l3-interface vlan.1
-
Assign an interface to the virtual router.
set routing-instances JDHCP-VR interface vlan.1
-
Configure the DHCP server.
set routing-instances JDHCP-VR system services dhcp-local-server group JDHCP-GROUP interface vlan.1
set routing-instances JDHCP-VR access address-assignment pool JDHCPVR-POOL family inet network 6.6.6.0/24
set routing-instances JDHCP-VR access address-assignment pool JDHCPVR-POOL family inet range JDHCPVR-RANGE low 6.6.6.66
set routing-instances JDHCP-VR access address-assignment pool JDHCPVR-POOL family inet range JDHCPVR-RANGE high 6.6.6.67
Verification
root@SRX240-HM-2# run show dhcp server binding routing-instance JDHCP-VR
IP address Session Id Hardware address Expires State Interface
6.6.6.66 30 00:0c:29:83:a1:14 86301 BOUND vlan.1
[edit]
root@SRX240-HM-2# run show dhcp server statistics routing-instance JDHCP-VR
Packets dropped:
Total 45
dhcp-service total 45
Messages received:
BOOTREQUEST 2
DHCPDECLINE 0
DHCPDISCOVER 1
DHCPINFORM 0
DHCPRELEASE 0
DHCPREQUEST 1
Messages sent:
BOOTREPLY 2
DHCPOFFER 1
DHCPACK 1
DHCPNAK 0
DHCPFORCERENEW 0
NOTES
The following configurations leverage JDHCP:
set routing-instances JDHCP-VR system services dhcp-local-server group JDHCP-GROUP interface vlan.1
set routing-instances JDHCP-VR access address-assignment pool JDHCPVR-POOL family inet network 6.6.6.0/24
In Junos OS 12.1x and later releases, DHCP configurations leveraging JDHCPD would look like:
root# run show system processes extensive | match dhcp
1281 root 1 96 0 50280K 12060K select 19:38 0.00% jdhcpd
In earlier versions, DHCP configurations leveraging DHCPD would look like:
set system services dhcp pool 192.168.1.0/24 address-range low 192.168.1.2
set system services dhcp pool 192.168.1.0/24 address-range high 192.168.1.254
set system services dhcp pool 192.168.1.0/24 router 192.168.1.1
The DHCPD process with the above configuration would show as:
root# run show system processes extensive | grep dhcp
57506 root 1 96 0 8884K 3500K select 0:00 0.00% dhcpd
2020/07/30: Article reviewed for accuracy; no changes required; article valid and relevant