Configuring Control Plane Policing and Layer 2 Control Packet QoS

This chapter contains information on how to protect your Catalyst 4500 series switch using control plane policing (CoPP). The information covered in this chapter is unique to the Catalyst 4500 series switches, and it supplements the network security information and procedures in Chapter49, “Configuring Network Security with ACLs” This information also supplements the network security information and procedures in these publications:

Note For complete syntax and usage information for the switch commands used in this chapter, see 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 Cisco Catalyst 4500 Command Reference, you can locate it 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 Control Plane Policing

The control plane policing (CoPP) feature increases security on the Catalyst 4500 series switch by protecting the CPU from unnecessary or DoS traffic and giving priority to important control plane and management traffic. The classification TCAM and QoS policers provide CoPP hardware support.

Traffic managed by the CPU is divided into three functional components or planes :

Data plane

Management plane

Control plane

You can use CoPP to protect most of CPU-bound traffic and to ensure routing stability, reachability, and packet delivery. Most importantly, you can use CoPP to protect the CPU from a DoS attack.

By default, you receive a list of predefined ACLs matching a selected set of Layer 2 and Layer 3 control plane packets. You can further define your preferred policing parameters for each of these packets and modify the matching criteria of these ACLs.

The following table lists the predefined ACLs.

Predefined Named ACL

Description

system-cpp-dot1x

MAC DA = 0180.C200.0003

system-cpp-lldp

MAC DA = 0180.C200.000E

system-cpp-mcast-cfm

MAC DA = 0100.0CCC.CCC0 - 0100.0CCC.CCC7

system-cpp-ucast-cfm

MAC DA = 0100.0CCC.CCC0

system-cpp-bpdu-range

MAC DA = 0180.C200.0000 - 0180.C200.000F

system-cpp-cdp

MAC DA = 0100.0CCC.CCCC (UDLD/DTP/VTP/Pagp)

system-cpp-sstp

MAC DA = 0100.0CCC.CCCD

system-cpp-cgmp

MAC DA = 01.00.0C.DD.DD.DD

system-cpp-hsrpv2

IP Protocol = UDP, IPDA = 224.0.0.102

system-cpp-ospf

IP Protocol = OSPF, IP DA matches 224.0.0.0/24

system-cpp-igmp

IP Protocol = IGMP, IP DA matches 224.0.0.0/3

system-cpp-pim

IP Protocol = PIM, IP DA matches 224.0.0.0/24

system-cpp-all-systems-on-subnet

IP DA = 224.0.0.1

system-cpp-all-routers-on-subnet

IP DA = 224.0.0.2

system-cpp-ripv2

IP DA = 224.0.0.9

system-cpp-ip-mcast-linklocal

IP DA = 224.0.0.0/24

system-cpp-dhcp-cs

IP Protocol = UDP, L4SrcPort = 68, L4DstPort = 67

system-cpp-dhcp-sc

IP Protocol = UDP, L4SrcPort = 67, L4DstPort = 68

system-cpp-dhcp-ss

IP Protocol = UDP, L4SrcPort = 67, L4DstPort = 67

For the data and management plane traffic, you can define your own ACLs to match the traffic class that you want to police.

CoPP uses MQC to define traffic classification criteria and to specify the configurable policy actions for the classified traffic. MQC uses class maps to define packets for a particular traffic class. After you have classified the traffic, you can create policy maps to enforce policy actions for the identified traffic. The control-plane global configuration command allows you to directly attach a CoPP service policy to the control plane.

The policy map system-cpp-policy must contain the predefined class maps in the predefined order at the beginning of the policy map. The best way to create system-cpp-policy policy map is by using the global macro system-cpp.

The system-cpp-policy policy map contains the predefined class maps for the control plane traffic. The names of all system-defined CoPP class maps and their matching ACLs contain the prefix system-cpp-. By default, no action is specified for each traffic class. You can define your own class maps matching CPU-bound data plane and management plane traffic. You can also add your defined class maps to system-cpp-policy.

General Guidelines for Control Plane Policing

Guidelines for control plane policing include the following:

Port security might cancel the effect of CoPP for non-IP control packets.

Although source MAC learning on a Catalyst 4500 series switch is performed in software, learning control packets' source MAC addresses (for example, IEEE BPDU, CDP, SSTP BPDU, GARP/) is not allowed. Once you configure port security on a port where you expect a high rate of potentially unanticipated control packets, the system generates a copy of the packet to the CPU (until the source address is learned), instead of forward it.

The current architecture of the Catalyst 4500 supervisor engine does not allow you to apply policing on the copy of packets sent to the CPU. You can only apply policing on packets that are forwarded to the CPU. Copies of packets are sent to the CPU at the same rate as control packets, and port security is not triggered because learning from control packets is not allowed. Policing is not applied because the packet copy, not the original, is sent to the CPU.

Only ingress CoPP is supported. So only input keyword is supported in control-plane related CLIs.

Use ACLs and class-maps to identify data plane and management plane traffic that are handled by CPU.

The only action supported in CoPP policy-map is police.

Do not use the log keyword in the CoPP policy ACLs.

Default Configuration

CoPP is disabled by default.

Configuring CoPP for Control Plane Traffic

To configure CoPP for control plane traffic, perform this task:

Command

Purpose

Step 1

Switch# config terminal

Enters global configuration mode.

Step 2

Switch(config)# qos

(Optional) Enables QoS globally.

Step 3

Switch(config)# macro global apply system-cpp

(Optional) Creates the system-cpp-policy policy map and attaches it to the control plane.

deny —Sets the conditions under which a packet does not pass a name ACL

Note You must configure ACLs in most cases to identify the important or unimportant traffic.

type-code— 16-bit hexadecimal number written with a leading 0x; for example, 0x6000. Specify either a Link Service Access Point (LSAP) type code for 802-encapsulated packets or a SNAP type code for SNAP-encapsulated packets. (LSAP, sometimes called SAP, refers to the type codes found in the DSAP and SSAP fields of the 802 header.)

wild-mask —16-bit hexadecimal number whose ones bits correspond to bits in the type-code argument. The wild-mask indicates which bits in the type-code argument should be ignored when making a comparison. (A mask for a DSAP/SSAP pair should always be 0x0101 because these two bits are used for purposes other than identifying the SAP code.)

address —48-bit Token Ring address written as a dotted triple of four-digit hexadecimal numbers. This field is used for filtering by vendor code.

mask— 48-bit Token Ring address written as a dotted triple of four-digit hexadecimal numbers. The ones bits in the mask are the bits to be ignored in address. This field is used for filtering by vendor code.

Adds the traffic classes to the CoPP policy map. Uses the police statement to associate actions to the traffic class.

Step 7

Switch(config)#
end

Returns to privileged EXEC mode.

Step 8

Switch#
show policy-map system-cpp-policy

Verifies your entries.

The following example shows how to configure trusted hosts with source addresses 10.1.1.1 and 10.1.1.2 to forward Telnet packets to the control plane without constraint, while allowing all remaining Telnet packets to be policed at the specific rate. This example assumes that global QoS is enabled and that the system-cpp-policy policy map was created.

Control Plane Policing Configuration Guidelines and Restrictions

When using (or configuring) control plane policing, consider these guidelines and restrictions:

Only ingress CoPP is supported. Only the input keyword is supported in control plane-related CLIs.

Control plane traffic can be policed only through CoPP. Traffic cannot be policed at the input interface or VLAN even though a policy map containing the control plane traffic is accepted when the policy map is attached to an interface or VLAN.

Use ACLs and class maps to identify data plane and management plane traffic that are handled by the CPU. U1ser defined class maps should be added to the system-cpp-policy policy map for CoPP.

The default system-cpp-policy policy map does not define actions for the system-defined class maps (no policing).

The only action supported in system-cpp-policy is police.

You can use both MAC and IP ACLs to define data plane and management plane traffic classes. However, if a packet also matches a predefined ACL for the control plane traffic, a police (or no police) action will operate on the control plane class because the control plane classes appear above the user-defined classes in the service policy.

The exceeding action policed-dscp-transmit is not supported for CoPP.

Do not use the log keyword in CoPP policy ACLs. Instead, if you want to determine if rogue packets are arriving, view the output of the show policy-map interface command or use the span feature.

To police control plane traffic, use the system-defined class maps.

System-defined class maps cannot be used in policy maps for regular QoS.

The policy map named system-cpp-policy is dedicated for CoPP.

CoPP is not enabled unless global QoS is enabled and a police action is specified.

Monitoring CoPP

You can enter the show policy-map control-plane command to develop site-specific policies, to monitor statistics for the control plane policy, and to troubleshoot CoPP. This command displays dynamic information about the actual policy applied, including rate information and the number of bytes (and packets) that conformed or exceeded the configured policies both in hardware and in software.

The output of the show policy-map control-plane command is similar to the following:

Understanding Layer 2 Control Packet QoS

You might want to police incoming Layer 2 control packets such as STP, CDP, VTP, SSTP, BPDU, EAPOL and LLDP on a specific port before the packets reach CPU. This could serve as a first line of defense before aggregate traffic is subjected to policing (through CoPP). By default, policers cannot be applied to Layer 2 control packets in the input direction. This prevents users from inadvertently policing or dropping critical Layer 2 control packets.

While this approach protects a user who is wrongly policing control packets, it introduces a more serious problem. If a flood of Layer 2 control packets is received on any of the switch interfaces at a very high rate due to a DoS attack or to a loop introduced in the customer network because of misconfiguration, CPU utilization can increase quickly. This can have adverse impacts such as loss of protocol keep-alives and routing protocol updates. The Layer 2 control packet QoS feature allows you to police Layer 2 control packets at the port, VLAN, or port- VLAN level in the input direction.

Note When all control packets (CDP/VTP, bpdu-range, SSTP, LLDP, and protocol-tunnel), are enabled only qos control-packets is nevgen’d. Individual protocol names mentioned in the previous output are nvegen’d only if the some of the control packets are configured.

Note When you unconfigure this feature for a specified protocol type, the user-configured policies handling that protocol type immediately become ineffective. To save TCAM resources, remove the policies as well as MACLs and class maps (auto-generated or user-defined).

Note TCAM resources are not consumed when the interface is in a down state.

Table 45-2 displays the auto-generated MACLs and class maps that are created when you enable the feature on the corresponding packet type.

Table 45-2 Packet Types and Auto-Generated MACL/Class Maps

Packet Type

Auto-Generated MACL/Class Map

BPDU-range

mac access-list extended system-control-packet-bpdu-range

permit any 0180.c200.0000 0000.0000.000c

class-map match-any system-control-packet-bpdu-range

match access-group name system-control-packet-bpdu-range

SSTP

mac access-list extended system-control-packet-sstp

permit any host 0100.0ccc.cccd

class-map match-any system-control-packet-sstp

match access-group name system-control-packet-sstp

CDP-VTP

mac access-list extended system-control-packet-cdp-vtp

permit any host 0100.0ccc.cccc

class-map match-any system-control-packet-cdp-vtp

match access-group name system-control-packet-cdp-vtp

EAPOL

mac access-list extended system-control-packet-eapol

permit any any 0x888E

class-map match-any system-control-packet-eapol

match access-group name system-control-packet-eapol

LLDP

mac access-list extended system-control-packet-lldp

permit any host 0180.c200.000e

class-map match-any system-control-packet-lldp

match access-group name system-control-packet-lldp

PROTOCOL TUNNEL

mac access-list extended system-control-packet-protocol-tunnel

permit any host 0100.0ccd.cdd0

class-map match-any system-control-packet-protocol-tunnel

match access-group name system-control-packet-protocol-tunnel

Layer 2 Control Packet QoS Configuration Examples

You can use CoPP and Layer 2 control packet QoS together to prevent DoS attacks to the CPU. In the following example, BPDUs arriving on interface gi3/1, VLAN 1 and VLAN 2 are limited to 32 Kbps and 34 Kbps, respectively. Aggregate BPDU traffic to CPU then is further rate-limited to 50 Kbps using CoPP.

Note To reduce the consumption of policer resources, you can also use named-aggregate policers applied to a group of ports or VLANs.

Note Do not modify class maps and MACLs that are auto-generated by the system. This action can cause unexpected behavior when the switch reloads or when the running configuration is updated from a file.

For example, the following are valid user-defined class map names to police Layer 2 control packets because they begin with the prefix system-control-packet:

system-control-packet-bpdu1system-control-packet-control-packet

No such restrictions exist on the names you can use for user-defined MACLs (access-groups).

The following example shows how to create user-defined MACLs and class maps to identify EAPOL and BPDU packets. Because the auto-generated class map system-control-packet-bpdu range matches three packet types (BPDU, EAPOL, and OAM), policing this traffic class affects all three packet types. To police BPDU and EAPOL packets at different rates, you can set user-defined MACL and class map as follows:

Layer 2 Control Packet QoS Guidelines and Restrictions

When using (or configuring) Layer 2 control packet QoS, consider these guidelines and restrictions:

When you enable Layer 2 control packet QoS, it applies to all ports on the switch. If Layer 2 control packets are not explicitly classified in the policy attached to port or VLAN, the actions in class-default will be applied as per normal QoS rules.

Place classifiers that match control packets at the beginning of a policy map followed by other traffic classes, ensuring that Layer 2 control packets are not subjected to inadvertent QoS actions.

Actions associated with class-default are applied on unmatched control packets.

If you enable the feature on a BPDU range, EAPOL packets are policed only after the initial 802.1X authentication phase completes.

Policing IPv6 Control Traffic

IPv6 control packets such as OSPF, PIM and MLD can be policed on a physical port, VLAN, or control plane by configuring IPv6 ACLs to classify such traffic and then applying a QoS policy to police such traffic.

The following examples show how to police OSPFv6, PIMv6 and MLD control traffic received on a port.

This example shows how to configure a traffic class to identify OSPFv6 control packets by its destination IP v6 address: