Description

This article provides a configuration to sample MPLS flows on MX series routers.

Symptoms

To sample MPLS flows and export these flows to a cflowd collector.

Solution


Test topology :

 

R1(PE) < ge-1/0/2.100 ------ ge-1/3/7.100 > R2(P) < ge-1/0/2.200 ------ ge-1/3/7.200 > R3(PE)

Configuration of router R2 :
[edit]
lab@R2# show interfaces ge-1/3/7                                                     
vlan-tagging;
mtu 1500;
unit 100 {
    vlan-id 100;
    family inet {
        address 100.100.100.2/30;
    }
    family mpls {
        filter {
            input mpls_sample;
        }
    }
}

[edit]
lab@R2# show services
flow-tap {
    tunnel-interface vt-8/0/0.0;
}
flow-monitoring {
    version9 {
        template ip-template {        
            flow-active-timeout 20;   
            flow-inactive-timeout 120;
            ipv4-template;
        }
        template mpls-template-1 {
            mpls-template {
                label-position [ 1 3 4 ]; 
            }
        }
        template mpls-ipv4-template-1 {
            mpls-ipv4-template {
                label-position [ 1 2 ];   
            }
        }
    }
}

[edit]
lab@R2# show forwarding-options
sampling {
    input {
        rate 1;
    }
    family mpls {
        output {
            flow-inactive-timeout 30;
            flow-active-timeout 60;
            flow-server 1.2.3.4 {
                port 2055;
                version9 {
                    template {
                        mpls-ipv4-template-1;
                    }
                }
            }
            interface sp-8/0/0 {
                source-address 1.1.1.1;
            }
        }
    }
}

[edit]
lab@R2# show firewall family mpls filter mpls_sample
term default {
    then {
        count mpls-in;
        sample;
        accept;
    }
}

[edit]
lab@R2# show chassis
fpc 8 {
    pic 0 {
        tunnel-services;
    }
}

Verification :

lab@R2# run show services accounting aggregation template template-name mpls-ipv4-template-1 extensive
  MPLS label 1: 299776, MPLS label 2: 0, MPLS label 3: 0
  Source address: 172.100.100.1, Destination address: 127.0.0.1, Top Label Address: 172.100.100.3
  Source port: 51203, Destination port: 3503
  Protocol: 17, TOS: 0, TCP flags: 0
  Source mask: 32, Destination mask: 0
  Input SNMP interface index: 613, Output SNMP interface index: 612
  Start time: 5832510, End time: 6063500
  Packet count: 51, Byte count: 4284    < look for incrementing counters