Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?


Example: Protecting Against DHCP Snooping Database Attacks

In one type of attack on the DHCP snooping database, an intruder introduces a DHCP client on an untrusted access interface with a MAC address identical to that of a client on another untrusted interface. The intruder then acquires the DHCP lease of that other client, thus changing the entries in the DHCP snooping table. Subsequently, what would have been valid ARP requests from the legitimate client are blocked.

This example describes how to configure allowed MAC addresses, a port security feature, to protect the switch from DHCP snooping database alteration attacks:


This example uses the following hardware and software components:

  • One EX Series switch or one QFX3500 switch

  • Junos OS Release 11.4 or later for EX Series switches or Junos OS Release 12.1 or later for the QFX Series

  • A DHCP server to provide IP addresses to network devices on the switch

Before you configure specific port security features to mitigate common access-inteface attacks, be sure you have:

Overview and Topology

Ethernet LANs are vulnerable to address spoofing and DoS attacks on network devices. This example describes how to protect the switch from an attack on the DHCP snooping database that alters the MAC addresses assigned to some clients.

This example shows how to configure port security features on a switch that is connected to a DHCP server.

The setup for this example includes the VLAN employee-vlan on the switch. Figure 1 illustrates the topology for this example.


Figure 1: Network Topology for Basic Port SecurityNetwork Topology for Basic Port Security

The components of the topology for this example are shown in Table 1.

Table 1: Components of the Port Security Topology
Properties Settings

Switch hardware

One EX3200-24P, 24 ports (8 PoE ports) or one QFX3500 switch

VLAN name and ID

employee-vlan, tag 20

VLAN subnets through is the subnet's broadcast address

Interfaces in employee-vlan

ge-0/0/1, ge-0/0/2, ge-0/0/3, ge-0/0/8

Interface for DHCP server


In this example, the switch has already been configured as follows:

  • Secure port access is activated on the switch.

  • DHCP snooping is enabled on the VLAN employee-vlan.

  • All access ports are untrusted, which is the default setting.


To configure allowed MAC addresses to protect the switch against DHCP snooping database alteration attacks:


CLI Quick Configuration

To quickly configure some allowed MAC addresses on an interface, copy the following commands and paste them into the switch terminal window:

Step-by-Step Procedure

To configure some allowed MAC addresses on an interface:

Configure the five allowed MAC addresses on an interface:


Check the results of the configuration:


Confirm that the configuration is working properly.

Verifying That Allowed MAC Addresses Are Working Correctly on the Switch


Verify that allowed MAC addresses are working on the switch.


Display the MAC cache information:


The output shows that the five MAC addresses configured as allowed MAC addresses have been learned and are displayed in the MAC cache. The last MAC address in the list, one that had not been configured as allowed, has not been added to the list of learned addresses.