Hierarchical QoS
A customer bought 100 Mbps on a 1 Gbps port, and inside it their calls must still go first. Hierarchical QoS nests a child policy in a parent. The platform supports no more than two levels, and refuses the same kind of action at both levels and queuing at both. The design that survives: the parent shapes class-default to the contracted rate, and the child queues.
By Arif, founder of Daveth · Updated
The full 8 min walkthrough is in Daveth Pro (Network). See what the plan opens
What this page answers
How many levels does hierarchical QoS support on Catalyst 9000?
No more than two: a parent and a child. Read it in “Two levels, and what you may not do twice”
How do you configure hierarchical shaping on a Catalyst switch?
As a port shaper: the parent has only class-default, with shaping as its only action, and the queuing actions go in the child policy. Read it in “The design that survives”
A policy inside a policy
A business park sells a veterinary clinic 100 Mbps on a 1 Gbps port. The building switch, PARK-SW1, has to hold the clinic to 100 Mbps. And inside that 100 Mbps, the clinic's phone calls must still go first when someone uploads X-ray images to the specialist hospital.
Plain words first. A policy map is a list of traffic classes and what to do with each. Policing drops traffic above a rate; shaping holds it back to a rate; queuing decides which waiting traffic goes out first. A hierarchy is a policy map whose class carries a second policy map: the parent acts on the whole, the child on the classes inside it.
So the question is: can one port hold a customer to their contracted rate and still give their calls priority inside it? Yes, but only in the shape the platform accepts.
What the platform says it can do
The device supports hierarchical QoS (HQoS). HQoS allows you to perform: Hierarchical classification: Traffic classification is based upon other classes. Hierarchical policing: The process of having the policing configuration at multiple levels in a hierarchical policy. Hierarchical shaping: Shaping can also be configured at multiple levels in the hierarchy.
Read the list, then read the note printed directly under it:
Hierarchical shaping is only supported for the port shaper, where for the parent you only have a configuration for the class default, and the only action for the class default is shaping.
Notice what the note does to the third item. Shaping at more than one level exists, but only in one arrangement: a parent with nothing but class-default, and nothing in it but a shaper. And what does a shaper do to the queue?
This command configures a maximum bandwidth for a particular class. The queue bandwidth is restricted to this value even though the port has more bandwidth available.
Two levels, and what you may not do twice
No more than two levels are supported in a QoS hierarchy.
A parent and a child: a pair, not a tree. Now the engineer's first attempt. It is the design that reads as obvious: police the clinic to 100 Mbps, and police the calls inside it to 10 Mbps. Look at where the two police lines sit.
A household works the same way: one overall limit for the month, and separate needs inside it. The grocery budget is not extra money on top; it is a share of the one total. Children here divide what the parent already capped, and nothing a child says can raise that cap.
Where the household stops: a family can agree to overspend this month and settle up later. There is no equivalent. The parent does not pass traffic above its rate, whatever the children were promised inside it.
Configuration: the first hierarchy, attached outbound toward the clinic, in the forms these commands take.
PARK-SW1# configure terminal PARK-SW1(config)# class-map VOICE PARK-SW1(config-cmap)# match dscp ef PARK-SW1(config-cmap)# policy-map VET-CHILD PARK-SW1(config-pmap)# class VOICE PARK-SW1(config-pmap-c)# police rate 10000000 PARK-SW1(config-pmap-c-police)# exit PARK-SW1(config-pmap-c)# policy-map VET-PARENT PARK-SW1(config-pmap)# class class-default PARK-SW1(config-pmap-c)# police rate 100000000 PARK-SW1(config-pmap-c-police)# exit PARK-SW1(config-pmap-c)# service-policy VET-CHILD PARK-SW1(config-pmap-c)# exit PARK-SW1(config-pmap)# exit PARK-SW1(config)# interface GigabitEthernet1/0/12 PARK-SW1(config-if)# service-policy output VET-PARENT PARK-SW1(config-if)# end
Before you read on, decide whether PARK-SW1 installs it.
Policing in both the parent and child is not supported in a QoS hierarchy. Marking in both the parent and child is not supported in a QoS hierarchy. In a hierarchical policy, overlapping actions between parent and child are not allowed, except when a policy has the port shaper in the parent and queuing features in the child policy. Hierarchical queuing is unsupported in the same policy (port shaper is the exception).
Computed from the state: the page's rules against the first hierarchy. No command prints it in this form.
rule kept no more than two levels yes no policing at both levels NO no marking at both levels yes result: VET-PARENT outbound on Gi1/0/12, refused
Read the NO: policing at both levels. The capability list offered hierarchical policing, and the restrictions refuse it at both levels. Both are true: policing may sit at one level of a hierarchy, not at both. By this course's reading, a refused hierarchy leaves Gi1/0/12 with no policy at all, so the clinic is not held to 100 Mbps either.
So two policers are not a family, they are two policers, and the platform is not obliged to combine them into anything. The nesting you can write and the nesting the hardware will install are different sets, and the difference is a list of restrictions rather than a principle you can derive.
The design that survives
Take away what the restrictions refuse: the same kind of action at both levels, and queuing at both levels. Before the configuration, work out which job that leaves each level. What is left is one arrangement the page names outright:
The port shaper uses the class default and the only action permitted in the parent is shaping. The queuing action is in the child with the port shaper. With the user configured shaping, you cannot have queuing action in the child.
So the parent only shapes class-default to 100 Mbps, and the child does the queuing. The calls get priority level 1 with their own policer, and everything else gets a share of what the calls leave. Notice that the calls' policer sits in the child, not the parent:
Priority level 1 is more important than priority level 2. Priority level 1 reserves bandwidth that is processed first for QoS, so its latency is very low. Shaping or policing a priority queue limits the traffic to the configured rate regardless of queue utilization of non-priority queues. Use this command when the priority command is also used for certain queues in the policy.
Configuration: the port shaper with a queuing child, typing only what changes from the first hierarchy, in the forms these commands take. The no lines, which take out an earlier line, are this course's, not the page's.
PARK-SW1# configure terminal PARK-SW1(config)# policy-map VET-CHILD PARK-SW1(config-pmap)# class VOICE PARK-SW1(config-pmap-c)# no police rate 10000000 PARK-SW1(config-pmap-c)# priority level 1 PARK-SW1(config-pmap-c)# police rate 20000000 PARK-SW1(config-pmap-c-police)# exit PARK-SW1(config-pmap-c)# class class-default PARK-SW1(config-pmap-c)# bandwidth remaining percent 70 PARK-SW1(config-pmap-c)# policy-map VET-PARENT PARK-SW1(config-pmap)# class class-default PARK-SW1(config-pmap-c)# no police rate 100000000 PARK-SW1(config-pmap-c)# shape average 100000000 PARK-SW1(config-pmap-c)# exit PARK-SW1(config-pmap)# exit PARK-SW1(config)# interface GigabitEthernet1/0/12 PARK-SW1(config-if)# service-policy output VET-PARENT PARK-SW1(config-if)# end
Computed from the state: the page's rules against the port shaper. No command prints it in this form.
rule kept no more than two levels yes no policing at both levels yes no marking at both levels yes no queuing under user configured shaping yes result: VET-PARENT outbound on Gi1/0/12, installed
Look at the result under the table: installed. The parent limits the total and the child orders what is inside it. Neither repeats the other. The page's own example has the same shape:
From elsewhere: the hierarchical policy example, child policy. The names, numbers and addresses come from elsewhere, not from this scenario.
Device(config)# policy-map child Device(config-pmap)# class c1 Device(config-pmap-c)# priority level 1 Device(config-pmap-c)# police rate percent 20 conform-action transmit exceed action drop Device(config-pmap-c-police)# exit Device(config-pmap-c)# exit Device(config-pmap)# class c2 Device(config-pmap-c)# bandwidth 20000 Device(config-pmap-c)# exit Device(config-pmap)# class class-default Device(config-pmap-c)# bandwidth 20000 Device(config-pmap-c)# exit Device(config-pmap)# exit
From elsewhere: the hierarchical policy example, parent policy. The names, numbers and addresses come from elsewhere, not from this scenario.
Device(config)# policy-map parent Device(config-pmap)# class class-default Device(config-pmap-c)# shape average 1000000 Device(config-pmap-c)# service-policy child Device(config-pmap-c)# end
Growing the child
Two weeks later the specialist hospital asks for X-ray uploads marked AF41. The engineer takes the policy off the port, adds a SCANS class to VET-CHILD whose only action is set dscp af41, and attaches it again. Parent and child still do different jobs. Will it install?
Why take it off the port first? So the edit never lands on a policy that is live on the clinic's port. What editing an attached policy does is outside this lesson.
Configuration: VET-CHILD with a marking class: off the port, the new class, back on, in the forms these commands take. The no lines, which take out an earlier line, are this course's, not the page's.
PARK-SW1# configure terminal PARK-SW1(config)# interface GigabitEthernet1/0/12 PARK-SW1(config-if)# no service-policy output VET-PARENT PARK-SW1(config-if)# exit PARK-SW1(config)# class-map SCANS PARK-SW1(config-cmap)# match dscp af21 PARK-SW1(config-cmap)# policy-map VET-CHILD PARK-SW1(config-pmap)# class SCANS PARK-SW1(config-pmap-c)# set dscp af41 PARK-SW1(config-pmap-c)# exit PARK-SW1(config-pmap)# exit PARK-SW1(config)# interface GigabitEthernet1/0/12 PARK-SW1(config-if)# service-policy output VET-PARENT PARK-SW1(config-if)# end
You cannot configure both priority and set for a policy map. If both these commands are configured for a policy map, and when the policy map is applied to an interface, error messages are displayed.
Computed from the state: the page's rules against the marking child. No command prints it in this form.
rule kept no more than two levels yes no policing at both levels yes no marking at both levels yes no priority and set in one policy map NO no queuing under user configured shaping yes result: VET-PARENT outbound on Gi1/0/12, refused
Continue the lesson
The whole lesson, with its drawings and its questions. The rest of this section and 4 more after it.

