Supported Platforms
Related Documentation
- EX Series, QFabric System, QFX Series standalone switches
- Port Security Overview
- Understanding Trusted DHCP Servers for Port Security
- Understanding DHCP Services for Switches
- DHCP/BOOTP Relay for Switches Overview
- Example: Configuring Basic Port Security Features
- EX Series
- Understanding DHCP Option 82 for Port Security on EX Series Switches
- Enabling DHCP Snooping (J-Web Procedure)
- Making IP-MAC Bindings in the DHCP Snooping Database Persistent (CLI Procedure)
- EX Series, QFX Series standalone switches
- Enabling DHCP Snooping (CLI Procedure)
Understanding DHCP Snooping for Port Security
DHCP snooping enables the switch to monitor and control DHCP messages received from untrusted devices connected to the switch. When DHCP snooping is enabled, the system snoops the DHCP messages to view DHCP lease information and build and maintain a database of valid IP address to MAC address (IP-MAC) bindings called the DHCP snooping database. Only clients with valid bindings are allowed access to the network.
DHCP Snooping Basics
Dynamic Host Configuration Protocol (DHCP) allocates IP addresses dynamically, leasing addresses to devices so that the addresses can be reused when no longer needed. Hosts and end devices that require IP addresses obtained through DHCP must communicate with a DHCP server across the LAN.
DHCP snooping acts as a guardian of network security by keeping track of valid IP addresses assigned to downstream network devices by a trusted DHCP server (the server is connected to a trusted network port).
By default, all trunk ports on the switch are trusted and all access ports are untrusted for DHCP snooping.
When DHCP snooping is enabled, the lease information from the switch is used to create the DHCP snooping database, a mapping of IP address to MAC-address pairs.
![]() | Note: DHCP snooping is disabled in the default switch configuration. You must explicitly enable DHCP snooping by setting examine-dhcp at the [edit ethernet-switching-options secure-access-port] hierarchy level. |
Entries in the DHCP database are updated in these events:
- When a DHCP client releases an IP address (sends a DHCPRELEASE message), the associated mapping entry is deleted from the database.
- If you move a network device from one VLAN to another, typically the device needs to acquire a new IP address. Therefore, its entry in the database, including the VLAN ID, is updated.
- When the lease time (timeout value) assigned by the DHCP server expires, the associated entry is deleted from the database.
![]() | Tip: By default, the IP-MAC bindings are lost when the switch is rebooted and DHCP clients (the network devices, or hosts) must reacquire bindings. However, you can configure the bindings to persist by setting the dhcp-snooping-file statement to store the database file either locally or remotely. |
You can configure the switch to snoop DHCP server responses only from particular VLANs. Doing this prevents spoofing of DHCP server messages.
You configure DHCP snooping per VLAN, not per interface (port). DHCP snooping is disabled by default.
DHCP Snooping Process
The basic process of DHCP snooping consists of the following steps:
![]() | Note: When DHCP snooping is enabled for a VLAN, all DHCP packets sent from that network devices in that VLAN are subjected to DHCP snooping. The final IP-MAC binding occurs when the DHCP server sends DHCPACK to the DHCP client. |
- The network device sends DHCPDISCOVER packet to request IP address.
- The switch forwards the packet to the DHCP server.
- The server sends a DHCPOFFER packet to offer an address. If the DHCPOFFER packet is from a trusted interface, the switch forwards the packet to the DHCP client.
- The network device sends a DHCPREQUEST packet to accept the IP address. The switch adds an IP-MAC placeholder binding to the database. The entry is considered a placeholder until a DHCPACK packet is received from the server. Until then, the IP address could still be assigned to some other host.
- The server sends a DHCPACK packet to assign the IP address or a DHCPNAK packet to deny the address request.
- The switch updates the DHCP database in accordance with
the type of packet received:
- Upon receipt of a DHCPACK packet, the switch updates lease information for the IP-MAC binding in its database.
- Upon receipt of a DHCPNACK packet, the switch deletes the placeholder.
![]() | Note: The DHCP database is updated only after the DHCPREQUEST packet has been sent. |
For general information about the messages that the DHCP client and DHCP server exchange during the assignment of an IP address for the client, see the Junos OS System Basics Configuration Guide.
DHCP Server Access
A switch’s access to the DHCP server can be configured in three ways:
- Switch, DHCP Clients, and DHCP Server Are All on the Same VLAN
- Switch Acts as DHCP Server
- Switch Acts as Relay Agent
Switch, DHCP Clients, and DHCP Server Are All on the Same VLAN
When the switch, DHCP clients, and DHCP server are all members of the same VLAN, the DHCP server can be connected to the switch in one of two ways:
- The server is directly connected to the same switch as the one connected to the DHCP clients (the hosts, or network devices, that are requesting IP addresses from the server). The VLAN is enabled for DHCP snooping to protect the untrusted access ports. The trunk port is configured by default as a trusted port. See Figure 1.
- The server is connected to an intermediary switch (Switch 2) that is connected through a trunk port to the switch (Switch 1) that the DHCP clients are connected to. Switch 2 is being used as a transit switch. The VLAN is enabled for DHCP snooping to protect the untrusted access ports. The trunk port is configured by default as a trusted port. See Figure 2—in the figure, ge-0/0/11 is a trusted trunk port.
Figure 1: DHCP Server Connected Directly to Switch

Figure 2: DHCP Server Connected Directly to Switch 2, with Switch 2 Connected to Switch 1 Through a Trusted Trunk Port

Switch Acts as DHCP Server
![]() | Note: The switch cannot act as a DHCP server. |
The switch itself is configured as a DHCP server; this is known as a “local” configuration. See Figure 3.
Figure 3: Switch Is the DHCP Server

Switch Acts as Relay Agent
The switch functions as a relay agent when the DHCP clients or the DHCP server is connected to the switch through a Layer 3 interface. The Layer 3 interfaces on the switch are configured as routed VLAN interfaces (RVIs,) or integrated routing and bridging interfaces (IRBs). The trunk interfaces are trusted by default.
These two scenarios illustrate the switch acting as a relay agent:
- The DHCP server and clients are in different VLANs.
- The switch is connected to a router that is in turn connected to the DHCP server. See Figure 4.
Figure 4: Switch Acting as Relay Agent Through Router to DHCP Server

DHCP Snooping Table
The software creates a DHCP snooping information table that displays the content of the DHCP snooping database. The table shows current IP-MAC bindings, as well as lease time, type of binding, names of associated VLANs, and associated interface.
To display the DHCP snooping database, issue the operational mode command show dhcp snooping binding.
Static IP Address Additions to the DHCP Snooping Database
You can add specific static IP addresses to the database as well as have the addresses dynamically assigned through DHCP snooping. To add static IP addresses, you supply the IP address, the MAC address of the device, the interface on which the device is connected, and the VLAN with which the interface is associated. No lease time is assigned to the entry. The statically configured entry never expires.
Snooping DHCP Packets That Have Invalid IP Addresses
If you enable DHCP snooping on a VLAN and then devices on that VLAN send DHCP packets that request invalid IP addresses, these invalid IP addresses will be stored in the DHCP snooping database until they are deleted when their default timeout is reached. To eliminate this unnecessary consumption of space in the DHCP snooping database, the switch drops the DCHP packets that request invalid IP addresses, preventing the snooping of these packets. The invalid IP addresses are:
- 0.0.0.0
- 128.0.x.x
- 191.255.x.x
- 192.0.0.x
- 223.255.255.x
- 224.x.x.x
- 240.x.x.x to 255.255.255.255
Prioritizing Snooped Packets
![]() | Note: Prioritizing snooped packets is not supported on the QFX Series and the EX4600 switch. |
You can use class-of-service (CoS) forwarding classes and queues to prioritize DHCP snooped packets for a specified VLAN. This type of configuration places the DHCP snooped packets for that VLAN in the desired egress queue, so that the security procedure does not interfere with the transmittal of high-priority traffic. For additional information, see Example: Using CoS Forwarding Classes to Prioritize Snooped Packets in Heavy Network Traffic.
Related Documentation
- EX Series, QFabric System, QFX Series standalone switches
- Port Security Overview
- Understanding Trusted DHCP Servers for Port Security
- Understanding DHCP Services for Switches
- DHCP/BOOTP Relay for Switches Overview
- Example: Configuring Basic Port Security Features
- EX Series
- Understanding DHCP Option 82 for Port Security on EX Series Switches
- Enabling DHCP Snooping (J-Web Procedure)
- Making IP-MAC Bindings in the DHCP Snooping Database Persistent (CLI Procedure)
- EX Series, QFX Series standalone switches
- Enabling DHCP Snooping (CLI Procedure)
Published: 2014-07-23
Supported Platforms
Related Documentation
- EX Series, QFabric System, QFX Series standalone switches
- Port Security Overview
- Understanding Trusted DHCP Servers for Port Security
- Understanding DHCP Services for Switches
- DHCP/BOOTP Relay for Switches Overview
- Example: Configuring Basic Port Security Features
- EX Series
- Understanding DHCP Option 82 for Port Security on EX Series Switches
- Enabling DHCP Snooping (J-Web Procedure)
- Making IP-MAC Bindings in the DHCP Snooping Database Persistent (CLI Procedure)
- EX Series, QFX Series standalone switches
- Enabling DHCP Snooping (CLI Procedure)