- Title
- Table of Contents
- Preface
- Product Overview
- Command-Line Interfaces
- Configuring the Switch for the First Time
- Administering the Switch
- Configuring the Cisco IOS XE In Service Software Upgrade Process
- Configuring Interfaces
- Checking Port Status and Connectivity
- Configuring Supervisor Engine Redundancy Using RPR and SSO on Supervisor Engine 8-E
- Configuring Cisco NSF with SSO Supervisor Engine Redundancy
- Environmental Monitoring and Power Management
- Configuring Power over Ethernet
- Configuring the Catalyst 4500 Series Switch with Cisco Network Assistant
- Configuring VLANs, VTP, and VMPS
- Configuring IP Unnumbered Interface
- Configuring Layer 2 Ethernet Interfaces
- Configuring SmartPort Macros
- Configuring Cisco IOS Auto Smartport Macros
- Configuring STP and MST
- Configuring Flex Links and MAC Address-Table Move Update
- Configuring Resilient Ethernet Protocol
- Configuring Optional STP Features
- Configuring EtherChannel and Link State Tracking
- Configuring IGMP Snooping and Filtering
- Configuring IPv6 MLD Snooping
- Configuring 802.1Q Tunneling, VLAN Mapping, and Layer 2 Protocol Tunneling
- Configuring CDP
- Configuring LLDP, LLDP-MED, and Location Service
- Configuring UDLD
- Configuring Unidirectional Ethernet
- Configuring Layer 3 Interfaces
- Configuring Cisco Express Forwarding
- Configuring Unicast Reverse Path Forwarding
- Configuring IP Multicast
- Configuring ANCP Client
- Configuring Policy-Based Routing
- Configuring VRF-lite
- Configuring Quality of Service
- Configuring Voice Interfaces
- Configuring Private VLANs
- Configuring MACsec Encryption
- Configuring 802.1X Port-Based Authentication
- Configuring the PPPoE Intermediate Agent
- Configuring Web-Based Authentication
- Configuring Port Security
- Configuring Control Plane Policing and Layer 2 Control Packet QoS
- Configuring Dynamic ARP Inspection
- Support for IPv6
- Configuring DHCP Snooping, IP Source Guard, and IPSG for Static Hosts
- Configuring Network Security with ACLs
- Port Unicast and Multicast Flood Blocking
- Configuring Storm Control
- Configuring Wireshark
- Configuring SPAN and RSPAN
- Configuring Enhanced Object Tracking
- Configuring System Message Logging
- Onboard Failure Logging (OBFL)
- Configuring SNMP
- Configuring Flexible NetFlow
- Configuring Ethernet OAM and CFM
- Configuring Y.1731 (AIS and RDI)
- Configuring Call Home
- Configuring Cisco IOS IP SLA Operations
- Configuring RMON
- Performing Diagnostics
- Configuring WCCP Version 2 Services
- ROM Monitor
- Configuring MIB Support
- Acronyms and Abbreviations
- Index
- About DHCP Snooping
- Configuring DHCP Snooping
- Default Configuration for DHCP Snooping
- Enabling DHCP Snooping
- Enabling DHCP Snooping on the Aggregation Switch
- Enabling DHCP Snooping and Option 82
- Enabling DHCP Snooping on Private VLAN
- Configuring DHCP Snooping on Private VLAN
- Configuring DHCP Snooping with an Ethernet Channel Group
- Enabling the DHCP Snooping Database Agent
- Limiting the Rate of Incoming DHCP Packets
- Configuration Examples for the Database Agent
Configuring DHCP Snooping, IP Source Guard, and IPSG for Static Hosts
This chapter describes how to configure Dynamic Host Configuration Protocol (DHCP) snooping, IP source guard, and IP source guard (IPSG) for static hosts on Catalyst 4500 series switches. It provides guidelines, procedures, and configuration examples.
This chapter consists of the following major sections:
- About DHCP Snooping
- Configuring DHCP Snooping
- Displaying DHCP Snooping Information
- Displaying IP Source Binding Information
- Configuring IP Source Guard
- Displaying IP Source Binding Information
- Configuring IP Source Guard for Static Hosts
Note For complete syntax and usage information for the switch commands used in this chapter, first look at the Cisco Catalyst 4500 Series Switch Command Reference and related publications at this location:
http://www.cisco.com/en/US/products/hw/switches/ps4324/index.html
If the command is not found in the Catalyst 4500 Series Switch Command Reference, it will be found in the larger Cisco IOS library. Refer to the Cisco IOS Command Reference and related publications at this location:
http://www.cisco.com/en/US/products/ps6350/index.html
About DHCP Snooping
DHCP snooping is a DHCP security feature that provides security by filtering untrusted DHCP messages and by building and maintaining a DHCP snooping binding table. An untrusted message is a message that is received from outside the network or firewall and that can cause traffic attacks within your network.
The DHCP snooping binding table contains the MAC address, IP address, lease time, binding type, VLAN number, and interface information that corresponds to the local untrusted interfaces of a switch; it does not contain information regarding hosts interconnected with a trusted interface. An untrusted interface is an interface that is configured to receive messages from outside the network or firewall. A trusted interface is an interface that is configured to receive only messages from within the network.
DHCP snooping acts such as a firewall between untrusted hosts and DHCP servers. It also gives you a way to differentiate between untrusted interfaces connected to the end-user and trusted interfaces connected to the DHCP server or another switch.
Note In order to enable DHCP snooping on a VLAN, you must enable DHCP snooping on the switch.
You can configure DHCP snooping for switches and VLANs. When you enable DHCP snooping on a switch, the interface acts as a Layer 2 bridge, intercepting and safeguarding DHCP messages going to a Layer 2 VLAN. When you enable DHCP snooping on a VLAN, the switch acts as a Layer 2 bridge within a VLAN domain.
This section includes these topics:
Trusted and Untrusted Sources
The DHCP snooping feature determines whether traffic sources are trusted or untrusted. An untrusted source may initiate traffic attacks or other hostile actions. To prevent such attacks, the DHCP snooping feature filters messages and rate-limits traffic from untrusted sources.
In an enterprise network, devices under your administrative control are trusted sources. These devices include the switches, routers and servers in your network. Any device beyond the firewall or outside your network is an untrusted source. Host ports are generally treated as untrusted sources.
In a service provider environment, any device that is not in the service provider network is an untrusted source (such as a customer switch). Host ports are untrusted sources.
In the Catalyst 4500 series switch, you indicate that a source is trusted by configuring the trust state of its connecting interface.
The default trust state of all interfaces is untrusted. You must configure DHCP server interfaces as trusted. You can also configure other interfaces as trusted if they connect to devices (such as switches or routers) inside your network. You usually do not configure host port interfaces as trusted.
Note For DHCP snooping to function properly, all DHCP servers must be connected to the switch through trusted interfaces, as untrusted DHCP messages will be forwarded only to trusted interfaces.
About the DHCP Snooping Database Agent
To retain the bindings across switch reloads, you must use the DHCP snooping database agent. Without this agent, the bindings established by DHCP snooping are lost upon switch reload. Connectivity is lost as well.
The mechanism for the database agent stores the bindings in a file at a configured location. Upon reload, the switch reads the file to build the database for the bindings. The switch keeps the file current by writing to the file as the database changes.
The format of the file that contains the bindings is as follows:
Each entry in the file is tagged with a checksum that is used to validate the entries whenever the file is read. The <initial-checksum> entry on the first line helps distinguish entries associated with the latest write from entries that are associated with a previous write.
Each entry holds an IP address, VLAN, MAC address, lease time (in hex), and the interface associated with a binding. At the end of each entry is a checksum that accounts for all the bytes from the start of the file through all the bytes associated with the entry. Each entry consists of 72 bytes of data, followed by a space, followed by a checksum.
Upon bootup, when the calculated checksum equals the stored checksum, a switch reads entries from the file and adds the bindings to the DHCP snooping database. When the calculated checksum does not equal the stored checksum, the entry read from the file is ignored and so are all the entries following the failed entry. The switch also ignores all those entries from the file whose lease time has expired. (This situation is possible because the lease time might indicate an expired time.) An entry from the file is also ignored if the interface referred to in the entry no longer exists on the system or if it is a router port or a DHCP snooping-trusted interface.
When a switch learns of new bindings or when it loses some bindings, the switch writes the modified set of entries from the snooping database to the file. The writes are performed with a configurable delay to batch as many changes as possible before the actual write happens. Associated with each transfer is a timeout after which a transfer is aborted if it is not completed. These timers are referred to as the write delay and abort timeout.
Option 82 Data Insertion
In residential, metropolitan Ethernet-access environments, DHCP can centrally manage the IP address assignments for a large number of subscribers. When the DHCP Option 82 feature is enabled on the switch, a subscriber device is identified by the switch port through which it connects to the network (in addition to its MAC address). Multiple hosts on the subscriber LAN can be connected to the same port on the access switch and are uniquely identified.
Note The DHCP Option 82 feature is supported only when DHCP snooping is globally enabled and on the VLANs to which subscriber devices using this feature are assigned.
Figure 48-1 is an example of a metropolitan Ethernet network in which a centralized DHCP server assigns IP addresses to subscribers connected to the switch at the access layer. Because the DHCP clients and their associated DHCP server do not reside on the same IP network or subnet, a DHCP relay agent (the Catalyst switch) is configured with a helper address to enable broadcast forwarding and to transfer DHCP messages between the clients and the server.
Figure 48-1 DHCP Relay Agent in a Metropolitan Ethernet Network
When you enable the DHCP snooping information Option 82 on the switch, this sequence of events occurs:
- The host (DHCP client) generates a DHCP request and broadcasts it on the network.
- When the switch receives the DHCP request, it adds the Option 82 information in the packet. By default, the remote ID suboption is the switch MAC address, and the circuit ID suboption is the port identifier, vlan-mod-port, from which the packet is received. You can configure the remote ID and circuit ID. For information on configuring these suboptions, see the “Enabling DHCP Snooping and Option 82” section.
- If the IP address of the relay agent is configured, the switch adds this IP address in the DHCP packet.
- The switch forwards the DHCP request that includes the Option 82 field to the DHCP server.
- The DHCP server receives the packet. If the server is Option 82-capable, it can use the remote ID, the circuit ID, or both to assign IP addresses and implement policies, such as restricting the number of IP addresses that can be assigned to a single remote ID or circuit ID. The DHCP server then echoes the Option 82 field in the DHCP reply.
- The DHCP server unicasts the reply to the switch if the request was relayed to the server by the switch. The switch verifies that it originally inserted the Option 82 data by inspecting the remote ID and possibly the circuit ID fields. The switch removes the Option 82 field and forwards the packet to the switch port that connects to the DHCP client that sent the DHCP request.
In the default suboption configuration, when the described sequence of events occurs, the values in these fields in Figure 48-2 do not change:
– Length of the suboption type
– Length of the circuit ID type
– Length of the suboption type
– Length of the remote ID type
Figure 48-2 shows the packet formats for the remote ID suboption and the circuit ID suboption when the default suboption configuration is used. For the circuit ID suboption, the module number corresponds to the switch module number. The switch uses the packet formats when you globally enable DHCP snooping and enter the ip dhcp snooping information option global configuration command.
Figure 48-2 Suboption Packet Formats
Figure 48-3 shows the packet formats for user-configured remote ID and circuit ID suboptions. The switch uses these packet formats when DHCP snooping is globally enabled and when the ip dhcp snooping information option format remote-id global configuration command and the ip dhcp snooping vlan information option format-type circuit-id string interface configuration command are entered.
The values for these fields in the packets change from the default values when you configure the remote ID and circuit ID suboptions:
– The length values are variable, depending on the length of the string that you configure.
– The length values are variable, depending on the length of the string that you configure.
Figure 48-3 User-Configured Suboption Packet Formats
Configuring DHCP Snooping
When you configure DHCP snooping on your switch, you are enabling the switch to differentiate untrusted interfaces from trusted interfaces. You must enable DHCP snooping globally before you can use DHCP snooping on a VLAN. You can enable DHCP snooping independently from other DHCP features.
These sections describe how to configure DHCP snooping:
- Default Configuration for DHCP Snooping
- Enabling DHCP Snooping
- Enabling DHCP Snooping on the Aggregation Switch
- Enabling DHCP Snooping and Option 82
- Enabling DHCP Snooping on Private VLAN
- Configuring DHCP Snooping on Private VLAN
- Configuring DHCP Snooping with an Ethernet Channel Group
- Enabling the DHCP Snooping Database Agent
- Limiting the Rate of Incoming DHCP Packets
- Configuration Examples for the Database Agent
Note For DHCP server configuration information, refer to “Configuring DHCP” in the Cisco IOS IP and IP Routing Configuration Guide at:
http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfdhcp.html
Default Configuration for DHCP Snooping
DHCP snooping is disabled by default. Table 48-1 shows all the default configuration values for each DHCP snooping option.
|
|
---|---|
If you want to change the default configuration values, see the “Enabling DHCP Snooping” section.
Enabling DHCP Snooping
Note When DHCP snooping is enabled globally, DHCP requests are dropped until the ports are configured. Consequently, you should probably configure this feature during a maintenance window and not during production.
To enable DHCP snooping, perform this task:
|
|
|
---|---|---|
|
||
|
||
|
(Optional) Configures the amount of time required for recovery from a specified errdisable cause. |
|
|
(Optional) Enables per-VLAN errdisable detection. Note By default this command is enabled, and when a violation occurs the interface is shutdown. |
|
|
Configures the interface as trusted or untrusted. You can use the no keyword to configure an interface to receive messages from an untrusted client. |
|
|
Configures the number of DHCP packets per second (pps) that an interface can receive.1 |
|
|
||
|
You can configure DHCP snooping for a single VLAN or a range of VLANs. To configure a single VLAN, enter a single VLAN number. To configure a range of VLANs, enter a beginning and an ending VLAN number or a dash and range of VLANs.
The number of incoming DHCP packets is rate-limited to prevent a denial-of-service attack. When the rate of incoming DHCP packets exceeds the configured limit, the switch places the port in the errdisabled state. To prevent the port from shutting down, you can use the errdisable detect cause dhcp-rate-limit action shutdown vlan global configuration command to shut down just the offending VLAN on the port where the violation occurred.
When a secure port is in the errdisabled state, you can bring it out of this state automatically by configuring the errdisable recovery cause dhcp-rate-limit global configuration command or you can manually reenable it by entering the shutdown and no shut down interface configuration commands. If a port is in per-VLAN errdisable mode, you can also use clear errdisable interface name vlan range command to reenable the VLAN on the port.
This example shows how to enable DHCP snooping on VLAN 500 through 555:
The following configuration describes the DHCP snooping configuration steps if routing is defined on another Catalyst switch (for example, a Catalyst 6500 series switch):
Note If you are enabling trunking on uplink gigabit interfaces, and the above routing configuration is defined on a Catalyst 6500 series switch, you must configure the “trust” relationship with downstream DHCP snooping (on a Catalyst 4500 series switch) which adds Option 82. On a Catalyst 6500 series switch, this task is accomplished with the ip dhcp relay information trusted VLAN configuration command.
Enabling DHCP Snooping on the Aggregation Switch
To enable DHCP snooping on an aggregation switch, configure the interface connecting to a downstream switch as a snooping untrusted port. If the downstream switch (or a device such as a DSLAM in the path between the aggregation switch and the DHCP clients) adds DHCP information Option 82 to the DHCP packets, the DHCP packets would be dropped on arriving on a snooping untrusted port. If you configure the ip dhcp snooping information option allow-untrusted global configuration command on the aggregation switch, the aggregation switch can accept DHCP requests with Option 82 information from any snooping untrusted port.
Enabling DHCP Snooping and Option 82
To enable DHCP snooping and Option 82 on the switch, perform the following steps:
To disable DHCP snooping, use the no ip dhcp snooping global configuration command. To disable DHCP snooping on a VLAN or range of VLANs, use the no ip dhcp snooping vlan vlan-range global configuration command. To disable the insertion and removal of the Option 82 field, use the no ip dhcp snooping information option global configuration command. To configure an aggregation switch to drop incoming DHCP snooping packets with Option 82 information from an edge switch, use the no ip dhcp snooping information option allow-untrusted global configuration command.
This example shows how to enable DHCP snooping globally and on VLAN 10 and to configure a rate limit of 100 packets per second on a port:
The following example shows how to enable DHCP snooping on VLAN 500 through 555 and option 82 circuit-id:
This example shows how to configure the Option 82 circuit-ID override suboption:
Enabling DHCP Snooping on Private VLAN
DHCP snooping can be enabled on private VLANs, which provide isolation between Layer 2 ports within the same VLAN. If DHCP snooping is enabled (or disabled), the configuration is propagated to both the primary VLAN and its associated secondary VLANs. You cannot enable (or disable) DHCP snooping on a primary VLAN without reflecting this configuration change on the secondary VLANs.
Configuring DHCP snooping on a secondary VLAN is still allowed, but it does not take effect if the associated primary VLAN is already configured. If the associated primary VLAN is configured, the effective DHCP snooping mode on the secondary VLAN is derived from the corresponding primary VLAN. Manually configuring DHCP snooping on a secondary VLAN causes the switch to issue this warning message:
The show ip dhcp snooping command displays all VLANs (both primary and secondary) that have DHCP snooping enabled.
Configuring DHCP Snooping on Private VLAN
DHCP snooping, IPSG, and DAI are Layer 2-based security features that can be enabled and disabled on an individual VLAN, including auxiliary or voice VLAN. You need to enable DHCP snooping on a voice VLAN for a Cisco IP phone to function properly.
Configuring DHCP Snooping with an Ethernet Channel Group
When you configure DHCP snooping, you need to configure trunk interfaces that transmit DHCP packets as trusted interfaces by adding ip dhcp snooping trust to the physical interface configuration. However, if DHCP packets will be transmitted over an Ethernet channel group, you must configure
ip dhcp snooping trust on the logical port channel interface, for example:
Enabling the DHCP Snooping Database Agent
To configure the database agent, perform one or more of the following tasks:
Note Because both NVRAM and bootflash have limited storage capacity, you should use TFTP or network-based files. If you use flash to store the database file, new updates (by the agent) result in the creation of new files (flash fills quickly). Moreover, because of the nature of the file system used on flash, a large number of files can cause slow access. When a file is stored in a remote location accessible through TFTP, an RPR or SSO standby supervisor engine can take over the binding list when a switchover occurs.
Note Network-based URLs (such as TFTP and FTP) require that you create an empty file at the configured URL before the switch can write the set of bindings for the first time.
Limiting the Rate of Incoming DHCP Packets
The switch CPU performs DHCP validation checks; therefore, the number of incoming DHCP packets is rate-limited to prevent a denial-of-service attack.
When the rate of incoming DHCP packets exceeds the configured limit, the switch places the port in the errdisabled state. The port remains in that state until you intervene or you enable errdisable recovery so that ports automatically emerge from this state after a specified timeout period.
Note Unless you explicitly configure a rate limit on an interface, changing the trust state of the interface also changes its rate limit to the default value for that trust state. After you configure the rate limit, the interface retains the rate limit even when its trust state is changed. If you enter the
no ip dhcp snooping limit rate interface configuration command, the interface reverts to its default rate limit.
To prevent the port from shutting down, you can use the errdisable detect cause dhcp-rate-limit action shutdown vlan global configuration command to shut down just the offending VLAN on the port where the violation occurred.
To limit the rate of incoming DHCP packets, perform this task:
To return to the default rate-limit configuration, use the no ip dhcp-rate-limit interface configuration command. To disable error recovery for DHCP inspection, use the no errdisable recovery cause dhcp-rate-limit global configuration command.
This example shows how to set an upper limit for the number of incoming packets (100 pps) and to specify a burst interval (1 second):
Port Name Status Vlan Duplex Speed Type
Te1/1 connected 1 full 10G 10GBase-LR
Te1/2 connected vl-err-dis full 10G 10GBase-LR
Configuration Examples for the Database Agent
The following examples show how to configuration commands in the previous procedure:
Example 1: Enabling the Database Agent
The following example shows how to configure the DHCP snooping database agent to store the bindings at a given location and to view the configuration and operating state:
The first three lines of output show the configured URL and related timer configuration values. The next three lines show the operating state and the amount of time left for expiry of write delay and abort timers.
Among the statistics shown in the output, startup failures indicate the number of attempts the read or create of the file has failed upon bootup.
Note Because the location is based off in the network, you must create a temporary file on the TFTP server. You can create a temporary file on a typical UNIX workstation by creating a 0 byte file “file” in the directory “directory” that can be referenced by the TFTP server daemon. With some server implementations on UNIX workstations, the file should be provided with full (777) permissions for write access to the file.
DHCP snooping bindings are keyed on the MAC address and VLAN combination. If an entry in the remote file has an entry for a given MAC address and VLAN set, for which the switch already has a binding, the entry from the remote file is ignored when the file is read. This condition is referred to as the binding collision.
An entry in a file may no longer be valid because the lease indicated by the entry may have expired by the time it is read. The expired leases counter indicates the number of bindings ignored because of this condition. The Invalid interfaces counter refers to the number of bindings that have been ignored when the interface referred by the entry either does not exist on the system or is a router or DHCP snooping trusted interface if it exists, when the read happened. Unsupported VLANs refers to the number of entries that have been ignored because the indicated VLAN is not supported on the system. The Parse failures counter provides the number of entries that have been ignored when the switch is unable to interpret the meaning of the entries from the file.
The switch maintains two sets of counters for these ignored bindings. One provides the counters for a read that has at least one binding ignored by at least one of these conditions. These counters are shown as the “Last ignored bindings counters.” The total ignored bindings counters provides a sum of the number of bindings that have been ignored because of all the reads since the switch bootup. These two set of counters are cleared by the clear command. The total counter set may indicate the number of bindings that have been ignored since the last clear.
Example 2: Reading Binding Entries from a TFTP File
To manually read the entries from a TFTP file, perform this task:
|
|
|
---|---|---|
|
||
|
||
|
||
|
it is an example of how to manually read entries from the tftp://10.1.1.1/directory/file:
Example 3: Adding Information to the DHCP Snooping Database
To manually add a binding to the DHCP snooping database, perform this task:
|
|
|
---|---|---|
|
||
|
||
|
This example shows how to manually add a binding to the DHCP snooping database:
Displaying DHCP Snooping Information
You can display a DHCP snooping binding table and configuration information for all interfaces on a switch.
Displaying a Binding Table
The DHCP snooping binding table for each switch contains binding entries that correspond to untrusted ports. The table does not contain information about hosts interconnected with a trusted port because each interconnected switch has its own DHCP snooping binding table.
This example shows how to display the DHCP snooping binding information for a switch:
Table 48-2 describes the fields in the show ip dhcp snooping binding command output.
|
|
---|---|
Binding type; dynamic binding learned by DHCP snooping or statically-configured binding. |
|
Displaying the DHCP Snooping Configuration
This example shows how to display the DHCP snooping configuration for a switch:
About IP Source Guard
The IP source guard feature is enabled on a DHCP snooping untrusted Layer 2 port. Initially, all IP traffic on the port is blocked except for DHCP packets that are captured by the DHCP snooping process. When a client receives a valid IP address from the DHCP server, or when you configure a static IP source binding, a per-port and VLAN access control list (VACL) is installed on the port. This process restricts the client IP traffic to those source IP addresses configured in the binding; any IP traffic with a source IP address other than that in the IP source binding is filtered out. This filtering limits the ability of a host to attack the network by claiming a neighbor host’s IP address.
Note If IP source guard is enabled on a trunk port with a large number of VLANs that have DHCP snooping enabled, you might exhaust ACL hardware resources, and some packets might be switched in software instead.
Note When IP source guard is enabled, you might want to designate an alternative scheme for ACL hardware programming. For more information, see the “TCAM Programming and ACLs” section in Chapter 49, “Configuring Network Security with ACLs”.
Note When an interface is in down state, TCAMs are consumed for PACLs, but not for RACLs.
IP source guard supports the Layer 2 port only, including both access and trunk. For each untrusted Layer 2 port, there are two levels of IP traffic security filtering:
IP traffic is filtered based on its source IP address. Only IP traffic with a source IP address that matches the IP source binding entry is permitted.
An IP source address filter is changed when a new IP source entry binding is created or deleted on the port. The port VACL is recalculated and reapplied in the hardware to reflect the IP source binding change. By default, if the IP filter is enabled without any IP source binding on the port, a default PVACL that denies all IP traffic is installed on the port. Similarly, when the IP filter is disabled, any IP source filter PVACL is removed from the interface.
IP traffic is filtered based on its source IP address as well as its MAC address; only IP traffic with source IP and MAC addresses matching the IP source binding entry are permitted.
Note When IP source guard is enabled in IP and MAC filtering mode, the DHCP snooping Option 82 must be enabled to ensure that the DHCP protocol works properly. Without Option 82 data, the switch cannot locate the client host port to forward the DHCP server reply. Instead, the DHCP server reply is dropped, and the client cannot obtain an IP address.
Configuring IP Source Guard
To enable IP source guard, perform this task:
If you want to stop IP source guard with static hosts on an interface, use the following commands in interface configuration submode:
If the no ip device tracking command is used in interface configuration submode, it actually runs in global configuration mode and causes IP device tracking to be disabled globally. Disabling IP device tracking globally causes IP source guard with static hosts to deny all IP traffic on interfaces using the ip verify source tracking [port-security] command.
Note The static IP source binding can only be configured on switch port. If you enter the
ip source binding vlan interface command on a Layer 3 port, you receive this error message:
Static IP source binding can only be configured on switch port.
This example shows how to enable per-Layer 2 port IP source guard on VLAN 10 through 20:
The output shows that there is one valid DHCP binding to VLAN 10.
Configuring IP Source Guard on Private VLANs
For IP source guard to be effective on PVLAN ports, you must enable DHCP snooping on primary VLANs. IP source guard on a primary VLAN is automatically propagated to a secondary VLAN. You can configure static IP source binding on a secondary VLAN, but it does not work. When manually configuring a static IP source binding on a secondary VLAN, you receive the following message:
Displaying IP Source Guard Information
You can display IP source guard PVACL information for all interfaces on a switch using the
show ip verify source command, as the following examples show:
- This example shows displayed PVACLs if DHCP snooping is enabled on VLAN 10 through 20, if interface fa6/1 is configured for IP filtering, and if there is an existing IP address binding 10.0.01 on VLAN 10:
Note The second entry shows that a default PVACL (deny all IP traffic) is installed on the port for those snooping-enabled VLANs that do not have a valid IP source binding.
- This example shows displayed PVACLs for a port with multiple bindings configured for an IP-to-MAC filtering:
- This example shows displayed PVACLs for a port configured for IP-to-MAC filtering but not for port security:
Note The MAC filter shows permit-all because port security is not enabled, so the MAC filter cannot apply to the port or VLAN and is effectively disabled. Always enable port security first.
- This example shows displayed error message when entering the show ip verify source command on a port that does not have an IP source filter mode configured:
You can also use the show ip verify source command to display all interfaces on the switch that have IP source guard enabled, as follows:
Displaying IP Source Binding Information
You can display all IP source bindings configured on all interfaces on a switch using the
show ip source binding command.
Table 48-3 describes the fields in the show ip source binding command output.
|
|
---|---|
Binding type; static bindings configured from CLI to dynamic binding learned from DHCP snooping |
|
Configuring IP Source Guard for Static Hosts
Note IPSG for static hosts should not be used on uplink ports.
IP source guard (IPSG) for static hosts extends the IPSG capability to non-DHCP and static environments.
This section includes these topics:
- About IP Source Guard for Static Hosts
- Configuring IPSG for Static Hosts on a Layer 2 Access Port
- Configuring IPSG for Static Hosts on a PVLAN Host Port
About IP Source Guard for Static Hosts
The prior feature, IPSG, uses the entries created by the DHCP snooping feature to validate the hosts connected to a switch. Any traffic received from a host without a valid DHCP binding entry is dropped. A DHCP environment is a prerequisite for IPSG to work. The IPSG for static hosts feature removes IPSG’ dependency on DHCP. The switch creates static entries based on ARP requests or other IP packets and uses them to maintain the list of valid hosts for a given port. In addition, you can specify the number of hosts that would be allowed to send traffic to a given port. it is equivalent to port security at Layer 3.
Note Some IP hosts with multiple network interfaces may inject some invalid packets into a network interface. Those invalid packets contain the IP-to-MAC address for another network interface of that host as the source address. It may cause IPSG for static hosts in the switch, which connects to the host, to learn the invalid IP-to-MAC address bindings and reject the valid bindings. You should consult the vendor of the corresponding operating system and the network device of that host to prevent it from injecting invalid packets.
IPSG for static hosts initially learns IP-to-MAC bindings dynamically through an ACL-based snooping method. IP-to-MAC bindings are learned from static hosts by using ARP and IP packets and are stored using the device tracking database. Once the number of IP addresses that have been dynamically learned or statically configured on a given port reaches a maximum limit, any packet with a new IP address is dropped in hardware. To handle hosts that have moved or gone away for any reason, the IPSG for static hosts feature uses the IP device tracking functionality to age out dynamically learned IP address bindings. This feature can be used in conjunction with DHCP snooping. Multiple bindings will be established on a port that is connected to both DHCP and static hosts (that is, bindings will be stored in both the device tracking database as well as the DHCP snooping binding database).
Configuring IPSG for Static Hosts on a Layer 2 Access Port
You can configure IPSG for static hosts on a Layer 2 access port.
To enable IPSG for static hosts with IP filters on a Layer 2 access port, perform this task:
To stop IPSG with static hosts on an interface, use the following commands in interface configuration submode:
To enable IPSG with static hosts on a port, enter the following commands:
This issue also applies to IPSG with static hosts on a PVLAN host port.
This example shows how to enable IPSG for static hosts with IP filters on a Layer 2 access port and to verify the three valid IP bindings on the interface Fa4/3:
The following example shows how to enable IPSG for static hosts with IP MAC filters on a Layer 2 access port, to verify the five valid IP-MAC bindings on the interface Fa4/3, and to verify that the number of bindings on this interface has reached the maximum limit:
The following example displays all IP-to-MAC binding entries for all interfaces. The CLI displays all active as well as inactive entries. When a host is learned on a interface, the new entry is marked as active. When the same host is disconnected from the current interface and connected to a different interface, a new IP-to-MAC binding entry is displayed as active as soon as the host is detected. The old entry for this host on the previous interface is now marked as inactive.
The following example displays all active IP-to-MAC binding entries for all interfaces:
The following example displays all inactive IP-to-MAC binding entries for all interfaces. The host was first learned on GigabitEthernet 3/1 then moved to GigabitEthernet 4/1. The IP-to-MAC binding entries learned on GigabitEthernet 3/1 are marked as inactive.
The following example display the count of all IP device tracking host entries for all interfaces:
Configuring IPSG for Static Hosts on a PVLAN Host Port
You can configure IPSG for static hosts on a PVLAN host port.
To enable IPSG for static hosts with IP filters on a PVLAN host port, perform this task:
This example shows how to enable IPSG for static hosts with IP filters on a PVLAN host port:
The output shows the five valid IP-to-MAC bindings that have been learned on the interface Fa4/3. For the PVLAN, the bindings are associated with primary VLAN ID. In this example, the primary VLAN ID, 200, is shown in the table.
The output shows that the five valid IP-to-MAC bindings are on both the primary and secondary VLAN.