Description

This article provides information on how to map traffic, which is stamped with a specific source-class, to a particular forwarding class for queuing.

Symptoms

Information on how to map traffic, which is stamped with a specific source-class, to a particular forwarding class for queuing.

Solution


Topology :
(Destination-172.16.157.1)R1-(GE-1/1/1)R2(GE-1/1/2)-R3(Source-202.202.202.202)
  1. Enable accounting in the input direction on the ingress interface and output direction on the egress interface:
    lab@R2# show interfaces ge-1/1/2 
    unit 0 {
        family inet {
            accounting {
                source-class-usage {
                    input;
                }
            }
            address 20.20.20.1/30;
        }
    }
    
    lab@R2# show interfaces ge-1/1/1 
    unit 0 {
        family inet {
            accounting {
                source-class-usage {
                    output;
                }
             }
            address 10.10.10.2/24;
        }
    }
    

  • Enable the policy to match the source of the traffic and stamp with a particular source-class:
    lab@R2# show policy-options policy-statement SCU-DCU
    term 1 {
    from {
         route-filter 202.202.202.202/32 exact;
    }
    then {
         source-class SCU-ACCOUNTING;
    }
    }

  • Apply the policy under forwarding-options in the routing-options hierarchy:
    lab@R2# show routing-options
    forwarding-table {
         export SCU-DCU;
    }

  • Enable a firewall filter to match the traffic based on the source-class and associate the traffic to the required forwarding-class:
    lab@R2# show firewall family inet filter SCU-DCU-COS
    term 1 {
    from {
         source-class SCU-ACCOUNTING;
    }
    then {
        forwarding-class assured-forwarding;
        accept;
    }
    }
    term 2 {
         then accept;
    }

  • Apply the firewall filter under forwarding-options :
    lab@R2# show forwarding-options
    family inet {
    filter {
         output SCU-DCU-COS;
    }
    }


Excerpt taken on R2 when traffic was initiated from R3 and destined to R1:
lab@R3# run ping 172.16.157.1 rapid count 1000 source 202.202.202.202
PING 172.16.157.1 (172.16.157.1): 56 data bytes
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
--- 172.16.157.1 ping statistics ---
1000 packets transmitted, 1000 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.728/1.078/40.399/1.878 ms

lab@R2> show interfaces ge-1/1/1 extensive | no-more
Physical interface: ge-1/1/1, Enabled, Physical link is Up
Interface index: 178, SNMP ifIndex: 754, Generation: 181
Link-level type: Ethernet, MTU: 1514, Speed: 1000mbps, BPDU Error: None,
MAC-REWRITE Error: None, Loopback: Disabled, Source filtering: Disabled,
Flow control: Enabled, Auto-negotiation: Enabled, Remote fault: Online
Device flags : Present Running
Interface flags: SNMP-Traps Internal: 0x4000
Link flags : None
CoS queues : 8 supported, 8 maximum usable queues
Hold-times : Up 0 ms, Down 0 ms
Current address: 28:c0:da:b0:e3:3b, Hardware address: 28:c0:da:b0:e3:3b
Last flapped : 2012-05-22 14:41:57 UTC (1w0d 00:08 ago)
Statistics last cleared: 2012-05-29 14:49:27 UTC (00:00:45 ago)
Traffic statistics:
Input bytes : 139552 9960 bps
Output bytes : 128527 7560 bps
Input packets: 1237 5 pps
Output packets: 1241 5 pps
IPv6 transit statistics:
Input bytes : 0
Output bytes : 0
Input packets: 0
Output packets: 0
Label-switched interface (LSI) traffic statistics:
Input bytes : 0 0 bps
Input packets: 0 0 pps
Dropped traffic statistics due to STP State:
Input bytes : 0
Output bytes : 0
Input packets: 0
Output packets: 0
Input errors:
Errors: 0, Drops: 0, Framing errors: 0, Runts: 0, Policed discards: 0,
L3 incompletes: 0, L2 channel errors: 0, L2 mismatch timeouts: 0,
FIFO errors: 0, Resource errors: 0
Output errors:
Carrier transitions: 0, Errors: 0, Drops: 0, Collisions: 0, Aged packets: 0,
FIFO errors: 0, HS link CRC errors: 0, MTU errors: 0, Resource errors: 0
Egress queues: 8 supported, 4 in use
Queue counters: Queued packets Transmitted packets Dropped packets
0 best-effort 0 0 0
1 expedited-fo 0 0 0
2 assured-forw 1000 1000 0
3 network-cont 242 242 0
Queue number: Mapped forwarding classes
0 best-effort
1 expedited-forwarding
2 assured-forwarding
3 network-control
Active alarms : None
Active defects : None
MAC statistics: Receive Transmit
Total octets 161920 146460
Total packets 1239 1243
Unicast packets 1214 1215
Broadcast packets 3 0
Multicast packets 22 28
CRC/Align errors 0 0
FIFO errors 0 0
MAC control frames 0 0
MAC pause frames 0 0
Oversized frames 0
Jabber frames 0
Fragment frames 0
VLAN tagged frames 0
Code violations 0
Filter statistics:
Input packet count 1240
Input packet rejects 0
Input DA rejects 0
Input SA rejects 0
Output packet count 1241
Output packet pad count 0
Output packet error count 0
CAM destination filters: 0, CAM source filters: 0
Autonegotiation information:
Negotiation status: Complete
Link partner:
Link mode: Full-duplex, Flow control: Symmetric/Asymmetric,
Remote fault: OK
Local resolution:
Flow control: Symmetric, Remote fault: Link OK
Packet Forwarding Engine configuration:
Destination slot: 1
CoS information:
Direction : Output
CoS transmit queue Bandwidth Buffer Priority Limit
% bps % usec
0 best-effort 95 950000000 95 0 low none
3 network-control 5 50000000 5 0 low none
Interface transmit statistics: Disabled

Logical interface ge-1/1/1.0 (Index 340) (SNMP ifIndex 779) (Generation 301)
Flags: SNMP-Traps 0x4004000 Encapsulation: ENET2
Traffic statistics:
Input bytes : 139636
Output bytes : 127275
Input packets: 1238
Output packets: 1242
Local statistics:
Input bytes : 55888
Output bytes : 43275
Input packets: 239
Output packets: 242
Transit statistics:
Input bytes : 83748 56 bps
Output bytes : 84000 0 bps
Input packets: 999 0 pps
Output packets: 1000 0 pps
Protocol inet, MTU: 1500, Generation: 394, Route table: 0
Flags: Sendbcast-pkt-to-re, SCU-out
Packets Bytes
Source class (packet-per-second) (bits-per-second)

SCU-ACCOUNTING 1000 84000
( 0) ( 0)
Addresses, Flags: Is-Preferred Is-Primary
Destination: 10.10.10/24, Local: 10.10.10.2, Broadcast: 10.10.10.255,
Generation: 219
Protocol iso, MTU: 1497, Generation: 401, Route table: 0
Flags: Is-Primary
Protocol mpls, MTU: 1488, Maximum labels: 3, Generation: 395,
Route table: 0
Protocol multiservice, MTU: Unlimited, Generation: 396, Route table: 0
Policer: Input: __default_arp_policer__

lab@R2> show interfaces queue ge-1/1/1 forwarding-class assured-forwarding
Physical interface: ge-1/1/1, Enabled, Physical link is Up
Interface index: 178, SNMP ifIndex: 754
Forwarding classes: 16 supported, 4 in use
Egress queues: 8 supported, 4 in use
Queue: 2, Forwarding classes: assured-forwarding
Queued:
Packets : 1000 0 pps
Bytes : 122000 0 bps
Transmitted:
Packets : 1000 0 pps
Bytes : 122000 0 bps
Tail-dropped packets : 0 0 pps
RED-dropped packets : 0 0 pps
Low : 0 0 pps
Medium-low : 0 0 pps
Medium-high : 0 0 pps
High : 0 0 pps
RED-dropped bytes : 0 0 bps
Low : 0 0 bps
Medium-low : 0 0 bps
Medium-high : 0 0 bps
High : 0 0 bps

lab@R2> show firewall

Filter: SCU-DCU-COS
Counters:
Name Bytes Packets
SCU-PACKETS 84000 1000

lab@R2>