The traffic-mirror command configures ACL-based flow mirroring on an interface.
The undo traffic-mirror command cancels ACL-based flow mirroring on an interface.
By default, ACL-based flow mirroring is not configured on an interface.
To configure a single ACL, use the following command:
traffic-mirror inbound { acl { [ ipv6 ] { bas-acl | adv-acl | name acl-name } | l2-acl | user-acl } } [ rule rule-id ] to observe-port o-index
undo traffic-mirror inbound { acl { [ ipv6 ] { bas-acl | adv-acl | name acl-name } | l2-acl | user-acl } } [ rule rule-id ]
If both Layer 2 ACLs and Layer 3 ACLs are configured, use the following command:
traffic-mirror inbound acl l2-acl [ rule rule-id ] acl { bas-acl | adv-acl | name acl-name } [ rule rule-id ] to observe-port o-index
undo traffic-mirror inbound acl l2-acl [ rule rule-id ] acl { bas-acl | adv-acl | name acl-name } [ rule rule-id ]
traffic-mirror inbound acl name acl-name [ rule rule-id ] acl { bas-acl | adv-acl | l2-acl | name acl-name } [ rule rule-id ] to observe-port o-index
undo traffic-mirror inbound acl name acl-name [ rule rule-id ] acl { bas-acl | adv-acl | l2-acl | name acl-name } [ rule rule-id ]
traffic-mirror inbound acl { bas-acl | adv-acl } [ rule rule-id ] acl { l2-acl | name acl-name } [ rule rule-id ] to observe-port o-index
undo traffic-mirror inbound acl { bas-acl | adv-acl } [ rule rule-id ] acl { l2-acl | name acl-name } [ rule rule-id ]
VLANIF interface view, Ethernet interface view, MultiGE interface view, GE interface view, XGE interface view, 25GE interface view, 40GE interface view, 100GE interface view, Eth-Trunk interface view, port group view
Usage Scenario
After the traffic-mirror command is configured, the device can perform flow mirroring or remote flow mirroring, without affecting traffic forwarding.
Prerequisites
An observing port has been created through the observe-port (local mirroring) or observe-port (remote mirroring) command.
Precautions
If name acl-name is specified in the command, you need to run the acl name or acl ipv6 name command to create the corresponding ACL. Otherwise, the ACL-based simplified traffic policy fails to be configured.
If rule rule-id is specified in the command, you need to create an ACL and configure the corresponding rule. Otherwise, the ACL-based simplified traffic policy fails to be configured.
Only the S5720-EI, S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720-HI, S6720S-EI, S6730-H, S6730S-H, S6730-S, and S6730S-S support ACL-based simplified traffic policy configuration on a VLANIF interface.
The VLAN corresponding to the VLANIF interface cannot be a Super-VLAN or MUX VLAN.
For the S5720-EI, S6720-EI, and S6720S-EI, an ACL-based simplified traffic policy that is applied to a VLANIF interface is only valid for unicast packets and Layer 3 multicast packets on the VLANIF interface.
For the S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-HI, S6730-H, S6730S-H, S6730-S, and S6730S-S, an ACL-based simplified traffic policy that is applied to a VLANIF interface is only valid for unicast packets on the VLANIF interface.
If the traffic-mirror (system view) and traffic-mirror (interface view) commands are used simultaneously, the traffic-mirror (interface view) command takes effect.
# Configure ACL-based flow mirroring in the inbound direction on GE0/0/1, and mirror the packets matching ACL 3000 to the observing port with the index of 1.
<HUAWEI> system-view [HUAWEI] observe-port 1 interface gigabitethernet 0/0/1 [HUAWEI] interface gigabitethernet 0/0/1 [HUAWEI-GigabitEthernet0/0/1] traffic-mirror inbound acl 3000 to observe-port 1