07-Port Mirroring Commands
Chapters Download (88.73 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 { groupid | all | local | remote-destination | remote-source }
View
Any view
Default Level
2: System level
Parameters
groupid: Number of the port mirroring group to be displayed. Its value range is 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 the specified port mirroring group or groups.
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 2:
type: local
status: active
mirroring port:
Olt1/0/1 both
Olt1/0/2 both
monitor port: GigabitEthernet1/1/1
mirroring-group 3:
type: remote-source
status: inactive
mirroring port:
GigabitEthernet1/1/2 both
monitor egress port:
remote-probe VLAN: 100
Field |
Description |
mirroring-group |
Number of the port mirroring group |
type |
Type of the port mirroring group, which can be one of the following: local, remote-source, or remote-destination. |
status |
Status of the port mirroring group, which can be active or inactive. |
Syntax
mirroring-group groupid { local | remote-destination | remote-source }
undo mirroring-group { groupid | all | local | remote-destination | remote-source }
View
System view
Default Level
2: System level
Parameters
groupid: Specifies the number of the port mirroring group to be created or removed. Its value range is from 1 to 4.
all: Removes all port mirroring groups.
local: Creates a local mirroring group or removes all local mirroring groups with the undo command.
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.
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 mirroring 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 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 a local port mirroring group numbered 1.
<Sysname> system-view
[Sysname] mirroring-group 1 local
Syntax
mirroring-group groupid mirroring-port mirroring-port-list { both | inbound | outbound }
undo mirroring-group groupid mirroring-port mirroring-port-list { both | inbound | outbound }
View
System view
Default Level
2: System level
Parameters
groupid: Number of a local or remote source mirroring group. Its value range is 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.
By configuring a port as a mirroring port, you can track the packets received from or/and sent out the port.
Before you can assign a port to a mirroring group, create the mirroring group first.
Note that:
l You can assign Ethernet ports or OLT ports to a local mirroring group as mirroring ports.
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 Olt 1/0/1 to Olt 1/0/2 both
[Sysname] mirroring-group 1 mirroring-port GigabitEthernet 1/1/1 to GigabitEthernet 1/1/2 both
# Remove mirroring ports from port mirroring group 1.
[Sysname] undo mirroring-group 1 mirroring-port Olt 1/0/1 to Olt 1/0/2 both
[Sysname] undo mirroring-group 1 mirroring-port GigabitEthernet 1/1/1 to GigabitEthernet 1/1/2 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 Ethernet port or OLT port view:
mirroring-group groupid monitor-egress
undo mirroring-group groupid monitor-egress
View
System view, Ethernet port view, OLT port view
Default Level
2: System level
Parameters
groupid: Number of a remote source mirroring group. Its value range is from 1 to 4.
monitor-egress-port-id: 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.
Description
Use the mirroring-group monitor-egress command to configure a port as the egress port in a remote source mirroring group.
Use the undo mirroring-group monitor-egress command to remove the egress port from the mirroring group.
In a remote source mirroring group, you must configure an egress port for forwarding the packets copied from the mirroring ports towards the remote monitor port.
A remote source mirroring group can contain only one egress port.
Examples
# Configure port GigabitEthernet 1/1/1 as the egress port of 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/1/1
# Configure port OLT 1/0/2 as the egress port of remote source mirroring group 2 in OLT port view.
<Sysname> system-view
[Sysname] mirroring-group 2 remote-source
[Sysname] interface Olt 1/0/2
[Sysname-Olt1/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 range is 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 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
# Configure GigabitEthernet 1/1/1 as the monitor port in remote destination mirroring group 1.
<Sysname> system-view
[Sysname] mirroring-group 1 remote-destination
[Sysname] mirroring-group 1 monitor-port gigabitethernet 1/1/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 range is 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 carry mirrored packets. For the mirrored packets to be forwarded to the monitor port, ensure that the probe VLAN you configured is the same as the one configured in the cooperating mirroring group on the remote device.
To ensure correct packet handling, use the VLAN configured as a remote probe VLAN for remote mirroring only.
Examples
# Specify VLAN 2 as the remote probe VLAN of 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
Ethernet port view, OLT port view
Default Level
2: System level
Parameters
groupid: Number of a local or remote source mirroring group. Its value range is 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 Whether you assign the port to port mirroring group 1 or any other mirroring group, ensure that the mirroring group already exists.
When removing a mirroring port from a mirroring group, make sure the traffic direction you specified in the undo [ mirroring-group groupid ] mirroring-port command matches the actual monitored direction of the port.
Examples
# Configure GigabitEthernet 1/1/1 as a mirroring port in remote source mirroring group numbered 2.
<Sysname> system-view
[Sysname] mirroring-group 2 remote-source
[Sysname] interface GigabitEthernet 1/1/1
[Sysname-GigabitEthernet1/1/1] mirroring-group 2 mirroring-port both
# Configure port OLT 1/0/1 as a mirroring port in local mirroring group numbered 3.
<Sysname> system-view
[Sysname] mirroring-group 3 local
[Sysname] interface Olt 1/0/1
[Sysname-Olt1/0/1] mirroring-group 3 mirroring-port both
Syntax
[ mirroring-group groupid ] monitor-port
undo [ mirroring-group groupid ] monitor-port
View
Ethernet port view, OLT port view
Default Level
2: System level
Parameters
groupid: Number of a local or remote destination mirroring group. Its value range is 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 Whether you assign the port to port mirroring group 1 or any other mirroring group, ensure that the mirroring group already exists.
l The port cannot belong to any other mirroring group.
Examples
# Configure GigabitEthernet 1/1/1 as the monitor port in local mirroring group numbered 1.
<Sysname> system-view
[Sysname] mirroring-group 1 local
[Sysname] interface GigabitEthernet 1/1/1
[Sysname-GigabitEthernet1/1/1] monitor-port
Syntax
uni uni-number mirroring-port { both | inbound | outbound }
undo uni uni-number mirroring-port
View
Default Level
2: System level
Parameters
uni-number: UNI number, in the range 1 to the number of UNI ports of the current ONU. The number of UNIs can be up to 80.
both: Mirrors both inbound and outbound packets on the port.
inbound: Mirrors only inbound packets on the port.
outbound: Mirrors only outbound packets on the port.
Description
Use the uni mirroring-port command to configure a UNI as a mirroring port.
Use the undo uni mirroring-port command to remove a UNI from a port mirroring group as a mirroring port.
Note that, after assigning a UNI to a port mirroring group as a mirroring port, you need to configure a monitor port for the port mirroring group to monitor the traffic on the UNI.
Related commands: uni monitor-port.
Examples
# Mirror the outbound packets on UNI 1.
<Sysname> system-view
[Sysname] interface onu 1/0/1:1
[Sysname-Onu1/0/1:1] uni 1 mirroring-port outbound
Syntax
uni uni-number monitor-port
undo uni uni-number monitor-port
View
ONU port view
Default Level
2: System level
Parameters
uni-number: UNI number, in the range 1 to the number of UNI ports of the current ONU. The number of UNIs can be up to 80.
Description
Use the uni monitor-port command to configure a UNI as the monitor port.
Use the undo uni monitor-port command to cancel the configuration of a UNI as the monitor port.
Examples
# Mirror the outbound packets on UNI 1 to UNI 2.
<Sysname> system-view
[Sysname] interface onu 1/0/1:1
[Sysname-Onu1/0/1:1] uni 1 mirroring-port outbound