Thursday, 18 July 2013

Junos : SRX Traffic Shaping

let us assume, you want to limit traffic coming from the subnet 10.132.245.0/24 to 50Mbps on the outgoing interface ge-0/0/0.

Here is how you do it:

Note: monitor  the 'ddn' queue and 'ddn scheduler'.

Configuration:

class-of-service {
    forwarding-classes {
       queue 1 real-time;
       queue 2 burst-hi;
       queue 0 best-effort;
       queue 3 network-control;
       queue 4 ddn;
    }
interfaces {
    ge-0/0/0 {
        unit * {
            scheduler-map cos-map;
            shaping-rate 1g;
        }
    }
}
scheduler-maps {
    cos-map {
        forwarding-class real-time scheduler rt-scheduler;
        forwarding-class burst-hi scheduler bh-scheduler;
        forwarding-class best-effort scheduler be-scheduler;
        forwarding-class network-control scheduler nc-scheduler;
        forwarding-class ddn scheduler ddn-scheduler;
    }
}
schedulers {
    nc-scheduler {
        transmit-rate 70k;
        buffer-size percent 5;
        priority high;
    }
rt-scheduler {
    transmit-rate 50k;
    buffer-size percent 1;
    priority high;
}
bh-scheduler {
    transmit-rate 100k;
    buffer-size percent 10;
    priority medium-high;
}
be-scheduler {
    transmit-rate remainder;
    buffer-size remainder;
    priority low;
}
ddn-scheduler {
    transmit-rate 50m exact; << Key word “exact” solved the issue
    buffer-size percent 40;
    priority low;
}
}
}

firewall {
    family inet {
        filter ddn-traffic {
            term 1 {
               from {
                   source-address {
                       10.132.245.0/24;
                   }
               }
then {
    forwarding-class ddn;
       accept;
}
            }
term default {
    then {
       forwarding-class best-effort;
           accept;
   }
}
        }
   }
}

Procedure:
  1. Create a separate queue; that is the queue for ddn.

  2. Then create a scheduler; that is the ddn-scheduler.

  3. Define the exact rate, at which you want to limit the traffic that belongs to that class.

  4. Create a scheduler-map and attach the ddn-scheduler to the map.

  5. Define a firewall filter, which matches the traffic you want to forward through the ddn class.

  6. If the exact keyword is not defined, then the traffic will go up to 50Mbps and then snatch the available BW; if no other class is utilizing the BW.

2 comments:

loading...