< Home

if-match l2-protocol

Function

The if-match l2-protocol command configures a matching rule based on the Layer 2 protocol type in a traffic classifier.

The undo if-match l2-protocol command deletes a matching rule based on the Layer 2 protocol type in a traffic classifier.

By default, a matching rule based on the Layer 2 protocol type is not configured in a traffic classifier.

Format

if-match l2-protocol { arp | ip | mpls | rarp | protocol-value }

undo if-match l2-protocol

Parameters

Parameter

Description

Value

arp

Indicates that ARP packets are classified.

The value of arp corresponds to 0x0806.

ip

Indicates that IP packets are classified.

The value of ip corresponds to 0x0800.

mpls

Indicates that MPLS packets are classified.

The value of mpls corresponds to 0x8847.

rarp

Indicates that RARP packets are classified.

The value of rarp corresponds to 0x8035.

protocol-value

Specifies the value of a protocol type.

The value ranges from 0x0000 to 0xFFFF in hexadecimal notation and must start with 0x.

If the value of protocol-value is smaller than 0x0600, the Destination Service Access Point (DSAP) and Source Service Access Point (SSAP) fields in the Logical Line Control (LLC) protocol packets are matched.

Views

Traffic classifier view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

You can run the if-match l2-protocol command to classify packets based on the Layer 2 protocol type so that the device processes packets matching the same traffic classifier in the same manner.

Prerequisites

A traffic classifier has been created using the traffic classifier command in the system view.

Precautions

The device supports Layer 2 protocols including ARP, IP, MPLS, and RARP.

If you run the if-match l2-protocol command in the same traffic classifier view multiple times, only the latest configuration takes effect.

If the relationship between rules in a traffic classifier is AND, and both the if-match l2-protocol arp and if-match protocol { ip | ipv6 } commands are configured in this traffic classifier, of the two, only the if-match l2-protocol arp command takes effect.

On the S5735-L, S5735S-L, S5735S-L-M, S5735-S, S5735-S-I, and S5735S-S, if a traffic policy is applied to the outbound direction and the relationship between rules in a traffic classifier is AND:
  • Rules for matching the source IPv6 address and those for matching destination IPv6 address cannot be configured in the same traffic classifier.
  • Rules for matching IPv6 information (for example, if-match protocol ipv6 and if-match ipv6 acl) and those for matching the source MAC address, destination MAC address, source IPv6 address, or destination IPv6 address of packets cannot be configured in the same traffic classifier. (ACL6 rules can be used to match the source or destination IPv6 address of packets.)
  • Rules for matching IPv4 information (IP address and UDP port number) and those for matching some Layer 2 information (for example, if-match source-mac, if-match destination-mac, and if-match l2-protocol { mpls | rarp | protocol-value }) cannot be configured in the same traffic classifier.

Example

# Define a matching rule based on the protocol type of ARP in the traffic classifier c1.

<HUAWEI> system-view
[HUAWEI] traffic classifier c1 operator and
[HUAWEI-classifier-c1] if-match l2-protocol arp
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >