DiffServ Class Commands

Use these commands to define DiffServ traffic classification.

Use the DiffServ class commands to define traffic classification. To classify traffic, you specify Behavior Aggregate (BA), based on DSCP and Multi-Field (MF) classes of traffic (name, match criteria).

This set of commands consists of class creation/deletion and matching, with the class match commands specifying Layer 3, Layer 2, and general match criteria. The class match criteria are also known as class rules, with a class definition consisting of one or more rules to identify the traffic that belongs to the class.

Note: After you create a class match criterion for a class, you cannot change or delete the criterion. To change or delete a class match criterion, you must delete and re-create the entire class.

The CLI command root is class-map.

class-map

M4250

M4350

This command defines a DiffServ class of type match-any or match-all. For the class type of match-all, when used without any match condition, this command enters the Class-Map Config mode.

The class-map-name is a case sensitive alphanumeric string from 1 to 31 characters uniquely identifying an existing DiffServ class. The class-map-name “default” is reserved.

The class type of match-all indicates all of the individual match conditions must be true for a packet to be considered a member of the class. This command may be used without specifying a class type to enter the Class-Map Config mode for an existing DiffServ class.

For the class type of match-all, the optional keywords ipv4 and ipv6 specify the Layer 3 protocol for this class. If not specified, this parameter defaults to IPv4. This maintains backward compatibility for configurations defined on systems before IPv6 match items were supported. The CLI mode is changed to Class-Map Config or IPv6-Class-Map Config when this command is successfully executed depending on whether you specify the ipv4 or ipv6 keyword.

For the class type of match-any, the CLI mode is changed to Class-Map Config when this command is successfully executed.

Format class-map {match-any class-map-name | match-all class-map-name [ipv4 | ipv6]}
Mode Global Config

no class-map

This command eliminates an existing DiffServ class. The class-map-name is the name of an existing DiffServ class. (The class name default is reserved and is not allowed here.) This command may be issued at any time; if the class is currently referenced by one or more policies or by any other class, the delete action fails.

Format no class-map class-map-name
Mode Global Config

class-map rename

M4250

M4350

This command changes the name of a DiffServ class. The class-map-name parameter is the name of an existing DiffServ class. The new-class-map-name parameter is a case-sensitive alphanumeric string from 1 to 31 characters uniquely identifying the class.

Default none
Format class-map rename class-map-name new-class-map-name
Mode Global Config

match ethertype

M4250

M4350

This command adds to the specified class definition a match condition based on the value of the ethertype. The ethertype value is specified as a keyword argument that can be one of the following types: appletalk, arp, ibmsna, ipv4, ipv6, ipx, mplsmcast, mplsucast, netbios, novell, pppoe, or rarp or as a range argument that represents an EtherType value in the range of 0x0600-0xFFFF.

Format match ethertype {keyword | custom range}
Mode

Class-Map Config

Ipv6-Class-Map Config

match any

M4250

M4350

This command adds to the specified class definition a match condition whereby all packets are considered to belong to the class.

Default none
Format match any
Mode

Class-Map Config

Ipv6-Class-Map Config

match class-map

M4250

M4350

This command adds to the specified class definition the set of match conditions defined for another class. The refclassname is the name of an existing DiffServ class whose match conditions are being referenced by the specified class definition.

Default none
Format match class-map refclassname
Mode

Class-Map Config

Ipv6-Class-Map Config

The requirements for the match class-map command are as follows:

  • The parameters refclassname and class-map-name cannot be the same.
  • Only one other class may be referenced by a class.
  • Any attempts to delete the refclassname class while the class is still referenced by any class-map-name fail.
  • The combined match criteria of class-map-name and refclassname must be an allowed combination based on the class type.
  • Any subsequent changes to the refclassname class match criteria must maintain this validity, or the change attempt fails.
  • The total number of class rules formed by the complete reference class chain (including both predecessor and successor classes) must not exceed a platform-specific maximum. In some cases, each removal of a refclass rule reduces the maximum number of available rules in the class definition by one.

no match class-map

This command removes from the specified class definition the set of match conditions defined for another class. The refclassname is the name of an existing DiffServ class whose match conditions are being referenced by the specified class definition.

Format no match class-map refclassname
Mode

Class-Map Config

Ipv6-Class-Map Config

match cos

M4250

M4350

This command adds to the specified class definition a match condition for the Class of Service value (the only tag in a single tagged packet or the first or outer 802.1Q tag of a double VLAN tagged packet). The value argument can be from 0 to 7.

Default none
Format match cos value
Mode

Class-Map Config

Ipv6-Class-Map Config

match secondary-cos

M4250

M4350

This command adds to the specified class definition a match condition for the secondary Class of Service value (the inner 802.1Q tag of a double VLAN tagged packet).

The value argument can be from 0 to 7.

Default none
Format match secondary-cos value
Mode

Class-Map Config

Ipv6-Class-Map Config

match destination-address mac

M4250

M4350

This command adds to the specified class definition a match condition based on the destination MAC address of a packet. The macaddr parameter is any layer 2 MAC address formatted as six, two-digit hexadecimal numbers separated by colons (e.g., 00:11:22:dd:ee:ff). The macmask parameter is a layer 2 MAC address bit mask, which need not be contiguous, and is formatted as six, two-digit hexadecimal numbers separated by colons (e.g., ff:07:23:ff:fe:dc).

Default none
Format match destination-address mac macaddr macmask
Mode

Class-Map Config

Ipv6-Class-Map Config

match dstip

M4250

M4350

This command adds to the specified class definition a match condition based on the destination IP address of a packet. The ipaddr parameter specifies an IP address. The ipmask parameter specifies an IP address bit mask and must consist of a contiguous set of leading 1 bits.

Default none
Format match dstip ipaddr ipmask
Mode Class-Map Config

match dstip6

M4250

M4350

This command adds to the specified class definition a match condition based on the destination IPv6 address of a packet.

Default none
Format match dstip6 destination-ipv6-prefix/prefix-length
Mode Ipv6-Class-Map Config

match dstl4port

M4250

M4350

This command adds to the specified class definition a match condition based on the destination layer 4 port of a packet using a single keyword or numeric notation. To specify the match condition as a single keyword, the value for portkey is one of the supported port name keywords. The portkey argument can be: domain, echo, ftp, ftpdata, http, smtp, snmp, telnet, tftp, or www. Each of these translates into its equivalent port number. To specify the match condition using a numeric notation, one layer 4 port number is required. The port-number argument is an integer from 0 to 65535.

Default none
Format match dstl4port {portkey | port-number}
Mode

Class-Map Config

Ipv6-Class-Map Config

match ip dscp

M4250

M4350

This command adds to the specified class definition a match condition based on the value of the IP DiffServ Code Point (DSCP) field in a packet, which is defined as the high-order six bits of the Service Type octet in the IP header (the low-order two bits are not checked).

The dscpval value is specified as either an integer from 0 to 63, or symbolically through one of the following keywords: af11, af12, af13, af21, af22, af23, af31, af32, af33, af41, af42, af43, be, cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, or ef.

Note: The IP DSCP, IP Precedence, and IP ToS match conditions are alternative ways to specify a match criterion for the same Service Type field in the IP header, but with a slightly different user notation.
Default none
Format match ip dscp dscpval
Mode

Class-Map Config

Ipv6-Class-Map Config

match ip precedence

M4250

M4350

This command adds to the specified class definition a match condition based on the value of the IP Precedence field in a packet, which is defined as the high-order three bits of the Service Type octet in the IP header (the low-order five bits are not checked). The precedence value argument is an integer from 0 to 7.

Note: The IP DSCP, IP Precedence, and IP ToS match conditions are alternative ways to specify a match criterion for the same Service Type field in the IP header, but with a slightly different user notation.
Default none
Format match ip precedence value
Mode Class-Map Config

match ip tos

M4250

M4350

This command adds to the specified class definition a match condition based on the value of the IP TOS field in a packet, which is defined as all eight bits of the Service Type octet in the IP header. The value of the tosbits argument is a two-digit hexadecimal number from 00 to ff. The value of tosmask argument is a two-digit hexadecimal number from 00 to ff. The tosmask denotes the bit positions in tosbits that are used for comparison against the IP ToS field in a packet. For example, to check for an IP TOS value having bits 7 and 5 set and bit 1 clear, where bit 7 is most significant, use a tosbits value of a0 (hex) and a tosmask of a2 (hex).

Note: The IP DSCP, IP Precedence, and IP ToS match conditions are alternative ways to specify a match criterion for the same Service Type field in the IP header, but with a slightly different user notation.
Note: This free form version of the IP DSCP/Precedence/ToS match specification gives you complete control when specifying which bits of the IP Service Type field are checked.
Default none
Format match ip tos tosbits tosmask
Mode Class-Map Config

match ip6flowlbl

M4250

M4350

Use this command to enter an IPv6 flow label value. The value argument can be in the range of 0–1048575.

Default none
Format match ip6flowlbl label value
Mode IPv6-Class-Map Config

match protocol

M4250

M4350

This command adds to the specified class definition a match condition based on the value of the IP Protocol field in a packet using a single keyword notation or a numeric value notation.

To specify the match condition using a single keyword notation, the value for protocol-name is one of the supported protocol name keywords.

For IPv4, the supported options are icmp, igmp, ip, tcp, udp, and gre. A value of ip matches all protocol number values.

For IPv6, the supported options are ipv6, icmpv6, tcp, and udp.

To specify the match condition using a numeric value notation, the protocol number argument is a standard value assigned by IANA and is interpreted as an integer from 0 to 255.

Note: This command does not validate the protocol number value against the current list defined by IANA.
Default none
Format match protocol {protocol-name | number | none}
Mode

Class-Map Config

Ipv6-Class-Map Config

match source-address mac

M4250

M4350

This command adds to the specified class definition a match condition based on the source MAC address of a packet. The address parameter is any layer 2 MAC address formatted as six, two-digit hexadecimal numbers separated by colons (e.g., 00:11:22:dd:ee:ff). The macmask parameter is a layer 2 MAC address bit mask, which may not be contiguous, and is formatted as six, two-digit hexadecimal numbers separated by colons (that is, ff:07:23:ff:fe:dc).

Default none
Format match source-address mac address macmask
Mode

Class-Map Config

Ipv6-Class-Map Config

match srcip

M4250

M4350

This command adds to the specified class definition a match condition based on the source IP address of a packet. The ipaddr parameter specifies an IP address. The ipmask parameter specifies an IP address bit mask and must consist of a contiguous set of leading 1 bits.

Default none
Format match srcip ipaddr ipmask
Mode Class-Map Config

match srcip6

M4250

M4350

This command adds to the specified class definition a match condition based on the source IP address of a packet.

Default none
Format match srcip6 source-ipv6-prefix/prefix-length
Mode Ipv6-Class-Map Config

match srcl4port

M4250

M4350

This command adds to the specified class definition a match condition based on the source layer 4 port of a packet using a single keyword or numeric notation. To specify the match condition as a single keyword notation, the value for portkey is one of the supported port name keywords (listed below). The currently supported portkey values are: domain, echo, ftp, ftpdata, http, smtp, snmp, telnet, tftp, and www. Each of these translates into its equivalent port number, which is used as both the start and end of a port range.

To specify the match condition as a numeric value, one layer 4 port number is required. The port-number argument is an integer from 0 to 65535.

Default none
Format match srcl4port {portkey | port-number}
Mode

Class-Map Config

Ipv6-Class-Map Config

match vlan

M4250

M4350

This command adds to the specified class definition a match condition based on the value of the layer 2 VLAN Identifier field (the only tag in a single tagged packet or the first or outer tag of a double VLAN tagged packet). The vlan-id argument is an integer from 0 to 4093.

Default none
Format match vlan vlan-id
Mode

Class-Map Config

Ipv6-Class-Map Config

match secondary-vlan

M4250

M4350

This command adds to the specified class definition a match condition based on the value of the layer 2 secondary VLAN Identifier field (the inner 802.1Q tag of a double VLAN tagged packet). The secondary vlan-id argument is an integer from 0 to 4093.

Default none
Format match secondary-vlan vlan-id
Mode

Class-Map Config

Ipv6-Class-Map Config