Professional Documents
Culture Documents
i
Configuring port mirroring
Overview
Port mirroring copies the packets passing through a port or CPU to a port that connects to a data
monitoring device for packet analysis.
Terminology
The following terms are used in port mirroring configuration.
Mirroring source
The mirroring sources can be one or more monitored ports or CPUs. The monitored ports and CPUs
called source ports and source CPUs, respectively.
Packets passing through mirroring sources are copied to a port connecting to a data monitoring
device for packet analysis. The copies are called mirrored packets.
Source device
The device where the mirroring sources reside is called a source device.
Mirroring destination
The mirroring destination is the destination port (also known as the monitor port) of mirrored packets
and connects to a data monitoring device. Mirrored packets are sent out of the monitor port to the
data monitoring device.
A monitor port might receive multiple copies of a packet when it monitors multiple mirroring sources.
For example, two copies of a packet are received on Port 1 when the following conditions exist:
• Port 1 is monitoring bidirectional traffic of Port 2 and Port 3 on the same device.
• The packet travels from Port 2 to Port 3.
Destination device
The device where the monitor port resides is called the destination device.
Mirroring direction
The mirroring direction specifies the direction of the traffic that is copied on a mirroring source.
• Inbound—Copies packets received.
• Outbound—Copies packets sent.
• Bidirectional—Copies packets received and sent.
Mirroring group
Port mirroring is implemented through mirroring groups, which include local, remote source, and
remote destination groups. For more information about the mirroring groups, see "Port mirroring
classification and implementation."
Reflector port, egress port, and remote probe VLAN
Reflector ports, remote probe VLANs, and egress ports are used for Layer 2 remote port mirroring.
The remote probe VLAN is a dedicated VLAN for transmitting mirrored packets to the destination
device. Both the reflector port and egress port reside on a source device and send mirrored packets
to the remote probe VLAN. For more information about the reflector port, egress port, remote probe
VLAN, and Layer 2 remote port mirroring, see "Port mirroring classification and implementation."
1
NOTE:
On port mirroring devices, all ports except source, destination, reflector, and egress ports are called
common ports.
As shown in Figure 1, the source port GigabitEthernet 1/0/1 and the monitor port GigabitEthernet
1/0/2 reside on the same device. Packets received on GigabitEthernet 1/0/1 are copied to
GigabitEthernet 1/0/2. GigabitEthernet 1/0/2 then forwards the packets to the data monitoring device
for analysis.
Remote port mirroring
In remote port mirroring, the following conditions exist:
• The source device is not directly connected to a data monitoring device.
• The source device copies mirrored packets to the destination device, which forwards them to
the data monitoring device.
• The mirroring sources and the mirroring destination reside on different devices and are in
different mirroring groups.
A remote source group is a mirroring group that contains the mirroring sources. A remote destination
group is a mirroring group that contains the mirroring destination. Intermediate devices are the
devices between the source device and the destination device.
2
Remote port mirroring includes Layer 2 and Layer 3 remote port mirroring.
• Layer 2 remote port mirroring—The mirroring sources and the mirroring destination are
located on different devices on a same Layer 2 network.
Layer 2 remote port mirroring can be implemented when a reflector port or an egress port is
available on the source device. The method to use the reflector port and the method to use the
egress port are called reflector port method and egress port method, respectively.
{ Reflector port method—Packets are mirrored as follows:
− The source device copies packets received on the mirroring sources to the reflector
port.
− The reflector port broadcasts the mirrored packets in the remote probe VLAN.
− The intermediate devices transmit the mirrored packets to the destination device
through the remote probe VLAN.
− Upon receiving the mirrored packets, the destination device determines whether the ID
of the mirrored packets is the same as the remote probe VLAN ID. If the two VLAN IDs
are the same, the destination device forwards the mirrored packets to the data
monitoring device through the monitor port.
A reflector port can be fixed or configurable. The switch supports only the configurable
reflector port.
Figure 2 Layer 2 remote port mirroring implementation through the reflector port
method
3
Figure 3 Layer 2 remote port mirroring implementation through the egress port
method
Mirroring process
in the device
GE1/0/1 GE1/0/2
Data monitoring
Host
device
To ensure Layer 2 forwarding of the mirrored packets, assign the ports connecting intermediate
devices to the source and destination devices to the remote probe VLAN.
To monitor the bidirectional traffic of a source port, disable MAC address learning for the remote
probe VLAN on the source, intermediate, and destination devices. For more information about
MAC address learning, see Layer 2—LAN Switching Configuration Guide.
• Layer 3 remote port mirroring—The mirroring sources and the mirroring destination are
separated by IP networks.
Layer 3 remote port mirroring is implemented through creating a local mirroring group on both
the source device and the destination device. For example, in a network as shown in Figure 4,
Layer 3 remote port mirroring works in the following flow:
a. The source device sends one copy of a packet received on the source port GigabitEthernet
1/0/1 to the tunnel interface.
The tunnel interface acts as the monitor port in the local mirroring group created on the
source device.
b. The tunnel interface on the source device forwards the mirrored packet to the tunnel
interface on the destination device through the GRE tunnel.
c. The destination device receives the mirrored packet from the physical interface of the tunnel
interface.
The tunnel interface acts as the source port in the local mirroring group created on the
destination device.
d. The physical interface of the tunnel interface sends one copy of the packet to the monitor
port GigabitEthernet 1/0/2.
e. GigabitEthernet 1/0/2 forwards the packet to the data monitoring device.
For more information about GRE tunnels and tunnel interfaces, see Layer 3—IP Services
Configuration Guide.
4
Figure 4 Layer 3 remote port mirroring implementation
3. (Required.) Configuring the monitor port for the local mirroring group
5
Creating a local mirroring group
Step Command Remarks
1. Enter system view. system-view N/A
2. Create a local mirroring By default, no local
group. mirroring-group group-id local
mirroring group exists.
3. Configure the port as a mirroring-group group-id By default, a port does not act as
source port for a local mirroring-port { both | inbound | a source port for any local
mirroring group. outbound } mirroring groups.
6
Configuring source CPUs for the local mirroring group
CPUs on the LSQM3MPUB0 MPUs cannot be configured as source CPUs:
A mirroring group can contain multiple source CPUs.
To configure source CPUs for a local mirroring group:
• In standalone mode:
mirroring-group group-id mirroring-cpu
slot slot-number-list { both | inbound |
2. Configure source outbound } By default, no source CPU
CPUs for a local • In IRF mode: is configured for a local
mirroring group. mirroring-group group-id mirroring-cpu mirroring group.
chassis chassis-number slot
slot-number-list { both | inbound |
outbound }
7
Configuring the monitor port in interface view
8
Tasks at a glance
3. Configuring the reflector port for a remote source group
4. Configuring the remote probe VLAN for a remote source group
9
• For a Layer 2 aggregate interface configured as the monitor port of a mirroring group, do not
configure its member ports as source ports of the mirroring group.
• Use a monitor port only for port mirroring, so the data monitoring device receives only the
mirrored traffic.
• A mirroring group must contain only one monitor port.
• A monitor port can belong to only one mirroring group.
Configuring the monitor port for a remote destination group in system view
Configuring the monitor port for a remote destination group in interface view
10
Step Command Remarks
2. Enter the interface view interface interface-type
of the monitor port. N/A
interface-number
• For an access port:
port access vlan vlan-id For more information about the
• For a trunk port: port access vlan, port trunk
3. Assign the port to the permit vlan, and port hybrid
port trunk permit vlan vlan-id
remote probe VLAN. vlan commands, see Layer
• For a hybrid port: 2—LAN Switching Command
port hybrid vlan vlan-id { tagged Reference.
| untagged }
11
Step Command Remarks
1. Enter system view. system-view N/A
3. Configure the port as a mirroring-group group-id By default, a port does not act as
source port for a remote mirroring-port { both | inbound | a source port for any remote
source group. outbound } source groups.
12
Step Command Remarks
1. Enter system view. system-view N/A
Configuring the reflector port for a remote source group in interface view
2. Configure the egress port for mirroring-group group-id By default, no egress port is
a remote source group. monitor-egress interface-type configured for a remote source
interface-number group.
Configuring the egress port for a remote source group in interface view
13
Step Command Remarks
14
Tasks at a glance
1. Configuring local mirroring groups
2. Perform at least one of the following tasks:
{ Configuring source ports for a local mirroring group
{ Configuring source CPUs for a local mirroring group
3. Configuring the monitor port for a local mirroring group
(Required.) Configuring the destination device:
1. Configuring local mirroring groups
2. Configuring source ports for a local mirroring group
3. Configuring the monitor port for a local mirroring group
Configuration prerequisites
Before configuring Layer 3 remote mirroring, complete the following tasks:
• Create a tunnel interface and a GRE tunnel.
• Configure the source and destination addresses of the tunnel interface as the IP addresses of
the physical interfaces on the source and destination devices, respectively.
IP addresses of physical interfaces on SA series interface modules cannot be used as the
source or destination IP address for the tunnel interface.
For more information about tunnel interfaces, see Layer 3—IP Services Configuration Guide.
15
• A source port cannot be configured as a reflector port, egress port, or monitor port.
• In an IRF 3.1 system, a cascade port or an upstream port on a PEX cannot be configured as
source ports for mirroring groups. For more information about IRF 3.1, see IRF 3.1
configuration in Virtual Technologies Configuration Guide.
Configuring source ports in system view
3. Configure the port as a mirroring-group group-id By default, a port does not act as
source port for a local mirroring-port { both | inbound | a source port for any local
mirroring group. outbound } mirroring groups.
16
To configure the monitor port for a mirroring group, use one of the following methods:
• Configure the monitor port for the mirroring group in system view.
• Assign a port to a mirroring group as the monitor port in interface view.
Configuration restrictions and guidelines
When you configure the monitor port for a local mirroring group, follow these restrictions and
guidelines:
• A mirroring group contains only one monitor port.
• Do not enable the spanning tree feature on the monitor port.
• In an IRF 3.1 system, the monitor port must reside on the same card as a source port in the
mirroring group if the following conditions are met:
{ The device is a parent device in the IRF 3.1 system.
{ The source port resides on a card that support cascade ports.
For more information about the cards that support cascade ports, see IRF 3.1 configuration in
Virtual Technologies Configuration Guide.
• As a best practice, use a monitor port only for port mirroring, so the data monitoring device
receives only the mirrored traffic.
Configuring the monitor port in system view
Task Command
display mirroring-group { group-id | all | local |
Display mirroring group information.
remote-destination | remote-source }
17
Port mirroring configuration examples
Local port mirroring configuration example (in source port
mode)
Network requirements
As shown in Figure 5, configure local port mirroring in source port mode to enable the server to
monitor the bidirectional traffic of the Marketing department and the Technical department.
Figure 5 Network diagram
Configuration procedure
# Create local mirroring group 1.
<Device> system-view
[Device] mirroring-group 1 local
# Configure GigabitEthernet 1/0/1 and GigabitEthernet 1/0/2 as source ports for local mirroring group
1.
[Device] mirroring-group 1 mirroring-port gigabitethernet 1/0/1 gigabitethernet 1/0/2
both
# Configure GigabitEthernet 1/0/3 as the monitor port for local mirroring group 1.
[Device] mirroring-group 1 monitor-port gigabitethernet 1/0/3
# Disable the spanning tree feature on the monitor port (GigabitEthernet 1/0/3).
[Device] interface gigabitethernet 1/0/3
[Device-GigabitEthernet1/0/3] undo stp enable
[Device-GigabitEthernet1/0/3] quit
18
GigabitEthernet1/0/1 Both
GigabitEthernet1/0/2 Both
Monitor port: GigabitEthernet1/0/3
Configuration procedure
# Create local mirroring group 1.
<Device> system-view
[Device] mirroring-group 1 local
# Configure the CPU of the card in slot 1 of the device as a source CPU for local mirroring group 1.
[Device] mirroring-group 1 mirroring-cpu slot 1 both
# Configure GigabitEthernet 1/0/3 as the monitor port for local mirroring group 1.
[Device] mirroring-group 1 monitor-port gigabitethernet 1/0/3
# Disable the spanning tree feature on the monitor port (GigabitEthernet 1/0/3).
[Device] interface gigabitethernet 1/0/3
[Device-GigabitEthernet1/0/3] undo stp enable
[Device-GigabitEthernet1/0/3] quit
19
Type: Local
Status: Active
Mirroring CPU:
Slot 1 Both
Monitor port: GigabitEthernet1/0/3
Configuration procedure
1. Configure Device C (the destination device):
# Configure GigabitEthernet 1/0/1 as a trunk port, and assign the port to VLAN 2.
<DeviceC> system-view
[DeviceC] interface gigabitethernet 1/0/1
[DeviceC-GigabitEthernet1/0/1] port link-type trunk
[DeviceC-GigabitEthernet1/0/1] port trunk permit vlan 2
[DeviceC-GigabitEthernet1/0/1] quit
# Create a remote destination group.
[DeviceC] mirroring-group 2 remote-destination
# Create VLAN 2.
[DeviceC] vlan 2
# Disable MAC address learning for VLAN 2.
[DeviceC-vlan2] undo mac-address mac-learning enable
[DeviceC-vlan2] quit
# Configure VLAN 2 as the remote probe VLAN for the mirroring group.
[DeviceC] mirroring-group 2 remote-probe vlan 2
# Configure GigabitEthernet 1/0/2 as the monitor port for the mirroring group.
[DeviceC] interface gigabitethernet 1/0/2
[DeviceC-GigabitEthernet1/0/2] mirroring-group 2 monitor-port
20
# Disable the spanning tree feature on GigabitEthernet 1/0/2.
[DeviceC-GigabitEthernet1/0/2] undo stp enable
# Assign GigabitEthernet 1/0/2 to VLAN 2.
[DeviceC-GigabitEthernet1/0/2] port access vlan 2
[DeviceC-GigabitEthernet1/0/2] quit
2. Configure Device B (the intermediate device):
# Create VLAN 2.
<DeviceB> system-view
[DeviceB] vlan 2
# Disable MAC address learning for VLAN 2.
[DeviceB-vlan2] undo mac-address mac-learning enable
[DeviceB-vlan2] quit
# Configure GigabitEthernet 1/0/1 as a trunk port, and assign the port to VLAN 2.
[DeviceB] interface gigabitethernet 1/0/1
[DeviceB-GigabitEthernet1/0/1] port link-type trunk
[DeviceB-GigabitEthernet1/0/1] port trunk permit vlan 2
[DeviceB-GigabitEthernet1/0/1] quit
# Configure GigabitEthernet 1/0/2 as a trunk port, and assign the port to VLAN 2.
[DeviceB] interface gigabitethernet 1/0/2
[DeviceB-GigabitEthernet1/0/2] port link-type trunk
[DeviceB-GigabitEthernet1/0/2] port trunk permit vlan 2
[DeviceB-GigabitEthernet1/0/2] quit
3. Configure Device A (the source device):
# Create a remote source group.
<DeviceA> system-view
[DeviceA] mirroring-group 1 remote-source
# Create VLAN 2.
[DeviceA] vlan 2
# Disable MAC address learning for VLAN 2.
[DeviceA-vlan2] undo mac-address mac-learning enable
[DeviceA-vlan2] quit
# Configure VLAN 2 as the remote probe VLAN for the mirroring group.
[DeviceA] mirroring-group 1 remote-probe vlan 2
# Configure GigabitEthernet 1/0/1 as a source port for the mirroring group.
[DeviceA] mirroring-group 1 mirroring-port gigabitethernet 1/0/1 both
# Configure GigabitEthernet 1/0/3 as the reflector port for the mirroring group.
[DeviceA] mirroring-group 1 reflector-port gigabitethernet 1/0/3
This operation may delete all settings made on the interface. Continue? [Y/N]: y
# Configure GigabitEthernet 1/0/2 as a trunk port, and assign the port to VLAN 2.
[DeviceA] interface gigabitethernet 1/0/2
[DeviceA-GigabitEthernet1/0/2] port link-type trunk
[DeviceA-GigabitEthernet1/0/2] port trunk permit vlan 2
[DeviceA-GigabitEthernet1/0/2] quit
21
Mirroring group 2:
Type: Remote destination
Status: Active
Monitor port: GigabitEthernet1/0/2
Remote probe VLAN: 2
Configuration procedure
1. Configure Device C (the destination device):
# Configure GigabitEthernet 1/0/1 as a trunk port, and assign the port to VLAN 2.
<DeviceC> system-view
[DeviceC] interface gigabitethernet 1/0/1
[DeviceC-GigabitEthernet1/0/1] port link-type trunk
[DeviceC-GigabitEthernet1/0/1] port trunk permit vlan 2
[DeviceC-GigabitEthernet1/0/1] quit
# Create a remote destination group.
[DeviceC] mirroring-group 2 remote-destination
# Create VLAN 2.
22
[DeviceC] vlan 2
# Disable MAC address learning for VLAN 2.
[DeviceC-vlan2] undo mac-address mac-learning enable
[DeviceC-vlan2] quit
# Configure VLAN 2 as the remote probe VLAN for the mirroring group.
[DeviceC] mirroring-group 2 remote-probe vlan 2
# Configure GigabitEthernet 1/0/2 as the monitor port for the mirroring group.
[DeviceC] interface gigabitethernet 1/0/2
[DeviceC-GigabitEthernet1/0/2] mirroring-group 2 monitor-port
# Disable the spanning tree feature on GigabitEthernet 1/0/2.
[DeviceC-GigabitEthernet1/0/2] undo stp enable
# Assign GigabitEthernet 1/0/2 to VLAN 2 as an access port.
[DeviceC-GigabitEthernet1/0/2] port access vlan 2
[DeviceC-GigabitEthernet1/0/2] quit
2. Configure Device B (the intermediate device):
# Create VLAN 2.
<DeviceB> system-view
[DeviceB] vlan 2
# Disable MAC address learning for VLAN 2.
[DeviceB-vlan2] undo mac-address mac-learning enable
[DeviceB-vlan2] quit
# Configure GigabitEthernet 1/0/1 as a trunk port, and assign the port to VLAN 2.
[DeviceB] interface gigabitethernet 1/0/1
[DeviceB-GigabitEthernet1/0/1] port link-type trunk
[DeviceB-GigabitEthernet1/0/1] port trunk permit vlan 2
[DeviceB-GigabitEthernet1/0/1] quit
# Configure GigabitEthernet 1/0/2 as a trunk port, and assign the port to VLAN 2.
[DeviceB] interface gigabitethernet 1/0/2
[DeviceB-GigabitEthernet1/0/2] port link-type trunk
[DeviceB-GigabitEthernet1/0/2] port trunk permit vlan 2
[DeviceB-GigabitEthernet1/0/2] quit
3. Configure Device A (the source device):
# Create a remote source group.
<DeviceA> system-view
[DeviceA] mirroring-group 1 remote-source
# Create VLAN 2.
[DeviceA] vlan 2
# Disable MAC address learning for VLAN 2.
[DeviceA-vlan2] undo mac-address mac-learning enable
[DeviceA-vlan2] quit
# Configure VLAN 2 as the remote probe VLAN of the mirroring group.
[DeviceA] mirroring-group 1 remote-probe vlan 2
# Configure GigabitEthernet 1/0/1 as a source port for the mirroring group.
[DeviceA] mirroring-group 1 mirroring-port gigabitethernet 1/0/1 both
# Configure GigabitEthernet 1/0/2 as the egress port for the mirroring group.
[DeviceA] mirroring-group 1 monitor-egress gigabitethernet 1/0/2
# Configure port GigabitEthernet 1/0/2 as a trunk port, and assign the port to VLAN 2.
23
[DeviceA] interface gigabitethernet 1/0/2
[DeviceA-GigabitEthernet1/0/2] port link-type trunk
[DeviceA-GigabitEthernet1/0/2] port trunk permit vlan 2
# Disable the spanning tree feature on the port.
[DeviceA-GigabitEthernet1/0/2] undo stp enable
[DeviceA-GigabitEthernet1/0/2] quit
24
Figure 9 Network diagram
/4
1/0
GE
GE
1/
0/
5
Procedure
# Create remote source group 1.
<Device> system-view
[Device] mirroring-group 1 remote-source
# Configure GigabitEthernet 1/0/1 through GigabitEthernet 1/0/3 as source ports of remote source
group 1.
[Device] mirroring-group 1 mirroring-port gigabitethernet 1/0/1 to gigabitethernet 1/0/3
both
# Configure an unused port (GigabitEthernet 1/0/6 in this example) as the reflector port of remote
source group 1.
[Device] mirroring-group 1 reflector-port gigabitethernet 1/0/6
This operation may delete all settings made on the interface. Continue? [Y/N]:y
# Create VLAN 10 and assign the ports connecting the data monitoring devices to the VLAN.
[Device] vlan 10
[Device-vlan10] port gigabitethernet 1/0/4 to gigabitethernet 1/0/5
[Device-vlan10] quit
25
Layer 3 remote port mirroring configuration example
Network requirements
On a Layer 3 network shown in Figure 10, configure Layer 3 remote port mirroring to enable the
server to monitor the bidirectional traffic of the Marketing department.
Figure 10 Network diagram
Configuration procedure
1. Configure IP addresses for the tunnel interfaces and related ports on the devices. (Details not
shown.)
2. Configure Device A (the source device):
# Create a service loopback group 1 and specify the unicast tunnel service for the group.
<DeviceA> system-view
[DeviceA] service-loopback group 1 type tunnel
# Assign GigabitEthernet 1/0/3 to the service loopback group 1.
[DeviceA] interface gigabitethernet 1/0/3
[DeviceA-GigabitEthernet1/0/3] port service-loopback group 1
All configurations on the interface will be lost. Continue?[Y/N]:y
[DeviceA-GigabitEthernet1/0/3] quit
# Create tunnel interface Tunnel 1 that operates in GRE mode, and configure an IP address
and subnet mask for the interface.
[DeviceA] interface tunnel 1 mode gre
[DeviceA-Tunnel1] ip address 50.1.1.1 24
# Configure source and destination IP addresses for Tunnel 1.
[DeviceA-Tunnel1] source 20.1.1.1
[DeviceA-Tunnel1] destination 30.1.1.2
[DeviceA-Tunnel1] quit
# Enable the OSPF protocol.
[DeviceA] ospf 1
[DeviceA-ospf-1] area 0
[DeviceA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[DeviceA-ospf-1-area-0.0.0.0] network 20.1.1.0 0.0.0.255
[DeviceA-ospf-1-area-0.0.0.0] quit
[DeviceA-ospf-1] quit
# Create local mirroring group 1.
26
[DeviceA] mirroring-group 1 local
# Configure GigabitEthernet 1/0/1 as a source port and Tunnel 1 as the monitor port of local
mirroring group 1.
[DeviceA] mirroring-group 1 mirroring-port gigabitethernet 1/0/1 both
[DeviceA] mirroring-group 1 monitor-port tunnel 1
3. Enable the OSPF protocol on Device B (the intermediate device).
<DeviceB> system-view
[DeviceB] ospf 1
[DeviceB-ospf-1] area 0
[DeviceB-ospf-1-area-0.0.0.0] network 20.1.1.0 0.0.0.255
[DeviceB-ospf-1-area-0.0.0.0] network 30.1.1.0 0.0.0.255
[DeviceB-ospf-1-area-0.0.0.0] quit
[DeviceB-ospf-1] quit
4. Configure Device C (the destination device):
# Create a service loopback group 1 and specify the unicast tunnel service for the group.
<DeviceC> system-view
[DeviceC] service-loopback group 1 type tunnel
# Assign GigabitEthernet 1/0/3 to the service loopback group 1.
[DeviceC] interface gigabitethernet 1/0/3
[DeviceC-GigabitEthernet1/0/3] port service-loopback group 1
All configurations on the interface will be lost. Continue?[Y/N]:y
[DeviceC-GigabitEthernet1/0/3] quit
# Create tunnel interface Tunnel 1 that operates in GRE mode, and configure an IP address
and subnet mask for the interface.
[DeviceC] interface tunnel 1 mode gre
[DeviceC-Tunnel1] ip address 50.1.1.2 24
# Configure source and destination IP addresses for Tunnel 1.
[DeviceC-Tunnel1] source 30.1.1.2
[DeviceC-Tunnel1] destination 20.1.1.1
[DeviceC-Tunnel1] quit
# Enable the OSPF protocol.
[DeviceC] ospf 1
[DeviceC-ospf-1] area 0
[DeviceC-ospf-1-area-0.0.0.0] network 30.1.1.0 0.0.0.255
[DeviceC-ospf-1-area-0.0.0.0] network 40.1.1.0 0.0.0.255
[DeviceC-ospf-1-area-0.0.0.0] quit
[DeviceC-ospf-1] quit
# Create local mirroring group 1.
[DeviceC] mirroring-group 1 local
# Configure GigabitEthernet 1/0/1 as a source port for local mirroring group 1.
[DeviceC] mirroring-group 1 mirroring-port gigabitethernet 1/0/1 inbound
# Configure GigabitEthernet 1/0/2 as the monitor port for local mirroring group 1.
[DeviceC] mirroring-group 1 monitor-port gigabitethernet 1/0/2
27
Type: Local
Status: Active
Mirroring port:
GigabitEthernet1/0/1 Both
Monitor port: Tunnel1
28
Configuring flow mirroring
Flow mirroring copies packets matching a class to a destination for packet analyzing and monitoring.
It is implemented through QoS policies.
To configure flow mirroring, perform the following tasks:
• Define traffic classes and configure match criteria to classify packets to be mirrored. Flow
mirroring allows you to flexibly classify packets to be analyzed by defining match criteria.
• Configure traffic behaviors to mirror the matching packets to the specified destination.
You can configure an action to mirror the matching packets to one of the following destinations:
• Interface—The matching packets are copied to an interface connecting to a data monitoring
device. The data monitoring device analyzes the packets received on the interface.
• CPU—The matching packets are copied to the CPU of the card where they are received. The
CPU analyzes the packets or delivers them to upper layers.
For more information about QoS policies, traffic classes, and traffic behaviors, see ACL and QoS
Configuration Guide.
29
Step Command Remarks
30
Step Command
1. Enter system view. system-view
2. Enter interface view. interface interface-type interface-number
3. Apply a policy to the interface. qos apply policy policy-name { inbound | outbound }
Step Command
1. Enter system view. system-view
Step Command
1. Enter system view. system-view
2. Apply a QoS policy globally. qos apply policy policy-name global { inbound |
outbound }
Step Command
1. Enter system view. system-view
• In standalone mode:
control-plane slot slot-number
2. Enter control plane view.
• In IRF mode:
control-plane chassis chassis-number slot slot-number
3. Apply a QoS policy to the
control plane. qos apply policy policy-name { inbound | outbound }
31
Flow mirroring configuration example
Network requirements
As shown in Figure 11, configure flow mirroring so that the server can monitor the following traffic:
• All traffic that the Technical department sends to access the Internet.
• IP traffic that the Technical department sends to the Marketing department during working
hours (8:00 to 18:00) on weekdays.
Figure 11 Network diagram
Configuration procedure
# Create working hour range work, in which working hours are from 8:00 to 18:00 on weekdays.
<DeviceA> system-view
[DeviceA] time-range work 8:00 to 18:00 working-day
# Create ACL 3000 to allow packets from the Technical department to access the Internet and to the
Marketing department during working hours.
[Device] acl advanced 3000
[Device-acl-ipv4-adv-3000] rule permit tcp source 192.168.2.0 0.0.0.255 destination-port
eq www
[Device-acl-ipv4-adv-3000] rule permit ip source 192.168.2.0 0.0.0.255 destination
192.168.1.0 0.0.0.255 time-range work
[Device-acl-ipv4-adv-3000] quit
# Create traffic class tech_c, and configure the match criterion as ACL 3000.
[DeviceA] traffic classifier tech_c
[DeviceA-classifier-tech_c] if-match acl 3000
[DeviceA-classifier-tech_c] quit
# Create traffic behavior tech_b, configure the action of mirroring traffic to port GigabitEthernet
1/0/3.
[DeviceA] traffic behavior tech_b
[DeviceA-behavior-tech_b] mirror-to interface gigabitethernet 1/0/3
[DeviceA-behavior-tech_b] quit
32
# Create QoS policy tech_p, and associate traffic class tech_c with traffic behavior tech_b in the
QoS policy.
[DeviceA] qos policy tech_p
[DeviceA-qospolicy-tech_p] classifier tech_c behavior tech_b
[DeviceA-qospolicy-tech_p] quit
33