Junos Basics – EX2200C Switch as a DHCP server

By | August 5, 2013

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 that we created in a previous post):

set system services dhcp pool

Next, we’ll set the range of addresses that the server can dish out to clients to – 100:

[edit system services dhcp pool]
set address-range low
set address-range high

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]
set system services dhcp pool domain-name small.biz
set system services dhcp pool name-server
set system services dhcp pool router 

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     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

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     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

Category: How to guides Juniper Tags: ,

About Rich Bibby

I am a Network Engineer based in Dubai in the UAE. I work mainly with Cisco, Juniper and Arista gear in the enterprise LAN, WAN and Data Centre space. Aside from route/switch/firewalling, I'm interested in open source network monitoring and management tools, and exploring the possibilities that automation and programmability bring to networking. Follow me on Twitter and GitHub

6 thoughts on “Junos Basics – EX2200C Switch as a DHCP server

  1. Maarten

    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?

    1. Rich Bibby Post author

      I haven’t seen the “propagate-settings” command. I’ll check it out and let you know! thanks

      1. Maarten

        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 propagate-settings ge-0/0/0.0 <-interface acting as DHCP server"

        So, now… what is it? 🙂
        I'm contemplating opening a JTAC case…

  2. Mike

    Did you ever come to a satisfactory answer? I’m getting ready to use an EX as a DHCP server, and this concerns me.

  3. tyler

    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

    1. Rich Bibby Post author

      The 2200 is a switch. You’d need a router or firewall for NAT.


Leave a Reply

Your email address will not be published. Required fields are marked *