In my previous Junos Basics post I covered a simple OSPF configuration in Junos. In this post I’ll step through configuring a Juniper EX2200C switch as a DHCP server.
The EX2200C is a great little switch that’s ideal for a small branch office deployment, and one feature that you might look to take advantage of in such a network is the switch’s ability to function as a DHCP server.
The first step is to enable DHCP for a VLAN (in this case the SALES VLAN 192.168.1.0/24 that we created in a previous post):
set system services dhcp pool 192.168.1.0/24
Next, we’ll set the range of addresses that the server can dish out to clients to 192.168.1.10 – 100:
[edit system services dhcp pool 192.168.1.0/24] set address-range low 192.168.1.10 set address-range high 192.168.1.100
Then we need to make sure our DHCP clients pick up the correct domain name, DNS server and default gateway IP addresses:
[edit system services dhcp pool 192.168.1.0/24] set system services dhcp pool 192.168.1.0/24 domain-name small.biz set system services dhcp pool 192.168.1.0/24 name-server 192.168.1.1 set system services dhcp pool 192.168.1.0/24 router 192.168.1.1
That’s the basic configuration done so I’ll test it with a client machine connected to the SALES VLAN, and run a couple of show commands to verify our config is working:
To see stats for the client to server DHCP packets:
rich@EX2200C> show system services dhcp statistics Packets dropped: Total 0 Messages received: BOOTREQUEST 0 DHCPDECLINE 0 DHCPDISCOVER 1 DHCPINFORM 0 DHCPRELEASE 0 DHCPREQUEST 2 Messages sent: BOOTREPLY 0 DHCPOFFER 1 DHCPACK 2 DHCPNAK 0
To view the IP address leases:
rich@EX2200C> show system services dhcp binding IP address Hardware address Type Lease expires at 192.168.1.66 00:26:6c:10:6d:ff dynamic 2012-06-09 21:59:33 UTC
Finally, sometimes it is useful for a client machine to always receive the same IP address when it requests one from a DHCP server. This is achieved with a DHCP address reservation for the MAC address of the client machine.
To do this we have to go up a level in the configuration, and then set a static binding:
[edit system services dhcp] set static-binding 00:26:6c:10:6d:ff fixed-address 192.168.1.10
To test this I’ll release/renew the IP address on the client machine, and then check the binding on the server:
rich@EX2200C> show system services dhcp binding IP address Hardware address Type Lease expires at 192.168.1.10 00:26:6c:10:6d:ff static never
I hope this has been a useful explanation. In my next Junos Basics post I’ll cover automatic configuration archiving to an FTP server.
Thanks for reading.
Follow Rich on Twitter
What about the “propagate-settings” command?
I see and read a lot of conflicting information on this.
Varying from propagating the setting received on interface/vlan X to Y to actually “activating” the dhcp pool on interface/vlan Z.
What are your thoughts?
I haven’t seen the “propagate-settings” command. I’ll check it out and let you know! thanks
I did some research and the Junos 12.1X44 CLI Reference guide give me this:
“Enable or disable the propagation of TCP/IP settings received on the device acting as Dynamic Host Configuration Protocol (DHCP) client. The settings can be propagated to the server pool running on the device. Use the system services dhcp statement to set this feature globally. Use the system services dhcp pool statement to set the feature for the address pool and override the global setting.”
However, KB26748 and KB21909 present the “propagate-settings” command as a way to bind the DHCP pool to a specific interface/vlan.
KB26748 (http://kb.juniper.net/InfoCenter/index?page=content&id=KB26748) with DHCP troubleshooting information states:
“DHCP pool is configured without specifying the interface, so the IP addresses are assigned to all the interfaces resulting in the clients getting addresses in the wrong subnet. ”
With the following example as a solution:
“Below is an example of how to configure the DHCP pool with an interface. Note that the propagate-settings option is used to associate a pool to a specific interface.
root# set system services dhcp pool 192.168.1.0/24 propagate-settings ge-0/0/0.0 <-interface acting as DHCP server"
So, now… what is it? 🙂
I'm contemplating opening a JTAC case…
Did you ever come to a satisfactory answer? I’m getting ready to use an EX as a DHCP server, and this concerns me.
i don’t get it, it doesn’t support NAT but supports DHCP, DHCP alone is no good at all for most people i guess
The 2200 is a switch. You’d need a router or firewall for NAT.