Documente Academic
Documente Profesional
Documente Cultură
Darren's Blog
Google Engineer. Dual CCIE #38070. JNCIE-SP #2227
Brad Fleming from Kanren gave me remote access to a lab MX5 router in order
to do the Junos section of this port for when I am very grateful!
There are many di erent needs for H-QoS and may di erent ways to con gure
it. I’m going to be going over one particular use case for H-QoS in which I use
on a daily basis. More so than any other type of QoS, H-QoS is very hardware
speci c. Even line-card speci c. In this post I’ll be using a Juniper MX5 and a
Cisco ME3600X, both which allow me to do H-QoS on their gig ports.
My use case is as follows. Core gig ports are not cheap. ‘Revenue ports’ as ISPs
like to call them. Most core kit has a load of gig ports, some 10Gb ports and
maybe 40Gb/100Gb ports.
Not all customers want 1 gig link. Some want 10Mb, others 50Mb, some 300Mb.
Heck some only want 4Mb. In order not to waste precious revenue ports, these
circuits are aggregated into a single physical gig port. i.e. we can put 10 X
100Mb circuits onto a single gig link.
The bigggest problem with doing this is that it gets di cult to give QoS
outbound back to the customer unless your hardware can do H-QoS. Let’s take
the following port diagram as an example:
https://mellowd.co.uk/ccie/?tag=class-of-service 1/23
10/6/2017 Class Of Service | Darren's Blog
The physical port is 1Gb. Here I have two customer circuits attached. Customer
A is paying for 20Mb while Customer B is paying for 70Mb. Not only do I want
to shape their respective queues, I also want to give 30% priority bandwidth to
each customer, inside each queue. So I need to shape vlan 2000 to 20Mb, and
inside that 20Mb ensure 30% is given to EF packets.
IOS
policy-map 30_70
class EF
priority
police cir percent 30 conform-action transmit exceed-action drop
class class-default
queue-limit percent 100
!
policy-map 20Mb
class class-default
shape average 20000000
service-policy 30_70
!
policy-map 70Mb
class class-default
shape average 70000000
service-policy 30_70
https://mellowd.co.uk/ccie/?tag=class-of-service 2/23
10/6/2017 Class Of Service | Darren's Blog
JUNOS
H-QoS on Junos is done using a tra c-control pro le. This allows you to shape
to a speci c rate, attach a scheduler inside that pro le, and attach that pro le
to an interface.
First let’s create our schedulers and scheduler-map:
}
BE {
transmit-rate {
remainder;
}
}
Now we create our tra c pro les and attach the above scheduler-map to it;
Note that you need to con gure hierarchical-scheduler under the interface
itself:
https://mellowd.co.uk/ccie/?tag=class-of-service 4/23
10/6/2017 Class Of Service | Darren's Blog
unit 2000 {
description "Customer 1";
vlan-id 2000;
}
unit 2001 {
description "Customer 2";
vlan-id 2001;
}
VERIFICATION
IOS still has much better veri cation than Junos. I don’t know why Junos makes
it so di cult to view this kind of information. When using service instances in
IOS as above, the veri cation command has changed a bit, somewhat
annoyingly.
Service-policy : 30_70
Class-map: EF (match-all)
0 packets, 0 bytes
5 minute offered rate 0000 bps, drop rate 0000 bps
https://mellowd.co.uk/ccie/?tag=class-of-service 5/23
10/6/2017 Class Of Service | Darren's Blog
Service-policy : 30_70
Class-map: EF (match-all)
0 packets, 0 bytes
5 minute offered rate 0000 bps, drop rate 0000 bps
Match: dscp ef (46)
Strict Priority
https://mellowd.co.uk/ccie/?tag=class-of-service 6/23
10/6/2017 Class Of Service | Darren's Blog
police:
cir percent 30 % bc 250 ms
cir 21000000 bps, bc 656250 bytes
conform-action transmit
exceed-action drop
conform: 0 (packets) 0 (bytes)
exceed: 0 (packets) 0 (bytes)
conform: 0 bps, exceed: 0 bps
Queue-limit current-queue-depth 0 bytes
Output Queue:
Default Queue-limit 49152 bytes
Tail Packets Drop: 0
Tail Bytes Drop: 0
5th August 2013 / JNCIE / child, cisco, class of service, cos, IOS, jcos, jncie, jncie-sp, Juniper, junos,
parent, qos, quality of service, scheduler, sp / 4 Comments
An ethernet physical port can only run at certain speeds. i.e. 10/100/1Gb/etc –
Often customer will purchase a sublevel of bandwidth on that bearer speed. For
example Customer A wants to buy 30Mb of bandwidth. You can’t run the
physicla ports at 30Mb, so the ISP will have the interface run at 100Mb and
police inbound at 30Mb.
https://mellowd.co.uk/ccie/?tag=class-of-service 7/23
10/6/2017 Class Of Service | Darren's Blog
This makes QoS jus a little more complicated. All the ratios we’ve used in the
past will ratio themselves at the WAN port’s physical speed. Also the router will
not know that if 40Mb of burst comes from the LAN, that the actual bandwidth
is only 30Mb.
In this case, you need to rst shape all tra c to 30Mb, and then inside that
shaped queue give priory bandwidth to voice etc..
IOS
IOS uses the concept of parent/child policy maps. The parent will shape the
queue, while the child policy attached will give each queue their respective
bandwidths and priority.
policy-map PARENT
class class-default
shape average 30000000
service-policy CHILD
!
policy-map CHILD
class EF
priority percent 10
police cir percent 10 conform-action transmit exceed-action drop
class class-default
bandwidth remaining percent 100
!
interface FastEthernet0/0
ip address 10.0.0.1 255.255.255.0
service-policy output PARENT
https://mellowd.co.uk/ccie/?tag=class-of-service 8/23
10/6/2017 Class Of Service | Darren's Blog
In this policy the parent policy creates a queue with a bandwidth limit of 30Mb.
Inside that policy rests another that gives EF packets 10 percent of priority
bandwidth of that initial 30Mb queue. I’m also policing that queue as I don’t
want the priority queue to starve other tra c. All other tra c gets 90-100% of
the bandwidth, depending on how much priority tra c is in the queue at any
one time.
JUNOS
As with most QoS topics, the following con guration is quite hardware speci c.
I’ve done the following on an SRX210H. Your con guration might change when
doing the same sort of thing on a M/MX/DC SRX/etc so YMMV.
https://mellowd.co.uk/ccie/?tag=class-of-service 9/23
10/6/2017 Class Of Service | Darren's Blog
Finally apply that map to the interface under class-of-service and con gure the
interface shape rate:
In order for the above to work I need to con gure per-unit-scheduler on the
physical interface:
VERIFICATION
Service-policy : CHILD
https://mellowd.co.uk/ccie/?tag=class-of-service 10/23
10/6/2017 Class Of Service | Darren's Blog
Class-map: EF (match-all)
0 packets, 0 bytes
5 minute offered rate 0000 bps, drop rate 0000 bps
Match: dscp ef (46)
Priority: 10% (3000 kbps), burst bytes 75000, b/w exceed drops:
0
police:
cir 10 %
cir 3000000 bps, bc 93750 bytes
conformed 0 packets, 0 bytes; actions:
transmit
exceeded 0 packets, 0 bytes; actions:
drop
conformed 0000 bps, exceeded 0000 bps
We can see the entire queue is 30Mb. Inside that queue EF tra c has priority
bandwidth of 3000kbps (10% of 30Mb) – All other tra c has anything left up to
30Mb
https://mellowd.co.uk/ccie/?tag=class-of-service 11/23
10/6/2017 Class Of Service | Darren's Blog
I wanted to do a more in-depth post on H-QoS but this SRX doesn’t support it. I
don’t currently have an MX in the lab (only in the eld) so hopefully soon…
1st August 2013 / JNCIE / child, cisco, class of service, cos, IOS, jcos, jncie, jncie-sp, Juniper, junos,
parent, qos, quality of service, scheduler, sp / 1 Comment
Going back to the diagram we used in part 1. Let’s say that we want to shape
certain tra c 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
pro le.
I’m going to take the assumption that packets have already been marked
correctly as shown in my rst post.
https://mellowd.co.uk/ccie/?tag=class-of-service 12/23
10/6/2017 Class Of Service | Darren's Blog
IOS
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 rst create our RED pro le:
We then create our schedulers, which tells Junos how to treat each queue:
https://mellowd.co.uk/ccie/?tag=class-of-service 13/23
10/6/2017 Class Of Service | Darren's Blog
We then create a scheduler-map, which tells Junos what tra c belongs in each
queue:
Finally this is applied to the interface. Note that this happens under the class-
of-service stanza and NOT the actual interface stanza:
Veri cation
The best command for checking a service policy applied to an interface is show
policy-map interface interface-name:
https://mellowd.co.uk/ccie/?tag=class-of-service 14/23
10/6/2017 Class Of Service | Darren's Blog
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
https://mellowd.co.uk/ccie/?tag=class-of-service 15/23
10/6/2017 Class Of Service | Darren's Blog
This shows each of the queues as well as our RED pro le attached to the class-
default queue.
On Junos its a bit more cryptic. To see the bandwidth attached to each queue:
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
https://mellowd.co.uk/ccie/?tag=class-of-service 17/23
10/6/2017 Class Of Service | Darren's Blog
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
https://mellowd.co.uk/ccie/?tag=class-of-service 18/23
10/6/2017 Class Of Service | Darren's Blog
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
31st July 2013 / JNCIE / child, cisco, class of service, cos, IOS, jcos, jncie, jncie-sp, Juniper, junos,
parent, qos, quality of service, scheduler, sp / 3 Comments
https://mellowd.co.uk/ccie/?tag=class-of-service 19/23
10/6/2017 Class Of Service | Darren's Blog
While the concepts of QoS on vendor platforms are similar, the actual
con guration is very di erent. I wanted to do a few posts on the di erences
between Junos and IOS on the normal QoS things that I do on a day to day basis.
For this rst post I’m going to use a very simple diagram:
On the LAN are hosts with soft-phones. These phones use speci c ports but do
not mark packets sent with DSCP EF. Our goal here is to ensure voice packets
are marked. Any UDP packet with a port number of 5060 I will mark with DSCP
EF.
IOS
IOS is very simple indeed. You match the kind of tra c you want in an ACL,
create a service-policy using that ACL, mark the packets in that policy:
https://mellowd.co.uk/ccie/?tag=class-of-service 20/23
10/6/2017 Class Of Service | Darren's Blog
Junos
}
}
In the rewall statement, any packet that matches UDP with source and
destination port equal to 5060 will be placed in the expedited-forwarding
queue. As this is a rewall lter, I need to still allow the packets through. I also
need a catch-all at the end otherwise any packet not matching the rst
statement is dropped.
Both terms above will mark the needed packets as DSCP EF. All others will not
be changed.
Certain Juniper platforms do support the setting of the DSCP value inbound, but
it seems to be very hardware speci c
UPDATE (03/09/2013)
As a few have pointed out, I’m not actually marking anything here, I’m only
classifying. My bad. In order to actually mark a packet you need to use rewrite
rules. Junos has a few built-in, but you can make your own as well:
The default will ensure that EF tra c is marked 101110 which is DSCP value 46.
We apply this rewrite to an interface like so:
Of course you can create your own rewrite rules, but I’m just going for the easy
way out above.
30th July 2013 / JNCIE / child, cisco, class of service, cos, IOS, jncie, jncie-sp, Juniper, junos, parent,
qos, quality of service, scheduler / 6 Comments
© 2009-2017 Darren O'Connor All Rights Reserved -- Copyright notice by Blog Copyright
https://mellowd.co.uk/ccie/?tag=class-of-service 23/23