This section provides an example for configuring local port mirroring in a 1:N scenario to copy packets received by a mirrored port to multiple observing ports.
As shown in Figure 1, user packets from VLAN 10 and VLAN 20 are sent to the Device through a switch. To monitor VLAN10 packets that the Device receives through interface 1, configure interface 2 and interface 3 on the Device as observing ports, and interface 1 as a mirrored port. Then, map the mirrored port to the observing ports. In this manner, all the packets of VLAN 10 received by interface 1 can be copied to interface 2 and interface 3.
Device Name |
Interface Name |
IP Address |
---|---|---|
Device |
GE 0/1/0.1 |
- |
Device |
GE 0/1/8 |
10.10.1.1/24 |
Device |
GE 0/1/16 |
10.1.1.2/24 |
The configuration roadmap is as follows:
Configure GE 0/1/8 and GE 0/1/16 on the Device as observing ports.
Configure GE 0/1/0.1 of the Device as a mirrored port and enable the port mirroring function.
To complete the configuration, you need the following data:
Types and numbers of the observing ports and mirrored port
<Device> system-view [~Device] interface gigabitethernet0/1/8 [~Device-GigabitEthernet0/1/8] port-observing observe-index 1 [*Device-GigabitEthernet0/1/8] commit [~Device-GigabitEthernet0/1/8] quit [~Device] interface gigabitethernet0/1/16 [~Device-GigabitEthernet0/1/16] port-observing observe-index 2 [*Device-GigabitEthernet0/1/16] commit [~Device-GigabitEthernet0/1/16] quit
[~Device] interface gigabitethernet0/1/0.1 [*Device-GigabitEthernet0/1/0.1] vlan-type dot1q 10 [*Device-GigabitEthernet0/1/0.1] port-mirroring inbound [*Device-GigabitEthernet0/1/0.1] commit [~Device-GigabitEthernet0/1/0.1] quit
[~Device] interface gigabitethernet0/1/0.1 [~Device-GigabitEthernet0/1/0.1] port-mirroring to observe-index 1 2 [*Device-GigabitEthernet0/1/0.1] commit [~Device-GigabitEthernet0/1/0.1] quit
After the configuration is complete, the packets of VLAN 10 received by GE 0/1/0.1 are mirrored to GE 0/1/8 and GE 0/1/16.
The switch sends 10 packets with the VLAN ID being 10 to the mirrored port GE 0/1/0.1 of the Device. The observing ports GE 0/1/8 and GE 0/1/16 can forward all the packets with the VLAN ID being 10 received by the mirrored port GE 0/1/0.1. Run the display interface command to check packet statistics on GE 0/1/8.
<Device> display interface gigabitethernet0/1/8 GigabitEthernet0/1/8 current state : UP Line protocol current state : UP Description:HUAWEI, GigabitEthernet0/1/8 Interface Route Port,The Maximum Transmit Unit is 1500 Internet protocol processing : disabled IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 00e0-fc7d-a497 The Vendor PN is HFBR-5710L Port BW: 1G, Transceiver max BW: 1G, Transceiver Mode: MultiMode WaveLength: 850nm, Transmission Distance: 550m Loopback:none, full-duplex mode, negotiation: disable, Pause Flowcontrol:Send and Receive Enable Statistics last cleared:never Last 300 seconds input rate: 0 bits/sec, 0 packets/sec Last 300 seconds output rate: 0 bits/sec, 0 packets/sec Input: 560 bytes, 10 packets Output: 560 bytes, 10 packets Input: Unicast: 0, Multicast: 0 Broadcast: 0, JumboOctets: 0 CRC: 0, Symbol: 0 Overrun: 0 , InRangeLength: 0 LongPacket: 0 , Jabber: 0, Alignment: 0 Fragment: 0, Undersized Frame: 0 RxPause: 0 Output: Unicast: 10, Multicast: 0 Broadcast: 0, Jumbo: 0 Lost: 0, Overflow: 0, Underrun: 0 TxPause: 0
Device configuration file
# sysname Device # interface GigabitEthernet0/1/0 ip address 10.30.1.1 255.255.255.0 # interface GigabitEthernet0/1/0.1 vlan-type dot1q 10 port-mirroring inbound port-mirroring to observe-index 1 2 # interface GigabitEthernet0/2/0 ip address 10.10.1.1 255.255.255.0 port-observing observe-index 1 # interface GigabitEthernet0/3/0 ip address 10.1.1.2 255.255.255.0 port-observing observe-index 2 # return