Configure DHCP Server for Multiple VLANs in JunOS

DHCP (Dynamic Host Configuration Protocol) is a protocol that dynamically provides IP addresses to hosts. The host use DHCP protocol to obtain IP address from DHCP server. The protocol creates database of IP addresses leased to clients. DHCP server can be configured in Juniper EX series switches to provide IP addresses to its hosts. You can configure DHCP server for one or multiple VLANs. Here we will configure DHCP server for multiple VLANs in JunOS. DHCP configuration for Juniper switch and Juniper routers is basically the same. This is because they all have same operating system i.e. JunOS operating system. JunOS operating system is different from CIsco IOS.

Configure DHCP Server for Multiple VLANs in JunOS

The diagram above represents our network scenario. We will create two different VLANs and assign ports to each of them. Let’s get started by logging into EX3200 switch.

Let’s create two VLAns first, vlan 10 as Marketing and vlan 20 as Finance.

root@sysvn# set vlans marketing vlan-id 10
root@sysvn# set vlans finance vlan-id 20
root@sysvn# commit

Issue the commit command after creating VLANs. Otherwise you won’t be able to see the VLANs by issuing “show vlans” command. To view the created VLANs issue the following command,

root@sysvn# run show vlans

The command will show you the list of VLANs and its interfaces.

Now to make the interfaces ge-0/0/08 and ge-0/0/9 member of its corresponding VLANs hit the following commands: –

[edit interfaces ge-0/0/8]
root@sysvn# set unit 0 family ethernet-switching vlan members marketing
[edit interfaces ge-0/0/9]
root@sysvn# set unit 0 family ethernet-switching vlan members finance
[edit interfaces ge-0/0/9]
root@sysvn# commit

Create Layer 3 interface for both VLANs

root@sysvn# set interface vlan unit 10 family inet address 192.168.1.1/24
root@sysvn#set interface vlan unit 20 family inet address 192.168.2.1/24

Configure DHCP Server

Lets configure for VLAN 10 first,

root@sysvn# set system services dhcp pool 192.168.1.0/24
root@sysvn# set system services dhcp pool 192.168.1.0/24 address-range low 192.168.1.11 high 192.168.1.20
root@sysvn# set system serivces dhcp pool 192.168.1.0/24 router 192.168.1.1
root@sysvn# set vlan marketing l3-interface vlan.10

Now configure for VLAN 20,

root@sysvn# set system services dhcp pool 192.168.2.0/24
root@sysvn# set system services dhcp pool 192.168.2.0/24 address-range low 192.168.2.11 high 192.168.2.20
root@sysvn# set system serivces dhcp pool 192.168.2.0/24 router 192.168.2.1
root@sysvn# set vlan finance l3-interface vlan.20

To view the various statistics of DHCP server issue any of following commands.

root@sysvn> show system services dhcp
root@sysvn> show system services dhcp pool
root@sysvn> show system services dhcp binding

References

  1. Configure DHCP Server – Juniper.net
  2. Understanding DHCP Services for EX Series Switches – Juniper.net