This KB provide you the example of the mimimum configuration of seting up the COS on Juniper EX series, the verification and explanation of every steps.
You can configure COS on Juniper EX boxes, in purpose of set traffic to a specific queue or ensure the important traffic not bing droped.
Topology:
HOST A —-ge-0/0/0| EX2200 |ge-0/0/1———HOST B
In this example, I would like to set a new queue which number is 2, named it as richz, set the buffer and transmit rate to this queue.
Also, I would like to match the traffic which from 1.1.1.0/24 subnet, then send it to the queue which name is richz.
Configuration on EX:
root# show class-of-service forwarding-classes { class richz queue-num 2; } interfaces { ge-0/0/0 { scheduler-map richz-M; } } scheduler-maps { richz-M { forwarding-class richz scheduler richz-S; } } schedulers { richz-S { transmit-rate percent 10; buffer-size percent 10; priority strict-high; } } root# show firewall family ethernet-switching { filter richz-F { term 1 { from { source-address { 1.1.1.0/24; } } then { forwarding-class richz; loss-priority low; } } term else { then accept; } } }
Every steps of COS:
1.Define the queue, queue name and queue number.
set class-of-service forwarding-classes class richz queue-num 2
2.Set the scheduler, to define the transmit-rate and buffer usage of this queue.
set class-of-service schedulers richz-S transmit-rate percent 10
set class-of-service schedulers richz-S buffer-size percent 10
set class-of-service schedulers richz-S priority strict-high
3.Set a scheduler-map to match the scheduler to the scheduler-map.
set class-of-service scheduler-maps richz-M forwarding-class richz scheduler richz-S
4. Add the map to the incoming interface(in this environment, ge-0/0/0 is the traffic incoming interface, traffic from ge-0/0/0 to ge-0/0/1 )
set class-of-service interfaces ge-0/0/0 scheduler-map richz-M
5.Set up the firewall filter to match the source-address which is 1.1.1.0/24 subnet, then put them in queue ‘richz’
set firewall family ethernet-switching filter richz-F term 1 from source-address 1.1.1.0/24
set firewall family ethernet-switching filter richz-F term 1 then forwarding-class richz
set firewall family ethernet-switching filter richz-F term 1 then loss-priority low
set firewall family ethernet-switching filter richz-F term else then accept
6.Add the firewall filter to the input of the ge-0/0/0.
set interfaces ge-0/0/0 unit 0 family ethernet-switching filter input richz-F
COS verification:
Becase of COS only working on the egress direction. So in this case we need to verify if it works on ge-0/0/1 interface.
root# run show interfaces ge-0/0/1 extensive Physical interface: ge-0/0/1, Enabled, Physical link is Down Interface index: 130, SNMP ifIndex: 504, Generation: 133 Link-level type: Ethernet, MTU: 1514, Speed: Auto, Duplex: Auto, BPDU Error: None, MAC-REWRITE Error: None, Loopback: Disabled, Source filtering: Disabled, Flow control: Enabled, Auto-negotiation: Enabled, Remote fault: Online, Media type: Copper Device flags : Present Running Down Interface flags: Hardware-Down 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: 3c:61:04:68:cd:84, Hardware address: 3c:61:04:68:cd:84 Last flapped : 2016-04-19 08:00:02 UTC (00:11:02 ago) Statistics last cleared: Never Traffic statistics: Input bytes : 614177 0 bps Output bytes : 3761917 0 bps Input packets: 5680 0 pps Output packets: 46140 0 pps IPv6 transit statistics: 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: 10, 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, 5 in use Queue counters: Queued packets Transmitted packets Dropped packets 0 best-effort 0 1572 0 1 assured-forw 0 0 0 2 richz 0 387 0 5 expedited-fo 0 0 0 7 network-cont 0 44181 0