- Table of Contents
-
- 21-Network Management and Monitoring Command Reference
- 00-Preface
- 01-Ping and tracert commands
- 02-System debugging commands
- 03-NQA commands
- 04-iNQA commands
- 05-NTP commands
- 06-SNMP commands
- 07-RMON commands
- 08-Event MIB commands
- 09-CWMP commands
- 10-Sampler commands
- 11-Mirroring commands
- 12-NetStream commands
- 13-IPv6 NetStream commands
- 14-Cloud connection commands
- 15-Packet capture commands
- 16-sFlow commands
- 17-IP traffic statistics collection commands
- Related Documents
-
Title | Size | Download |
---|---|---|
11-Mirroring commands | 93.37 KB |
mirroring-group mirroring-port (interface view)
mirroring-group mirroring-port (system view)
mirroring-group monitor-port (interface view)
mirroring-group monitor-port (system view)
Port mirroring commands
display mirroring-group
Use display mirroring-group to display mirroring group information.
Syntax
display mirroring-group { group-id | all | local }
Views
Any view
Predefined user roles
network-admin
network-operator
Parameters
group-id: Specifies a mirroring group by its ID. The value range for this argument is 1 to 6.
all: Specifies all mirroring groups.
local: Specifies local mirroring groups.
Usage guidelines
Mirroring group information includes the type, status, and content of a mirroring group. It is sorted by mirroring group number.
Examples
# Display information about all mirroring groups.
<Sysname> display mirroring-group all
Mirroring group 1:
Type: Local
Status: Active
Mirroring port: GigabitEthernet1/0/1 Inbound
Monitor port: GigabitEthernet1/0/2
Mirroring group 2:
Type: Local
Status: Active
Mirroring port: GigabitEthernet1/0/1 Inbound
Monitor port: GigabitEthernet1/0/2
Table 1 Command output
Field |
Description |
Mirroring group |
Number of the mirroring group. |
Type |
Type of the mirroring group: Local. |
Status |
Status of the mirroring group: · Active—The mirroring group has taken effect. · Incomplete—The mirroring group configuration is not complete and does not take effect. |
Mirroring port |
Source port. |
Monitor port |
Destination port. |
mirroring-group
Use mirroring-group to create a mirroring group.
Use undo mirroring-group to delete mirroring groups.
Syntax
mirroring-group group-id local
undo mirroring-group { group-id | all | local }
Default
No mirroring groups exist.
Views
System view
Predefined user roles
network-admin
Parameters
group-id: Specifies a mirroring group ID. The value range for this argument is 1 to 6.
local: Specifies local mirroring groups.
all: Specifies all mirroring groups.
Examples
# Create local mirroring group 1.
<Sysname> system-view
[Sysname] mirroring-group 1 local
mirroring-group mirroring-port (interface view)
Use mirroring-group mirroring-port to configure a port as a source port for a mirroring group.
Use undo mirroring-group mirroring-port to restore the default.
Syntax
mirroring-group group-id mirroring-port { both | inbound | outbound }
undo mirroring-group group-id mirroring-port
Default
A port does not act as a source port for any mirroring groups.
Views
Interface view
Predefined user roles
network-admin
Parameters
group-id: Specifies a mirroring group by its ID. The value range for this argument is 1 to 6.
both: Mirrors both received and sent packets.
inbound: Mirrors only received packets.
outbound: Mirrors only sent packets.
Usage guidelines
A source port cannot be used as a monitor port.
Examples
# Create local mirroring group 1 to monitor the bidirectional traffic of the port GigabitEthernet 1/0/1.
<Sysname> system-view
[Sysname] mirroring-group 1 local
[Sysname] interface gigabitethernet 1/0/1
[Sysname-GigabitEthernet1/0/1] mirroring-group 1 mirroring-port both
Related commands
mirroring-group
mirroring-group mirroring-port (system view)
Use mirroring-group mirroring-port to configure source ports for a mirroring group.
Use undo mirroring-group mirroring-port to remove source ports from a mirroring group.
Syntax
mirroring-group group-id mirroring-port interface-list { both | inbound | outbound }
undo mirroring-group group-id mirroring-port interface-list
Default
No source port is configured for a mirroring group.
Views
System view
Predefined user roles
network-admin
Parameters
group-id: Specifies a mirroring group by its ID. The value range for this argument is 1 to 6.
interface-list: Specifies a space-separated list of up to eight interface items. Each item specifies an interface by its type and number or specifies a range of interfaces in the form of interface-type interface-number1 to interface-type interface-number2. When you specify a range of interfaces, the interfaces must be of the same type and on the same slot. The start interface number must be identical to or lower than the end interface number.
both: Mirrors both received and sent packets.
inbound: Mirrors only received packets.
outbound: Mirrors only sent packets.
Usage guidelines
A source port cannot be used as a monitor port.
Examples
# Create local mirroring group 1 to monitor the bidirectional traffic of GigabitEthernet 1/0/1.
<Sysname> system-view
[Sysname] mirroring-group 1 local
[Sysname] mirroring-group 1 mirroring-port gigabitethernet 1/0/1 both
# Create remote source group 2 to monitor the bidirectional traffic of GigabitEthernet 1/0/2.
<Sysname> system-view
[Sysname] mirroring-group 2 remote-source
[Sysname] mirroring-group 2 mirroring-port gigabitethernet 1/0/2 both
mirroring-group
mirroring-group monitor-port (interface view)
Use mirroring-group monitor-port to configure a port as the monitor port for a mirroring group.
Use undo mirroring-group monitor-port to restore the default.
Syntax
mirroring-group group-id monitor-port
undo mirroring-group group-id monitor-port
Default
A port does not act as the monitor port for any mirroring groups.
Views
Interface view
Predefined user roles
network-admin
Parameters
group-id: Specifies a mirroring group by its ID. The value range for this argument is 1 to 6.
Usage guidelines
An aggregation member port cannot be configured as the monitor port.
Use a monitor port only for port mirroring, so the data monitoring device receives and analyzes only the mirrored traffic.
The member port of an existing mirroring group cannot be configured as a monitor port.
Examples
# Create local mirroring group 1 and configure GigabitEthernet 1/0/1 as its monitor port.
<Sysname> system-view
[Sysname] mirroring-group 1 local
[Sysname] interface gigabitethernet 1/0/1
[Sysname-GigabitEthernet1/0/1] mirroring-group 1 monitor-port
Related commands
mirroring-group
mirroring-group monitor-port (system view)
Use mirroring-group monitor-port to configure the monitor ports for a mirroring group.
Use undo mirroring-group monitor-port to remove the monitor ports from a mirroring group.
Syntax
mirroring-group group-id monitor-port interface-type interface-number
undo mirroring-group group-id monitor-port interface-list
Default
No monitor port is configured for a mirroring group.
Views
System view
Predefined user roles
network-admin
Parameters
group-id: Specifies a mirroring group by its ID. The value range for this argument varies by device model.
interface-type interface-number: Specifies an interface by its type and number.
Usage guidelines
An aggregation member port cannot be configured as the monitor port.
Use a monitor port only for port mirroring, so the data monitoring device receives only the mirrored traffic.
The member port of an existing mirroring group cannot be configured as a monitor port.
Examples
# Create local mirroring group 1 and configure GigabitEthernet 1/0/1 as its monitor port.
<Sysname> system-view
[Sysname] mirroring-group 1 local
[Sysname] mirroring-group 1 monitor-port gigabitethernet 1/0/1
Related commands
mirroring-group
Flow mirroring commands
mirror-to interface
Use mirror-to interface to configure a mirroring action that mirrors traffic to an interface.
Use undo mirror-to interface to delete a mirroring action that mirrors traffic to an interface.
Syntax
Syntax I
mirror-to interface interface-type interface-number [ { destination-ip destination-ip-address source-ip source-ip-address | destination-ipv6 destination-ipv6-address source-ipv6 source-ipv6-address } [ dscp dscp-value | erspan-id erspan-id-value | vlan vlan-id | vrf-instance vrf-instance-name ] * ] [ destination-mac mac-address ] ]
undo mirror-to interface interface-type interface-number
Syntax II
mirror-to interface { destination-ip destination-ip-address source-ip source-ip-address | destination-ipv6 destination-ipv6-address source-ipv6 source-ipv6-address } [ dscp dscp-value | erspan-id erspan-id-value | vlan vlan-id | vrf-instance vrf-name ] * [ destination-mac mac-address ]
undo mirror-to interface { destination-ip destination-ip-address source-ip source-ip-address | destination-ipv6 destination-ipv6-address source-ipv6 source-ipv6-address }
Default
No mirroring actions exist to mirror traffic to interfaces.
Views
Traffic behavior view
Predefined user roles
network-admin
Parameters
interface-type interface-number: Specifies an interface by its type and number.
destination-ip destination-ip-address: Specifies the destination IP address for the mirrored packets.
source-ip source-ip-address: Specifies the source IP address for the mirrored packets.
destination-ipv6 destination-ipv6-address: Specifies the destination IPv6 address for the mirrored packets.
source-ipv6 source-ipv6-address: Specifies the source IPv6 address for the mirrored packets.
dscp dscp-value: Specifies the DSCP value for the mirrored packets. The dscp-value argument can be a number in the range of 0 to 63 or a keyword in Table 2.
Table 2 DSCP keywords and values
Keyword |
DSCP value in binary |
DSCP value in decimal |
af11 |
001010 |
10 |
af12 |
001100 |
12 |
af13 |
001110 |
14 |
af21 |
010010 |
18 |
af22 |
010100 |
20 |
af23 |
010110 |
22 |
af31 |
011010 |
26 |
af32 |
011100 |
28 |
af33 |
011110 |
30 |
af41 |
100010 |
34 |
af42 |
100100 |
36 |
af43 |
100110 |
38 |
cs1 |
001000 |
8 |
cs2 |
010000 |
16 |
cs3 |
011000 |
24 |
cs4 |
100000 |
32 |
cs5 |
101000 |
40 |
cs6 |
110000 |
48 |
cs7 |
111000 |
56 |
default |
000000 |
0 |
ef |
101110 |
46 |
erspan-id erspan-id-value: Specifies the ERSPAN ID for the mirrored packets in the range of 1 to 1023.
vlan vlan-id: Specifies a VLAN by its VLAN ID in the range of 1 to 4094 for the mirrored packets.
vrf-instance vrf-instance-name: Specifies a VPN instance by its name, a case-sensitive string of 1 to 31 characters. The mirrored packets will be forwarded based on the routing table of the specified VPN instance.
destination-mac mac-address: Specifies the destination MAC address for mirrored packets sent to the interface. The mac-address argument is in the format of H-H-H. If you do not specify this option, the device uses the destination IP address to dynamically get the destination MAC address for the mirrored packets.
strip-vlan vlan-id: Specifies a VLAN where mirrored packets are broadcast by its ID in the range of 1 to 4094.
Usage guidelines
You can execute this command multiple times for a traffic behavior to mirror traffic to different interfaces.
If you use syntax I, traffic is mirrored to the specified interface.
If you use syntax II, traffic is processed as follows:
1. The device encapsulates the traffic with the specified parameters.
2. The device looks up the source IP address and destination IP address of the traffic in the routing table and forwards the traffic based on the matching route. The outgoing interface of the route is the destination interface of the mirrored traffic.
Through configuring load sharing in the routing protocols, you can specify multiple destination interfaces for the mirrored traffic. When the current mirroring destination interface fails, the mirrored traffic is forwarded to the outgoing interface re-calculated by the routing protocols.
Examples
# Create traffic behavior 1 and configure the action of mirroring traffic to GigabitEthernet 1/0/1 for the traffic behavior.
<Sysname> system-view
[Sysname] traffic behavior 1
[Sysname-behavior-1] mirror-to interface gigabitethernet 1/0/1
# Create traffic behavior 1, and configure the action of mirroring traffic to GigabitEthernet 1/0/1 for the traffic behavior. Specify the following parameters for the mirrored packets sent to GigabitEthernet 1/0/1:
· Specify 1.1.1.1 and 2.2.2.2 as the destination address and source address, respectively.
· Specify 20, 100, and vpn1 as the DSCP value, VLAN, and the VPN instance name, respectively.
<Sysname> system-view
[Sysname] traffic behavior 1
[Sysname-behavior-1] mirror-to interface gigabitethernet 1/0/1 destination-ip 1.1.1.1 source-ip 2.2.2.2 dscp 20 vlan 100 vrf-instance vpn1
# Create behavior 1, and configure the action of mirroring traffic to an interface as follows:
· Configure the action to truncate mirrored packets.
· Encapsulate the mirrored traffic with destination IP address 1.1.1.1 and source IP address 2.2.2.2.
<Sysname> system-view
[Sysname] traffic behavior 1
[Sysname-behavior-1] mirror-to interface truncation destination-ip 1.1.1.1 source-ip 2.2.2.2