01-Port Mirroring Commands
Chapters Download (86.01 KB)
Table of Contents
1 Port Mirroring Configuration Commands
Port Mirroring Configuration Commands
mirroring-group mirroring-port
mirroring-group monitor-egress
Syntax
display mirroring-group { group-id | all | local | remote-destination | remote-source }
View
Any view
Default Level
2: System level
Parameters
group-id: Specifies the number of a port mirroring group to display its information. Its value ranges from 1 to 4 .
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.
Description
Use the display mirroring-group command to display information about port mirroring groups.
The output varies by port mirroring group type and is sorted by mirroring group number.
Examples
# Display information about all port mirroring groups.
<Sysname> display mirroring-group all
mirroring-group 1:
type: remote-source
status: inactive
mirroring port:
GigabitEthernet1/0/5 both
monitor egress port:
remote-probe VLAN:
mirroring-group 2:
type: remote-destination
status: inactive
monitor port: GigabitEthernet1/0/2
remote-probe VLAN:
mirroring-group 3:
type: local
status: active
mirroring port:
GigabitEthernet1/0/1 both
monitor port: GigabitEthernet1/0/10
Table 1-1 display mirroring-group all command output description
Field |
Description |
mirroring-group |
Number of a port mirroring group |
type |
Type of the port mirroring group, which can be local, remote-source, or remote-destination. |
status |
Status of the port mirroring group, which can be active or inactive |
mirroring port |
Source port in port mirroing |
monitor port |
Destination port in port mirroing |
monitor egress port |
Available only for remote source mirroring groups. |
remote-probe vlan |
Available only for remote source or destination mirroring groups. |
Syntax
mirroring-group group-id { local | 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: Specifies the number of the port mirroring group to be created or deleted. Its value ranges from 1 to 4.
all: Deletes all port mirroring groups.
local: Creates a local mirroring group, or deletes all local mirroring groups with the undo command.
remote-destination: Creates a remote destination mirroring group, or deletes all remote destination mirroring groups with the undo command.
remote-source: Creates a remote source mirroring group, or deletes 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 delete port mirroring groups.
To mirror packets from one port to another port on the same device, create a local mirroring group.
To mirror packets from one local port (a mirroring port) 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 mirroring group on the device where the mirroring port is located, and create the remote destination mirroring group on the device where the monitor port is located.
Examples
# Create local port mirroring group 1.
<Sysname> system-view
[Sysname] mirroring-group 1 local
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 }
View
System view
Default Level
2: System level
Parameters
group-id: Number of a local or remote source mirroring group. Its value ranges from 1 to 4. The specified mirroring group must have been created, and cannot be a remote destination mirroring group.
slot slot-number-list: Specifies the current device that is standalone or a list of member devices in an IRF virtual device to add/remove their CPUs to/from the mirroring group as the mirroring CPUs. If the device is standalone, the slot-number-list argument always takes 1. For devices in an IRF virtual device, the slot-number-list argument takes the form of { slot-number [ to slot-number ] }&<1-8>, where slot-number represents the member ID of a device in the IRF virtual device, &<1-8> indicates that you can specify up to eight device IDs or device ID ranges.
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
Use the mirroring-group mirroring-cpu command to assign CPUs to a local or remote source mirroring group as mirroring CPUs. The traffic in the specified direction of a mirroring CPU will be duplicated and sent out the monitoring port for analysis.
Use the undo mirroring-group mirroring-port command to remove mirroring CPUs from the mirroring group.
By default, no mirroring CPU is specified for any mirroring group.
When removing a mirroring CPU from a mirroring group, make sure the traffic direction you specified matches the actual monitored traffic direction. If not, the removal attempt will fail.
Related commands: mirroring-group
Examples
# Suppose the switch is a standalone device. Create local mirroring group 1 on the switch to mirror both incoming and outgoing traffic of the CPU.
<Sysname> system-view
[Sysname] mirroring-group 1 local
[Sysname] mirroring-group 1 mirroring-cpu slot 1 both
# In an IRF virtual device, remove the CPU of member device 2 from mirroring group 1.
<Sysname> system-view
[Sysname] undo mirroring-group 1 mirroring-cpu slot 2 both
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. Its value ranges from 1 to 4.
mirroring-port-list: A list of ports/port ranges to be assigned to or removed from the port mirroring group specified by groupid. 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.
Note that:
l You cannot configure mirroring ports for a remote destination mirroring group.
l 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 of the port.
Examples
# Configure mirroring ports in port mirroring group 1, assuming that the mirroring group already exists.
<Sysname> system-view
[Sysname] mirroring-group 1 mirroring-port gigabitethernet 1/0/1 to gigabitethernet 1/0/23 both
# Remove mirroring ports from port mirroring group 1.
<Sysname> system-view
[Sysname] undo mirroring-group 1 mirroring-port gigabitethernet 1/0/1 to gigabitethernet 1/0/10 both
Syntax
In system view:
mirroring-group groupid monitor-egress monitor-egress-port-id
undo mirroring-group groupid monitor-egress monitor-egress-port-id
In port view:
mirroring-group groupid monitor-egress
undo mirroring-group groupid monitor-egress
View
System view, port view
Default Level
2: System level
Parameters
groupid: Specifies the number of a remote source mirroring group. Its value ranges from 1 to 4.
monitor-egress-port-id: Specifies a port as the egress port for the mirroring group. It takes the form of interface-type interface-number, where interface-type represents the port type and interface-number represents the port number.
Description
Use the mirroring-group monitor-egress command to specify a port as the egress port for a remote source mirroring group.
Use the undo mirroring-group monitor-egress command to remove the egress port from the mirroring group.
A remote source mirroring group can contain only one egress port.
Examples
# Specify port GigabitEthernet 1/0/1 as the egress port for remote source mirroring group 1 in system view.
<Sysname> system-view
[Sysname] mirroring-group 1 remote-source
[Sysname] mirroring-group 1 monitor-egress gigabitethernet 1/0/1
# Specify port GigabitEthernet 1/0/2 as the egress port for remote source mirroring group 2 in Ethernet port 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
Syntax
mirroring-group groupid monitor-port monitor-port-id
undo mirroring-group groupid monitor-port monitor-port-id
View
System view
Default Level
2: System level
Parameters
groupid: Number of a local or remote destination mirroring group. Its value ranges from 1 to 4.
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. The port type varies with device models.
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.
In a local or remote destination mirroring group, you must configure a monitor port. From this port, mirrored packets are sent to the monitor device for analysis.
Note that:
l You can configure only one monitor port for a mirroring group.
l A remote source mirroring group does not contain a monitor port.
l Before assigning a port to a mirroring group, make sure that the group already exists.
l In a mirroring group, you can configure only one monitor port. This port must not belong to any other mirroring group.
Examples
# Specify GigabitEthernet 1/0/1 as the monitor port for remote destination mirroring group 1.
<Sysname> system-view
[Sysname] mirroring-group 1 remote-destination
[Sysname] mirroring-group 1 monitor-port gigabitethernet 1/0/1
Syntax
mirroring-group groupid remote-probe vlan rprobe-vlan-id
undo mirroring-group groupid remote-probe vlan rprobe-vlan-id
View
System view
Default Level
2: System level
Parameters
groupid: Number of a remote source or destination mirroring group. Its value ranges from 1 to 4.
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.
For a remote source or destination mirroring group, you must configure and can configure only one remote probe VLAN to transmit mirrored packets.
To ensure correct packet handling, avoid using a remote probe VLAN for any other purposes.
Examples
# Specify VLAN 2 as the remote probe VLAN for port mirroring group 1, assuming that VLAN 2 already exists.
<Sysname> system-view
[Sysname] mirroring-group 1 remote-source
[Sysname] mirroring-group 1 remote-probe vlan 2
Syntax
[ mirroring-group groupid ] mirroring-port { inbound | outbound | both }
undo [ mirroring-group groupid ] mirroring-port { inbound | outbound | both }
View
Interface view
Default Level
2: System level
Parameters
groupid: Number of a local or remote source mirroring group. Its value ranges from 1 to 4..
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 port mirroring group.
When assigning a port to a mirroring group as a mirroring port, note that:
l If no mirroring group is specified, the port is assigned to port mirroring group 1.
l You cannot configure mirroring ports for a remote destination mirroring group.
l 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.
Examples
# Specify GigabitEthernet 1/0/1 as a mirroring port in remote source mirroring group 2.
<Sysname> system-view
[Sysname] mirroring-group 2 remote-source
[Sysname] interface gigabitethernet 1/0/1
[Sysname-GigabitEthernet1/0/1] mirroring-group 2 mirroring-port both
Syntax
[ mirroring-group groupid ] monitor-port
undo [ mirroring-group groupid ] monitor-port
View
Interface view
Default Level
2: System level
Parameters
groupid: Number of a local or remote destination mirroring group. Its value ranges from 1 to 4.
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.
When assigning a port to a mirroring group as the monitor port, note that:
l If no mirroring group is specified, the port is assigned to port mirroring group 1.
l You cannot configure a monitor port for a remote source mirroring group.
l The port cannot belong to any other mirroring groups.
Examples
# Specify GigabitEthernet 1/0/1 as the monitor port for local mirroring group 1.
<Sysname> system-view
[Sysname] mirroring-group 1 local
[Sysname] interface gigabitethernet 1/0/1
[Sysname-GigabitEthernet1/0/1] monitor-port