- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
06-Mirroring configuration commands | 97.50 KB |
Port mirroring configuration commands
mirroring-group mirroring-port
mirroring-group monitor-egress
mirroring-group reflector-port
mirroring-group remote-probe vlan
Both Layer 2 and Layer 3 Ethernet interfaces support the port mirroring function. The term "interface" in this chapter collectively refers to these two types of interfaces. You can use the port link-mode command to configure an Ethernet port as a Layer 2 or Layer 3 interface (see Layer 2—LAN Switching Configuration Guide).
display mirroring-group
Use display mirroring-group to display mirroring group information, such as the types, status, and content of a mirroring group.
Syntax
display mirroring-group { group-id | all | local | remote-destination | remote-source } [ | { begin | exclude | include } regular-expression ]
Views
Any view
Default command level
2: System level
Parameters
group-id: Specifies a mirroring group by its number, ranging from 1 to 4.
all: Displays all mirroring groups.
local: Displays local mirroring groups.
remote-destination: Displays remote destination groups.
remote-source: Displays remote source 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.
Usage guidelines
The output varies by mirroring group types and is sorted by mirroring group numbers.
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
GigabitEthernet1/0/2 both
mirroring CPU:
monitor port: GigabitEthernet1/0/3
mirroring-group 2:
type: remote-source
status: active
mirroring port:
GigabitEthernet1/0/4 both
mirroring CPU:
reflector port:
monitor egress port: GigabitEthernet1/0/8
remote-probe VLAN: 2
mirroring-group 3:
type: remote-destination
status: active
monitor port: GigabitEthernet1/0/7
remote-probe VLAN: 3
Table 1 Command output
Field |
Description |
mirroring-group |
Number of the mirroring group. |
type |
Type of the mirroring group: local, remote-source, or remote-destination. |
status |
Status of the mirroring group: active or inactive. |
mirroring port |
Source port. |
mirroring CPU |
Source CPU. |
monitor port |
Destination port. |
mirroring-group
Use mirroring-group to create a mirroring group.
Use undo mirroring-group to remove the specified mirroring group or groups.
Syntax
mirroring-group group-id { local | remote-destination | remote-source }
undo mirroring-group { group-id | all | local | remote-destination | remote-source }
Default
No mirroring group exists on a device.
Views
System view
Default command level
2: System level
Parameters
group-id: Specifies a mirroring group by its number, ranging from 1 to 4.
all: Removes all mirroring groups by using the undo command.
local: Creates a local mirroring group or removes all local mirroring groups with the undo command.
remote-destination: Creates a remote destination group or removes all remote destination groups with the undo command.
remote-source: Creates a remote source group or removes all remote source groups with the undo command.
Usage guidelines
To mirror packets from a port to another port on the same device, create a local mirroring group.
To mirror packets from a port (a source port) on the current device to another port (the monitor port) either on the same device or on a different device, create remote mirroring groups. When doing that, create the remote source group on the device where the source port is located and create the remote destination group on the device where the monitor port is located.
Examples
# Create a local mirroring group numbered 1.
<Sysname> system-view
[Sysname] mirroring-group 1 local
mirroring-group mirroring-cpu
Use mirroring-group mirroring-cpu to assign CPUs to a local or remote source group as source CPUs.
Use undo mirroring-group mirroring-cpu to remove source CPUs from the mirroring group.
Syntax
mirroring-group group-id mirroring-cpu slot slot-number-list { both | inbound | outbound }
undo mirroring-group group-id mirroring-cpu slot slot-number-list { both | inbound | outbound }
Default
By default, no source CPU is configured for any mirroring group.
Views
System view
Default command level
2: System level
Parameters
group-id: Number of a mirroring group. The mirroring group specified by the group-id argument must already exist.
slot slot-number-list: Specifies the WX5540E switching engine, which is always 1.
both: Mirrors both inbound and outbound packets on the specified CPUs.
inbound: Mirrors only inbound packets on the specified CPUs.
outbound: Mirrors only outbound packets on the specified CPUs.
Description
You cannot configure source CPUs for a remote destination group.
When removing a source CPU from a mirroring group, make sure the traffic direction you specified in the mirroring-group mirroring-cpu command matches the actual monitored direction of the CPU.
Examples
# Create local mirroring group 1, configure the source CPU for the mirroring group, and specify that the mirroring group monitor the bidirectional traffic of the CPU.
<Sysname> system-view
[Sysname] mirroring-group 1 local
[Sysname] mirroring-group 1 mirroring-cpu slot 1 both
Related commands
mirroring-group
mirroring-group mirroring-port
Use mirroring-group mirroring-port to configure source ports for a local or remote source group.
Use undo mirroring-group mirroring-port to remove source ports from the mirroring group.
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 }
Default
No source port is configured for any mirroring group.
Views
System view
Default command level
2: System level
Parameters
group-id: Specifies a local or remote source group by its number. The mirroring group specified by the group-id argument must already exist. This argument ranges from 1 to 4.
mirroring-port-list: A list of source ports/port ranges to be assigned to or removed from the mirroring group specified by group-id. You can specify up to eight single ports, port ranges, or combinations of both for the list. A single port takes the form of interface-type interface-number. A port range takes the form interface-type interface-number to interface-type interface-number, where the end port number must be greater than the start port number. For example, you may specify up to eight combinations of single ports and port ranges for the list like this: gigabitethernet 1/0/1 gigabitethernet 1/0/3 gigabitethernet 1/0/5 gigabitethernet 2/0/2 to gigabitethernet 2/0/10 gigabitethernet 3/0/1 gigabitethernet 3/0/4 gigabitethernet 3/0/6 to gigabitethernet 3/0/10 gigabitethernet 3/0/12.
both: Mirrors both inbound and outbound packets on the specified ports.
inbound: Mirrors only inbound packets on the specified ports.
outbound: Mirrors only outbound packets on the specified ports.
Usage guidelines
You cannot configure source ports for a remote destination group.
When removing a source 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.
Examples
# Create local mirroring group 1, configure GigabitEthernet 1/0/1 as a source port of the mirroring group, and configure the mirroring group to monitor the bidirectional traffic of the port.
<Sysname> system-view
[Sysname] mirroring-group 1 local
[Sysname] mirroring-group 1 mirroring-port gigabitethernet 1/0/1 both
# Create remote source group 2, configure GigabitEthernet 1/0/2 as a source port of the mirroring group, and configure the mirroring group to monitor the bidirectional traffic of the port.
<Sysname> system-view
[Sysname] mirroring-group 2 remote-source
[Sysname] mirroring-group 2 mirroring-port gigabitethernet 1/0/2 both
Related commands
mirroring-group
mirroring-group monitor-egress
Use mirroring-group monitor-egress to configure an egress port for a remote source group.
Use undo mirroring-group monitor-egress to remove the egress port of the mirroring group.
Syntax
In system view:
mirroring-group group-id monitor-egress monitor-egress-port
undo mirroring-group group-id monitor-egress monitor-egress-port
In interface view:
mirroring-group group-id monitor-egress
undo mirroring-group group-id monitor-egress
Default
No egress port is configured for a mirroring group.
Views
System view, interface view
Default command level
2: System level
Parameters
group-id: Specifies a remote source group by its number. The mirroring group specified by group-id must already exist. This argument ranges from 1 to 4.
monitor-egress-port: Specifies a port to be configured as the egress port. It takes the form of interface-type interface-number, where interface-type specifies the port type and interface-number specifies the port number.
Usage guidelines
You can configure an egress port for a remote source group only, not for other types of mirroring groups.
Examples
# Create remote source group 1, and configure port GigabitEthernet 1/0/1 as its egress port in system view.
<Sysname> system-view
[Sysname] mirroring-group 1 remote-source
[Sysname] mirroring-group 1 monitor-egress gigabitethernet 1/0/1
# Create remote source group 2, and configure port GigabitEthernet 1/0/2 as its egress port in interface view.
<Sysname> system-view
[Sysname] mirroring-group 2 remote-source
[Sysname] interface gigabitethernet 1/0/2
[Sysname-GigabitEthernet1/0/2] mirroring-group 2 monitor-egress
Related commands
mirroring-group
mirroring-group monitor-port
Use mirroring-group monitor-port to configure a port for a local or remote destination group as the monitor port.
Use undo mirroring-group monitor-port to remove the monitor port from the local or remote destination group.
Syntax
mirroring-group group-id monitor-port monitor-port-id
undo mirroring-group group-id monitor-port monitor-port-id
Default
No monitor port is configured for a mirroring group.
Views
System view
Default command level
2: System level
Parameters
group-id: Specifies a local or remote destination group by its number. The mirroring group specified by group-id must already exist. This argument ranges from 1 to 4.
monitor-port-id: Specifies a 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.
Usage guidelines
You cannot configure a monitor port for a remote source group.
You cannot assign a source port in an existing mirroring group to another mirroring group as the monitor port.
Examples
# Create local mirroring group 1, and configure port 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
# Create remote destination group 2, and configure port GigabitEthernet 1/0/2 as its monitor port.
<Sysname> system-view
[Sysname] mirroring-group 2 remote-destination
[Sysname] mirroring-group 2 monitor-port gigabitethernet 1/0/2
Related commands
mirroring-group
mirroring-group reflector-port
Use mirroring-group reflector-port to configure the reflector port for a remote source group.
Use undo mirroring-group reflector-port to remove the reflector port of the remote source group.
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
Default
No reflector port is configured for a mirroring group, and a port does not serve as the reflector port of any mirroring group.
Views
System view, interface view
Default command level
2: System level
Parameters
group-id: Specifies a remote source group by its number. The mirroring group specified by group-id must already exist. This argument ranges from 1 to 4.
reflector-port: Specifies a 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.
Usage guidelines
You can configure a reflector port for a remote source group only, not for other types of mirroring groups.
Examples
# Create remote source group 1, and configure port GigabitEthernet 1/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 1/0/1
# Create remote source group 2, and configure port GigabitEthernet 1/0/2 as its reflector port in interface view.
<Sysname> system-view
[Sysname] mirroring-group 2 remote-source
[Sysname] interface gigabitethernet 1/0/2
[Sysname-GigabitEthernet1/0/2] mirroring-group 2 reflector-port
Related commands
mirroring-group
mirroring-group remote-probe vlan
Use mirroring-group remote-probe vlan to specify a VLAN as the remote probe VLAN for a remote source or destination mirroring group.
Use undo mirroring-group remote-probe vlan to remove the remote probe VLAN from the remote source or destination mirroring group.
Syntax
mirroring-group group-id remote-probe vlan rprobe-vlan-id
undo mirroring-group group-id remote-probe vlan rprobe-vlan-id
Default
No remote probe VLAN is configured for a mirroring group.
Views
System view
Default command level
2: System level
Parameters
group-id: Specifies a remote source or destination mirroring group by its number. The mirroring group specified by group-id must already exist. This argument ranges from 1 to 4.
rprobe-vlan-id: Specifies the ID of the VLAN to be configured as the remote probe VLAN. This VLAN must be a static VLAN that already exists.
Usage guidelines
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 the 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 for only one mirroring group.
To delete a VLAN that is configured as a remote probe VLAN, remove the remote probe VLAN configuration first.
Examples
# Create remote source 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
Related commands
mirroring-group
mirroring-port
Use mirroring-port to assign the current port to a local or remote source group as a source port.
Use undo mirroring-port to remove the current port from the mirroring group.
Syntax
[ mirroring-group group-id ] mirroring-port { inbound | outbound | both }
undo [ mirroring-group group-id ] mirroring-port { inbound | outbound | both }
Default
A port does not serve as a source port for any mirroring group.
Views
Interface view
Default command level
2: System level
Parameters
mirroring-group group-id: Specifies a local or remote source group by its number. The mirroring group specified by group-id must already exist. The group-id argument ranges from 1 to 4, and the default value is 1.
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.
Usage guidelines
You cannot configure source ports for a remote destination group.
When removing a source 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 1/0/1 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 1 local
[Sysname] interface gigabitethernet 1/0/1
[Sysname-GigabitEthernet1/0/1] mirroring-group 1 mirroring-port both
# Create remote source group 2, configure GigabitEthernet 1/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 gigabitethernet 1/0/2
[Sysname-GigabitEthernet1/0/2] mirroring-group 2 mirroring-port both
monitor-port
Use monitor-port to assign the current port to a local or remote destination group as the monitor port.
Use undo monitor-port to remove the current port from the mirroring group.
Syntax
[ mirroring-group group-id ] monitor-port
undo [ mirroring-group group-id ] monitor-port
Default
A port does not serve any mirroring group as the monitor port.
Views
Interface view
Default command level
2: System level
Parameters
mirroring-group group-id: Specifies a local or remote destination group by its number. The mirroring group specified by group-id must already exist. The group-id argument ranges from 1 to 4, and the default value is 1.
Usage guidelines
You cannot configure a monitor port for a remote source group.
You cannot configure a source port of an existing mirroring group 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] monitor-port
# Create remote destination group 2, and configure GigabitEthernet 1/0/2 as its monitor port.
<Sysname> system-view
[Sysname] mirroring-group 2 remote-destination
[Sysname] interface gigabitethernet 1/0/2
[Sysname-GigabitEthernet1/0/2] monitor-port
Related commands
mirroring-group