You configure port mirroring in order to copy packets so that you can analyze traffic using a protocol analyzer application. You can mirror traffic entering or exiting an interface, or entering a VLAN. You can send the mirrored packets to a local interface to monitor traffic locally or to a VLAN to monitor traffic remotely.
We recommend that you disable port mirroring when you are not using it and select specific input interfaces in preference to using the all keyword. You can also limit the amount of mirrored traffic by using a firewall filter or the ratio keyword to mirror only a selection of packets.
Note: If you want to create additional analyzers without deleting the existing analyzer, first disable the existing analyzer using thedisable analyzer analyzer-name command or the J-Web configuration page for port mirroring. |
Note: Interfaces used as input or output for a port mirror analyzer must be configured as family ethernet-switching. |
To mirror interface traffic or VLAN traffic on the switch to an interface on the switch:
[edit ethernet-switching-options]
user@switch# set analyzer employee-monitor input ingress interface ge–0/0/0.0
user@switch# set analyzer employee-monitor input ingress interface ge–0/0/1.0
[edit ethernet-switching-options]
user@switch# set analyzer employee-monitor ratio 200
When the ratio is set to 200, 1 of every 200 packets is mirrored to the analyzer. You can use statistical sampling to reduce the volume of mirrored traffic, as a high volume of mirrored traffic can be performance intensive for the switch.
[edit ethernet-switching-options]
user@switch# set analyzer employee-monitor output interface ge-0/0/10.0
To mirror traffic that is traversing interfaces or a VLAN on the switch to a VLAN for analysis from a remote location:
[edit]
user@switch# set vlans remote-analyzer vlan-id 999
[edit]
user@switch# set interfaces ge-0/1/1 unit 0 family ethernet-switching port-mode trunk vlan members 999
[edit ethernet-switching-options]
user@switch# set analyzer employee–monitor loss-priority high
[edit ethernet-switching-options]
user@switch# set analyzer employee–monitor input ingress interface ge-0/0/0.0
user@switch# set analyzer employee–monitor input ingress interface ge-0/0/1.0
[edit ethernet-switching-options]
user@switch# set analyzer employee-monitor output vlan 999
[edit ethernet-switching-options]
user@switch# set analyzer employee-monitor ratio 200
When the ratio is set to 200, 1 out of every 200 packets is mirrored to the analyzer. You can use this to reduce the volume of mirrored traffic as a very high volume of mirrored traffic can be performance intensive for the switch.
To filter which packets are mirrored to an analyzer, create the analyzer, then use it as the action in the firewall filter. You can use firewall filters in both local and remote port mirroring configurations.
If the same analyzer is used in multiple filters or terms, the packets are copied to the analyzer output port or analyzer VLAN only once.
To filter mirrored traffic, create an analyzer and then create a firewall filter. The filter can use any of the available match conditions and must have an action of analyzeranalyzer-name. The action of the firewall filter provides the input to the analyzer.
To configure port mirroring with filters:
[edit ethernet-switching-options]
user@switch# set analyzer employee-monitor output interface ge-0/0/10.0
[edit ethernet-switching-options]
user@switch#set analyzer employee–monitor loss-priority high output vlan 999
This example shows a firewall filter called example-filter, with two terms:
[edit firewall family ethernet-switching]
user@switch# set filter example-filter term term-1 from match-condition1
user@switch# set filter example-filter term term-1 from match-condition2
user@switch# set filter example-filter term term-1 then accept
[edit firewall family ethernet-switching]
user@switch# set filter example-filter term term-2 from match-condition3
user@switch# set filter example-filter term term-2 then analyzer employee–monitor
[edit]
user@switch# set interfaces interface-name unit 0 family ethernet-switching filter input example-filter
user@switch# set vlan vlan-name unit 0 family ethernet-switching filter input example-filter