Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; coreSLframework has a deprecated constructor in /var/www/rtoodtoo.net/wp-content/plugins/enable-latex/core.class.php on line 1698

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; SLFramework_Table has a deprecated constructor in /var/www/rtoodtoo.net/wp-content/plugins/enable-latex/core/admin_table.class.php on line 15

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; adminCell has a deprecated constructor in /var/www/rtoodtoo.net/wp-content/plugins/enable-latex/core/admin_table.class.php on line 317

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; SLFramework_Tabs has a deprecated constructor in /var/www/rtoodtoo.net/wp-content/plugins/enable-latex/core/tabs.class.php on line 11

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; SLFramework_Box has a deprecated constructor in /var/www/rtoodtoo.net/wp-content/plugins/enable-latex/core/box.class.php on line 10

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; SLFramework_BrowsersOsDetection has a deprecated constructor in /var/www/rtoodtoo.net/wp-content/plugins/enable-latex/core/browser.class.php on line 11

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; SLFramework_Feedback has a deprecated constructor in /var/www/rtoodtoo.net/wp-content/plugins/enable-latex/core/feedback.class.php on line 11

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; SLFramework_OtherPlugins has a deprecated constructor in /var/www/rtoodtoo.net/wp-content/plugins/enable-latex/core/otherplugins.class.php on line 12

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; SLFramework_Parameters has a deprecated constructor in /var/www/rtoodtoo.net/wp-content/plugins/enable-latex/core/parameters.class.php on line 10

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; SLFramework_Popup has a deprecated constructor in /var/www/rtoodtoo.net/wp-content/plugins/enable-latex/core/popup.class.php on line 12

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; SLFramework_Progressbar has a deprecated constructor in /var/www/rtoodtoo.net/wp-content/plugins/enable-latex/core/progress_bar.class.php on line 10

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; SLFramework_Translation has a deprecated constructor in /var/www/rtoodtoo.net/wp-content/plugins/enable-latex/core/translation.class.php on line 11

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; SLFramework_Textdiff has a deprecated constructor in /var/www/rtoodtoo.net/wp-content/plugins/enable-latex/core/text_diff.class.php on line 11

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; SLFramework_Treelist has a deprecated constructor in /var/www/rtoodtoo.net/wp-content/plugins/enable-latex/core/tree.class.php on line 12
Port mirroring in EX switches and SRX – RtoDto.net

Port mirroring in EX switches and SRX

If you want to mirror traffic entering and exiting a specific port (e.g ge-0/0/11.0) you can use the following configuration to mirror the traffic to any other port (e.g ge-0/0/10.0)

Here is the configuration I wrote in an ex2200 switch.

Port mirroring in EX switches

[edit ethernet-switching-options analyzer port-mirror]
root@ex2200-1# show
input {
    ingress {
        interface ge-0/0/11.0;
    }
    egress {
        interface ge-0/0/11.0;
    }
}
output {
    interface {
        ge-0/0/10.0;
    }
}

[edit ethernet-switching-options analyzer port-mirror]
root@ex2200-1# show | display set
set ethernet-switching-options analyzer port-mirror input ingress interface ge-0/0/11.0
set ethernet-switching-options analyzer port-mirror input egress interface ge-0/0/11.0
set ethernet-switching-options analyzer port-mirror output interface ge-0/0/10.0

Port mirroring is pretty simple in EX switches compared to SRX series. You just specify input interface and direction of the traffic (ingress,egress) then the output interface which will receive the mirrored traffic.

Port Mirroring in SRX firewalls

By its nature, SRX is more complex and it seems port mirroring isn’t supported in switching interfaces either. Below are the steps that I took to mirror my fe-0/0/0 traffic to a device having IP 172.16.1.2 connected to fe-0/0/6.0 interface. In a nutshell;

Source interface: fe-0/0/0.0
Destination interface: fe-0/0/6.0 (with ip 172.16.1.2)

1) Configure port-mirroring options

[edit forwarding-options port-mirroring]
root@srx100-1# show
input {
    rate 1;
    run-length 12;
}
family inet {
    output {
        interface fe-0/0/6.0 {
            next-hop 172.16.1.2;
        }
    }
}

2) Configure firewall filter (specify the traffic you are interested)

[edit firewall]
root@srx100-1# show
filter port-mirror {
    term all-traf {
        from {
            source-address {
                0.0.0.0/0;
            }
        }
        then {
            port-mirror;
            accept;
        }
    }
}

3) Apply the filter step 2 to the interface (from which you want to mirror traffic)

[edit interfaces fe-0/0/0]
root@srx100-1# show
unit 0 {
    family inet {
        filter {
            input port-mirror;
            output port-mirror;
        }
        address 192.168.2.100/24;
    }
}

fe-0/0/6.0 configuration (destination interface)

root@srx100-1# show interfaces fe-0/0/6.0
family inet {
    address 172.16.1.1/24;
}

Warning: Be careful and don’t leave the port mirroring on after you finish your work.

About: rtoodtoo

Worked for more than 10 years as a Network/Support Engineer and also interested in Python, Linux, Security and SD-WAN // JNCIE-SEC #223 / RHCE / PCNSE


6 thoughts on “Port mirroring in EX switches and SRX”

  1. Thank for posting this. This works on SRX indeed, and I didn’t see other sites explaining how to do this on an SRX!

Leave a Reply to rtoodtooCancel reply

Discover more from RtoDto.net

Subscribe now to keep reading and get access to the full archive.

Continue reading