Going back to the diagram we used in part 1. Let’s say that we want to shape certain traffic to certain bandwidths under congestion. I want EF packets to get 20Mb priority, AF31 packets to get 50Mb and whatever is left to get 30Mb. I want to enable WRED in the BE queue, and also modify the default WRED profile.
I’m going to take the assumption that packets have already been marked correctly as shown in my first post.
IOS
IOS is very simple in it’s configuration:
policy-map OUTBOUND_QOS
class EF
priority 20000
class AF31
bandwidth 50000
class class-default
random-detect dscp-based
random-detect dscp 0 20 40 5
!
interface FastEthernet0/0
ip address 10.0.0.1 255.255.255.252
service-policy output OUTBOUND_QOS
There are three classes in the service policy. Class EF has priority 20Mb, class AF31 has bandwidth 50Mb, and class-default has all that’s left. I’ve also set up WRED and it will start to drop packets when the queue level hits 20. One it hits 40 it’ll be dropping 20% of all packets (1/5) and any more packets will cause tail-drop.
Junos
In Junos, we first create our RED profile:
darreno@JR2> show configuration class-of-service drop-profiles
relaxed {
fill-level 50 drop-probability 10;
fill-level 75 drop-probability 15;
fill-level 95 drop-probability 20;
}
We then create our schedulers, which tells Junos how to treat each queue:
darreno@JR2> show configuration class-of-service schedulers
EF {
transmit-rate 20m;
priority strict-high;
}
AF31 {
transmit-rate 50m;
}
BE {
transmit-rate 30m;
drop-profile-map loss-priority any protocol any drop-profile relaxed;
}
We then create a scheduler-map, which tells Junos what traffic belongs in each queue:
darreno@JR2> show configuration class-of-service scheduler-maps
OUTBOUND-QOS {
forwarding-class expedited-forwarding scheduler EF;
forwarding-class assured-forwarding scheduler AF31;
forwarding-class best-effort scheduler BE;
}
Finally this is applied to the interface. Note that this happens under the class-of-service stanza and NOT the actual interface stanza:
darreno@JR2> show configuration class-of-service interfaces
fe-0/0/7 {
scheduler-map OUTBOUND-QOS;
}
Verification
The best command for checking a service policy applied to an interface is show policy-map interface interface-name:
R1#sh policy-map interface fa0/0
FastEthernet0/0
Service-policy output: OUTBOUND_QOS
queue stats for all priority classes:
Queueing
queue limit 64 packets
(queue depth/total drops/no-buffer drops) 0/0/0
(pkts output/bytes output) 0/0
Class-map: EF (match-all)
0 packets, 0 bytes
5 minute offered rate 0000 bps, drop rate 0000 bps
Match: dscp ef (46)
Priority: 20000 kbps, burst bytes 500000, b/w exceed drops: 0
Class-map: AF31 (match-all)
0 packets, 0 bytes
5 minute offered rate 0000 bps, drop rate 0000 bps
Match: dscp af31 (26)
Queueing
queue limit 64 packets
(queue depth/total drops/no-buffer drops) 0/0/0
(pkts output/bytes output) 0/0
bandwidth 50000 kbps
Class-map: class-default (match-any)
800 packets, 48000 bytes
5 minute offered rate 0000 bps, drop rate 0000 bps
Match: any
queue limit 64 packets
(queue depth/total drops/no-buffer drops) 0/0/0
(pkts output/bytes output) 800/48000
Exp-weight-constant: 9 (1/512)
Mean queue depth: 0 packets
dscp Transmitted Random drop Tail drop Minimum Maximum Mark
pkts/bytes pkts/bytes pkts/bytes thresh thresh prob
default 554/33240 0/0 0/0 20 40 1/5
This shows each of the queues as well as our RED profile attached to the class-default queue.
On Junos its a bit more cryptic. To see the bandwidth attached to each queue:
darreno@JR2> show interfaces fe-0/0/7 extensive | find "CoS information"
CoS information:
Direction : Output
CoS transmit queue Bandwidth Buffer Priority Limit
% bps % usec
0 best-effort 30 30000000 r 0 low none
1 expedited-forwarding 20 20000000 r 0 strict-high none
2 assured-forwarding 50 50000000 r 0 low none
Interface transmit statistics: Disabled
Logical interface fe-0/0/7.0 (Index 75) (SNMP ifIndex 520) (Generation 140)
Flags: Device-Down SNMP-Traps 0x0 Encapsulation: ENET2
Traffic statistics:
Input bytes : 2426330700
Output bytes : 90196588
Input packets: 1770438
Output packets: 872568
etc etc etc
To see the bits in each queue:
darreno@JR2> show interfaces queue fe-0/0/7
Physical interface: fe-0/0/7, Enabled, Physical link is Down
Interface index: 141, SNMP ifIndex: 519
Forwarding classes: 8 supported, 4 in use
Egress queues: 8 supported, 4 in use
Queue: 0, Forwarding classes: best-effort
Queued:
Packets : 863884 0 pps
Bytes : 106578924 0 bps
Transmitted:
Packets : 863884 0 pps
Bytes : 106578924 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
Queue: 1, Forwarding classes: expedited-forwarding
Queued:
Packets : 0 0 pps
Bytes : 0 0 bps
Transmitted:
Packets : 0 0 pps
Bytes : 0 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
Queue: 2, Forwarding classes: assured-forwarding
Queued:
Packets : 0 0 pps
Bytes : 0 0 bps
Transmitted:
Packets : 0 0 pps
Bytes : 0 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
Queue: 3, Forwarding classes: network-control
Queued:
Packets : 8684 0 pps
Bytes : 451568 0 bps
Transmitted:
Packets : 8684 0 pps
Bytes : 451568 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
I must admit, I much prefer the Cisco implementation of show policy-map interfaces