Example: Configuring IP Source Guard and Dynamic ARP Inspection to Protect the Switch from IP Spoofing and ARP Spoofing
This example uses Junos OS with support for the Enhanced Layer 2 Software (ELS) configuration style. If your switch runs software that does not support ELS, see Example: Protecting Against ARP Spoofing Attacks. For ELS details, see Using the Enhanced Layer 2 Software CLI.
On EX9200 switches, DHCP snooping, DAI, and IP source guard are not supported in an MC-LAG scenario.
This example describes how to enable IP source guard and Dynamic ARP Inspection (DAI) on a specified VLAN to protect the switch against spoofed IP/MAC addresses and ARP spoofing attacks. When you enable either IP source guard or DAI, the configuration automatically enables DHCP snooping for the same VLAN.
Requirements
This example uses the following hardware and software components:
This example also applies to QFX5100, QFX5110, and QFX5200 switches.
One EX4300 switch or EX9200 switch
Junos OS Release 13.2X50-D10 or later for EX Series switches
A DHCP server to provide IP addresses to network devices on the switch
Before you configure IP source guard to prevent IP/MAC spoofing or DAI to mitigate ARP spoofing attacks, be sure you have:
Connected the DHCP server to the switch.
Configured the VLAN to which you are adding DHCP security features.
Overview and Topology
Ethernet LAN switches are vulnerable to attacks on security that involve spoofing (forging) of source MAC addresses or source IP addresses. These spoofed packets are sent from hosts connected to untrusted access interfaces on the switch. These spoofed packets are sent from hosts connected to untrusted access interfaces on the switch. IP source guard checks the IP source address and MAC source address in a packet sent from a host attached to an untrusted access interface on the switch against entries stored in the DHCP snooping database. If IP source guard determines that the packet header contains an invalid source IP address or source MAC address, it ensures that the switch does not forward the packet—that is, the packet is discarded.
Another type of security attack is ARP spoofing (also known as ARP poisoning or ARP cache poisoning). ARP-spoofing is a way to initiate man-in-the-middle attacks. The attacker sends an ARP packet that spoofs the MAC address of another device on the LAN. Instead of the switch sending traffic to the proper network device, it sends it to the device with the spoofed address that is impersonating the proper device. If the impersonating device is the attacker's machine, the attacker receives all the traffic from the switch that should have gone to another device. The result is that traffic from the switch is misdirected and cannot reach its proper destination.
When dynamic ARP inspection (DAI) is enabled, the switch logs the number of invalid ARP packets that it receives on each interface, along with the sender’s IP and MAC addresses. You can use these log messages to discover ARP spoofing on the network.
This example shows how to configure these important 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.
The trunk interface connecting to the DHCP server interface is a trusted port by default. If you attach a DHCP server to an access port, you must configure the port as trusted. Before you do so, ensure that the server is physically secure—that is, that access to the server is monitored and controlled. For more information on trusted and untrusted ports for DHCP, see Understanding and Using Trusted DHCP Servers.
Topology
The components of the topology for this example are shown in Table 1.
Properties | Settings |
---|---|
Switch hardware |
One EX4300 or EX9200 switch |
VLAN name and ID |
|
VLAN subnets |
|
Interfaces in |
|
Interface connecting to DHCP server |
|
In this example, the switch has already been configured as follows:
All access ports are untrusted, which is the default setting.
The trunk port (
ge-0/0/8
) is trusted, which is the default setting.The VLAN (
employee-vlan
) has been configured to include the specified interfaces.
Configuration
To configure IP source guard and DAI (and thereby, also automatically configure DHCP snooping) to protect the switch against IP spoofing and ARP attacks:
Procedure
CLI Quick Configuration
To quickly configure IP source guard and DAI (and thereby, also automatically configure DHCP snooping), copy the following commands and paste them into the switch terminal window:
[edit] set vlans employee-vlan forwarding-options dhcp-security ip-source-guard set vlans employee-vlan forwarding-options dhcp-security arp-inspection
Step-by-Step Procedure
Configure IP source guard and DAI (and thereby, also automatically configure DHCP snooping) on the VLAN:
Configure IP source guard on the VLAN:
[edit vlans employee-vlan forwarding-options dhcp-security] user@switch# set ip-source-guard
Enable DAI on the VLAN:
[edit vlans employee-vlan forwarding-options dhcp-security] user@switch# set arp-inspection
Results
Check the results of the configuration:
user@switch> show vlans employee-vlan forwarding-options employee-vlan { forwarding-options { dhcp-security { arp-inspection; ip-source-guard; } } }
Verification
Confirm that the configuration is working properly.
- Verifying That DHCP Snooping Is Working Correctly on the Switch
- Verifying That IP Source Guard is Working on the VLAN
- Verifying That DAI Is Working Correctly on the Switch
Verifying That DHCP Snooping Is Working Correctly on the Switch
Purpose
Verify that DHCP snooping is working on the switch.
Action
Send some DHCP requests from network devices (here they are DHCP clients) connected to the switch.
Display the DHCP snooping information when the port on which the DHCP server connects to the switch is trusted. The following output results when requests are sent from the MAC addresses and the server has provided the IP addresses and leases:
user@switch> show dhcp-security binding IP Address MAC Address Vlan Expires State Interface 192.0.2.17 00:05:85:3A:82:77 employee-vlan 86265 BOUND ge-0/0/1.0 192.0.2.18 00:05:85:3A:82:79 employee-vlan 86265 BOUND ge-0/0/1.0 192.0.2.19 00:05:85:3A:82:80 employee-vlan 86287 BOUND ge-0/0/2.0 192.0.2.20 00:05:85:3A:82:81 employee-vlan 86287 BOUND ge-0/0/2.0 192.0.2.21 00:05:85:3A:82:83 employee-vlan 86287 BOUND ge-0/0/2.0 192.0.2.22 00:05:85:27:32:88 employee-vlan 86254 BOUND ge-0/0/3.0
Meaning
When the interface on which the DHCP server connects to the switch has been set to trusted, the output (see preceding sample) shows, for the assigned IP address, the device’s MAC address, the VLAN name, and the time, in seconds, remaining before the lease expires.
Verifying That IP Source Guard is Working on the VLAN
Purpose
Verify that IP source guard is enabled and working on the VLAN.
Action
Send some DHCP requests from network devices (here they are DHCP clients) connected to the switch. View the IP source guard information for the data VLAN.
user@switch> show dhcp-security binding ip-source-guard IP Address MAC Address Vlan Expires State Interface 192.0.2.17 00:05:85:3A:82:77 employee-vlan 86265 BOUND ge-0/0/1.0 192.0.2.18 00:05:85:3A:82:79 employee-vlan 86265 BOUND ge-0/0/1.0 192.0.2.19 00:05:85:3A:82:80 employee-vlan 86287 BOUND ge-0/0/2.0 192.0.2.20 00:05:85:3A:82:81 employee-vlan 86287 BOUND ge-0/0/2.0 192.0.2.21 00:05:85:3A:82:83 employee-vlan 86287 BOUND ge-0/0/2.0 192.0.2.22 00:05:85:27:32:88 employee-vlan 86254 BOUND ge-0/0/3.0
Meaning
The IP source guard database table contains the VLANs enabled for IP source guard.
Verifying That DAI Is Working Correctly on the Switch
Purpose
Verify that DAI is working on the switch.
Action
Send some ARP requests from network devices connected to the switch.
Display the DAI information:
user@switch> show dhcp-security arp inspection statistics ARP inspection statistics: Interface Packets received ARP inspection pass ARP inspection failed ge-0/0/1.0 7 5 2 ge-0/0/2.0 10 10 0 ge-0/0/3.0 12 12 0
Meaning
The sample output shows the number of ARP packets received and inspected per interface, with a listing of how many packets passed and how many failed the inspection on each interface. The switch compares the ARP requests and replies against the entries in the DHCP snooping database. If a MAC address or IP address in the ARP packet does not match a valid entry in the database, the packet is dropped.