- Table of Contents
-
- 13-Network Management and Monitoring Command Reference
- 00-Preface
- 01-System Maintenance and Debugging Commands
- 02-NQA Commands
- 03-NTP Commands
- 04-Clock Monitoring Commands
- 05-IPC Commands
- 06-SNMP Commands
- 07-RMON Commands
- 08-CWMP Commands
- 09-Sampler Commands
- 10-Mirroring Commands
- 11-Protocol Packet Statistics Commands
- 12-sFlow Commands
- 13-Information Center Commands
- Related Documents
-
Title | Size | Download |
---|---|---|
10-Mirroring Commands | 129.79 KB |
Contents
Port mirroring configuration commands
mirroring-group mirroring-port
mirroring-group mirroring-vlan
mirroring-group reflector-port
mirroring-group remote-probe vlan
Traffic mirroring configuration commands
|
NOTE: The switch operates in IRF or standalone (the default) mode. For more information about the IRF mode, see IRF Configuration Guide. |
display mirroring-group
Syntax
display mirroring-group { group-id | all | local | remote-destination | remote-source } [ | { begin | exclude | include } regular-expression ]
View
Any view
Default level
2: System level
Parameters
group-id: Number of the port mirroring group to be displayed, which ranges from 1 to 64.
all: Displays all port mirroring groups.
local: Displays local mirroring groups.
remote-destination: Displays remote destination mirroring groups.
remote-source: Displays remote source port mirroring groups.
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Description
Use the display mirroring-group command to display information about the specified port mirroring group or groups, such as the types, status, and members of a mirroring group.
The output varies by port mirroring group type and is sorted by mirroring group number.
Examples
# Display information about all the port mirroring groups.
<Sysname> display mirroring-group all
mirroring-group 1:
type: local
status: active
mirroring port:
GigabitEthernet6/0/1 inbound
mirroring VLAN:
1 outbound
monitor port: GigabitEthernet6/0/3
Table 1 Output description
Field |
Description |
mirroring-group |
Number of the mirroring group. |
type |
Type of the mirroring group, which can be one of the following: local, remote-source, or remote-destination. |
status |
Status of the mirroring group, which can be active or inactive |
sampler |
Sampler name. |
mirroring port |
Source port. |
mirroring VLAN |
Source VLAN. |
monitor port |
Destination port. |
reflector port |
Reflector port. |
remote-probe vlan |
Remote probe VLAN. |
mirroring-group
Syntax
mirroring-group group-id { local [ sampler sampler-name ] | remote-destination | remote-source }
undo mirroring-group { group-id | all | local | remote-destination | remote-source }
View
System view
Default level
2: System level
Parameters
group-id: Number of the port mirroring group to be created or removed, ranging from 1 to 64.
all: Removes all port mirroring groups.
local: Creates a local mirroring group or removes all local mirroring groups with the undo command.
sampler sampler-name: Specifies the sampler referenced by a local mirroring group. sampler-name indicates the name of a sampler, a case-insensitive string of 1 to 32 characters. The sampler samples packets and reduces the number of mirrored packets. For more information about the sampler, see Network Management and Configuration Guide.
remote-destination: Creates a remote destination mirroring group or removes all remote destination mirroring groups with the undo command.
remote-source: Creates a remote source mirroring group or removes all remote source mirroring groups with the undo command.
Description
Use the mirroring-group command to create a port mirroring group.
Use the undo mirroring-group command to remove the specified port mirroring group or groups.
By default, no mirroring groups exist on a switch.
To reference a sampler for a local mirroring group, you must first use the sampler command to create a sampler.
Related commands: sampler.
Examples
# Create a local port mirroring group numbered 1.
<Sysname> system-view
[Sysname] mirroring-group 1 local
# Create a fixed sampler with the name abc and the sampling interval 8, which means sampling one out of 28 packets, and then configure local mirroring group 1 to reference this sampler.
<Sysname> system-view
[Sysname] sampler abc mode fixed packet-interval 8
[Sysname] mirroring-group 1 local sampler abc
mirroring-group mirroring-port
Syntax
mirroring-group group-id mirroring-port mirroring-port-list { both | inbound | outbound }
undo mirroring-group group-id mirroring-port mirroring-port-list { both | inbound | outbound }
View
System view
Default level
2: System level
Parameters
group-id: Number of a local or remote source mirroring group, ranging from 1 to 64. The mirroring group must already exist.
mirroring-port-list: A list of ports/port ranges to be assigned to or removed from the port mirroring group specified by group-id. The total number of single ports plus port ranges cannot exceed eight. In the list, a single port takes the form of interface-type interface-number. A port range takes the form interface-type start-interface-number to interface-type end-interface-number, where the end port number must be greater than the start port number.
both: Mirrors both inbound and outbound packets on the specified port(s).
inbound: Mirrors only inbound packets on the specified port(s).
outbound: Mirrors only outbound packets on the specified port(s).
Description
Use the mirroring-group mirroring-port command to assign ports to a local or remote source mirroring group as mirroring ports.
Use the undo mirroring-group mirroring-port command to remove mirroring ports from the mirroring group.
By default, no mirroring port is configured for any mirroring group.
You cannot configure mirroring ports for a remote destination mirroring group.
When removing a mirroring port from a mirroring group, make sure the traffic direction you specified in the undo mirroring-group mirroring-port command matches the actual monitored direction specified earlier in the mirroring-group mirroring-port command.
Related commands: mirroring-group.
Examples
# Create local mirroring group 1, configure GigabitEthernet 4/0/1 as a mirroring port of the mirroring group, and specify that the mirroring group monitor the bidirectional traffic of the port.
<Sysname> system-view
[Sysname] mirroring-group 1 local
[Sysname] mirroring-group 1 mirroring-port GigabitEthernet 4/0/1 both
# Create remote source group 2, configure GigabitEthernet 4/0/2 as a source port of the mirroring group, and specify that the mirroring group monitor the bidirectional traffic of the port.
<Sysname> system-view
[Sysname] mirroring-group 2 remote-source
[Sysname] mirroring-group 2 mirroring-port GigabitEthernet4/0/2 both
mirroring-group mirroring-vlan
Syntax
mirroring-group group-id mirroring-vlan mirroring-vlan-list { both | inbound | outbound }
undo mirroring-group group-id mirroring-vlan mirroring-vlan-list { both | inbound | outbound }
View
System view
Default level
2: System level
Parameters
group-id: Number of a port mirroring group, ranging from 1 to 64. The mirroring group specified by the group-id argument must already exist.
mirroring-vlan-list: List of mirroring VLANs. You need to provide this argument in the form of mirroring-vlan-list = { vlan-id [ to vlan-id ] }&<1-8>, where &<1-8> means that you can provide up to 8 VLAN IDs/VLAN ID ranges for this argument and vlan-id ranges from 1 to 4094.
both: Mirrors both received and sent packets on the ports in the mirroring VLAN.
inbound: Mirrors only packets received by the ports in the mirroring VLAN.
outbound: Mirrors only packets sent by the ports in the mirroring VLAN.
Description
Use the mirroring-group mirroring-vlan command to assign mirroring VLANs to a mirroring group.
Use the undo mirroring-group mirroring-vlan command to remove the specified mirroring VLAN(s) from a mirroring group.
You cannot assign mirroring VLANs to a remote destination mirroring group.
Only static VLANs already created can be configured as mirroring VLANs.
A VLAN can act as the mirroring VLAN for only one mirroring group.
To delete a mirroring VLAN, remove the mirroring VLAN configuration first.
When removing a mirroring VLAN from a mirroring group, make sure the traffic direction you specified in the undo mirroring-group mirroring-vlan command matches the actual monitored direction specified earlier in the mirroring-group mirroring-vlan command.
|
NOTE: In IRF mode, the switch does not support the configuration of mirroring VLANs. |
Related commands: mirroring-group.
Examples
# Create local mirroring group 1, configure VLAN 1 as a mirroring VLAN of the mirroring group, and specify that the mirroring group monitor the bidirectional traffic of the ports in the VLAN.
<Sysname> system-view
[Sysname] mirroring-group 1 local
[Sysname] mirroring-group 1 mirroring-vlan 1 both
# Create remote source group 2, configure VLAN 2 as a source VLAN of the mirroring group, and specify that the mirroring group monitor the bidirectional traffic of the ports in the VLAN.
<Sysname> system-view
[Sysname] mirroring-group 2 remote-source
[Sysname] mirroring-group 2 mirroring-vlan 2 both
mirroring-group monitor-port
Syntax
mirroring-group group-id monitor-port monitor-port-id
undo mirroring-group group-id monitor-port monitor-port-id
View
System view
Default level
2: System level
Parameters
group-id: Number of a local or remote destination mirroring group, ranging from 1 to 64. The mirroring group specified by group-id must already exist.
monitor-port-id: Port to be assigned to the specified mirroring group as the monitor port. The argument takes the form of interface-type interface-number, where interface-type specifies the port type and interface-number specifies the port number.
Description
Use the mirroring-group monitor-port command to assign a port to a local or remote destination mirroring group as the monitor port.
Use the undo mirroring-group monitor-port command to remove the monitor port from the local or remote destination mirroring group.
By default, no monitor port is configured for a mirroring group.
You can configure a monitor port for a local mirroring group or remote destination mirroring group only, not for a remote source mirroring group.
You cannot assign a member port in an existing mirroring group to another mirroring group as the monitor port.
Related commands: mirroring-group.
Examples
# Configure local mirroring group 1 and configure GigabitEthernet 4/0/1 as its monitor port.
<Sysname> system-view
[Sysname] mirroring-group 1 local
[Sysname] mirroring-group 1 monitor-port GigabitEthernet4/0/1
# Create remote destination mirroring group 1 and configure GigabitEthernet 4/0/2 as its monitor port.
<Sysname> system-view
[Sysname] mirroring-group 1 remote-destination
[Sysname] mirroring-group 1 monitor-port gigabitethernet 4/0/2
mirroring-group reflector-port
Syntax
In system view:
mirroring-group group-id reflector-port reflector-port
undo mirroring-group group-id reflector-port reflector-port
In interface view:
mirroring-group group-id reflector-port
undo mirroring-group group-id reflector-port
View
System view, interface view
Default level
2: System level
Parameters
group-id: Number of a remote source mirroring group, which ranges from 1 to 64. The mirroring group specified by group-id must already exist.
reflector-port: Port to be configured as the reflector port in the specified mirroring group. The argument takes the form of interface-type interface-number, where interface-type specifies the port type and interface-number specifies the port number.
Description
Use the mirroring-group reflector-port command to configure the reflector port in a remote source mirroring group.
Use the undo mirroring-group reflector-port command to remove the reflector port of the remote source mirroring group.
By default, no reflector port is configured for a mirroring group, and a port does not serve as the reflector port of any mirroring group.
You can configure a reflector port for a remote source mirroring group only, not for other types of mirroring groups.
Related commands: mirroring-group.
Examples
# Create remote source mirroring group 1, and configure port GigabitEthernet 4/0/1 as its reflector port in system view.
<Sysname> system-view
[Sysname] mirroring-group 1 remote-source
[Sysname] mirroring-group 1 reflector-port gigabitethernet 4/0/1
# Create remote source mirroring group 2, and configure port GigabitEthernet 4/0/2 as its reflector port in system view.
<Sysname> system-view
[Sysname] mirroring-group 2 remote-source
[Sysname] interface GigabitEthernet4/0/2
[Sysname-GigabitEthernet4/0/2] mirroring-group 2 reflector-port
mirroring-group remote-probe vlan
Syntax
mirroring-group group-id remote-probe vlan rprobe-vlan-id
undo mirroring-group group-id remote-probe vlan rprobe-vlan-id
View
System view
Default level
2: System level
Parameters
group-id: Number of a remote source or destination mirroring group, ranging from 1 to 64. The mirroring group specified by group-id must already exist.
rprobe-vlan-id: ID of the VLAN to be configured as the remote probe VLAN. This VLAN must be a static VLAN that already exists.
Description
Use the mirroring-group remote-probe vlan command to specify a VLAN as the remote probe VLAN for a remote source or destination mirroring group.
Use the undo mirroring-group remote-probe vlan command to remove the remote probe VLAN from the remote source or destination mirroring group.
By default, no remote probe VLAN is configured for a mirroring group.
For a remote source or destination mirroring group, you must configure and can configure only one remote probe VLAN to carry mirrored packets. You cannot configure a remote probe VLAN for a local mirroring group.
Only a static VLAN that already exists can be configured as a remote probe VLAN; a VLAN can serve as the remote probe VLAN of only one mirroring group.
To delete a VLAN that is configured as a remote probe VLAN, remove the remote probe VLAN configuration first.
Related commands: mirroring-group.
Examples
# Create remote source mirroring group 1, and configure VLAN 10 as its remote probe VLAN.
<Sysname> system-view
[Sysname] mirroring-group 1 remote-source
[Sysname] mirroring-group 1 remote-probe vlan 10
# Create remote destination group 2, and configure VLAN 20 as its remote probe VLAN.
<Sysname> system-view
[Sysname] mirroring-group 2 remote-destination
[Sysname] mirroring-group 2 remote-probe vlan 20
mirroring-port
Syntax
[ mirroring-group group-id ] mirroring-port { inbound | outbound | both }
undo [ mirroring-group group-id ] mirroring-port { inbound | outbound | both }
View
Interface view
Default level
2: System level
Parameters
mirroring-group group-id: Specifies a local mirroring group or remote source mirroring group by its number with the group-id argument. The value range for this argument is 1 to 64, and the default value is 1. The mirroring group specified by group-id must already exist.
both: Mirrors both inbound and outbound packets on the current port.
inbound: Mirrors only inbound packets on the current port.
outbound: Mirrors only outbound packets on the current port.
Description
Use the mirroring-port command to assign the current port to a local or remote source mirroring group as a mirroring port.
Use the undo mirroring-port command to remove the current port from the mirroring group.
By default, a port does not serve as a mirroring port for any mirroring group.
When assigning a port to a mirroring group as a mirroring port, follow these guidelines:
· You cannot configure mirroring ports for a remote destination mirroring group.
· When removing a mirroring port from a mirroring group, make sure the traffic direction you specified in the undo mirroring-group command matches the actual monitored direction of the port specified earlier in the mirroring-port command.
Examples
# Create local mirroring group 1, configure GigabitEthernet 4/0/1 as a mirroring port of the mirroring group, and specify that the mirroring group monitor the bidirectional traffic of the port.
<Sysname> system-view
[Sysname] mirroring-group 1 local
[Sysname] interface GigabitEthernet4/0/1
[Sysname-GigabitEthernet4/0/1] mirroring-group 1 mirroring-port both
# Create remote source group 2, configure GigabitEthernet 4/0/2 as a source port of the mirroring group, and specify that the mirroring group monitor the bidirectional traffic of the port.
<Sysname> system-view
[Sysname] mirroring-group 2 remote-source
[Sysname] interface GigabitEthernet4/0/2
[Sysname-GigabitEthernet4/0/2] mirroring-group 2 mirroring-port both
monitor-port
Syntax
[ mirroring-group group-id ] monitor-port
undo [ mirroring-group group-id ] monitor-port
View
Interface view, Layer-2 aggregate interface view
Default level
2: System level
Parameters
mirroring-group group-id: Specifies a local or remote destination mirroring group by its number. The mirroring group specified by group-id must already exist. The value range for the group-id argument is 1 to 64, and the default value is 1.
Description
Use the monitor-port command to assign the current port to a local or remote destination mirroring group as the monitor port.
Use the undo monitor-port command to remove the current port from the mirroring group.
By default, a port is not the monitor port of any port mirroring group.
You cannot configure a monitor port for a remote source mirroring group.
A monitor port can be an Ethernet port or Layer 2 aggregate interface.
You cannot configure a mirroring port of an existing mirroring group as a monitor port.
Related commands: mirroring-group.
Examples
# Create local mirroring group 1 and configure GigabitEthernet 4/0/1 as its monitor port.
<Sysname> system-view
[Sysname] mirroring-group 1 local
[Sysname] interface gigabitethernet 4/0/1
[Sysname-GigabitEthernet4/0/1] monitor-port
# Create remote destination group 2, and configure GigabitEthernet 4/0/2 as its monitor port.
<Sysname> system-view
[Sysname] mirroring-group 2 remote-destination
[Sysname] interface GigabitEthernet4/0/2
[Sysname-GigabitEthernet4/0/2] monitor-port
mirror-to cpu
Syntax
mirror-to cpu
undo mirror-to cpu
View
Traffic behavior view
Default level
2: System level
Parameters
cpu: Mirrors traffic to the CPU, which is the CPU of the card where interfaces with traffic mirroring configured reside.
Description
Use the mirror-to cpu command to configure the action of mirroring traffic to the CPU for a traffic behavior.
Use the undo mirror-to cpu command to remove the action.
By default, the action of mirroring traffic to the CPU is not configured for a traffic behavior.
Examples
# Configure the action of mirroring traffic to the CPU for the traffic behavior 1.
<Sysname> system-view
[Sysname] traffic behavior 1
[Sysname-behavior-1] mirror-to cpu
mirror-to interface
Syntax
mirror-to interface interface-type interface-number [ sampler sampler-name ]
undo mirror-to interface interface-type interface-number
View
Traffic behavior view
Default level
2: System level
Parameters
interface-type interface-number: Specifies an interface by its type and number. The interface can be an Ethernet interface or aggregate interface.
sampler sampler-name: Binds the traffic mirroring action with a sampler specified by sampler-name, a case-insensitive string of 1 to 32 characters. For more information about samplers, see Network Management and Monitoring Configuration Guide.
Description
Use the mirror-to interface command to configure the action of mirroring traffic to a specified interface for the traffic behavior.
Use the undo mirror-to interface command to remove the action.
By default, the action of mirroring traffic to a specified interface is not configured for a traffic behavior.
Examples
# Configure the action of mirroring traffic to GigabitEthernet 3/0/2 for traffic behavior 1.
<Sysname> system-view
[Sysname] traffic behavior 1
[Sysname-behavior-1] mirror-to interface gigabitethernet 3/0/2
mirror-to vlan
Syntax
mirror-to vlan vlan-id
undo mirror-to vlan vlan-id
View
Traffic behavior view
Default level
2: System level
Parameters
vlan-id: VLAN ID, which ranges from 1 to 4094.
Description
Use the mirror-to vlan command to configure the action of mirroring traffic to a VLAN for a traffic behavior.
Use the undo mirror-to vlan command to remove the action.
By default, no action is configured.
Examples
# Configure the action of mirroring traffic to VLAN 2 for traffic behavior 1.
<Sysname> system-view
[Sysname] traffic behavior 1
[Sysname-behavior-1] mirror-to vlan 2