Hi @vicko164 ,
Let me shed some light on this. Here’s a topology:
I use iperf to generate some traffic. H1 is the client, H2 is the server:
DSCP EF
iperf -c 192.168.12.2 -b 50000K -i 1 -t 3600 -S 0xB8
DSCP AF11
iperf -c 192.168.12.2 -b 50000K -i 1 -t 3600 -S 0x28
DSCP AF21
iperf -c 192.168.12.2 -b 50000K -i 1 -t 3600 -S 0x48
DSCP AF31
iperf -c 192.168.12.2 -b 50000K -i 1 -t 3600 -S 0x68
These are four streams of 50 Mbit, more than the interface can handle.
Here’s the interface configuration:
SW1-LAB#show run interface gi1/0/48
Building configuration...
Current configuration : 102 bytes
!
interface GigabitEthernet1/0/48
switchport mode trunk
speed 100
service-policy output TRUNK
end
With this policy-map:
SW1-LAB#show policy-map interface gi1/0/48
GigabitEthernet1/0/48
Service-policy output: TRUNK
queue stats for all priority classes:
Queueing
priority level 1
(total drops) 104742
(bytes output) 2487565108
Class-map: EF (match-any)
1618739 packets
Match: dscp ef (46)
0 packets, 0 bytes
5 minute rate 0 bps
Priority: Strict,
Priority Level: 1
police:
rate 20 %
rate 20000000 bps, burst 625000 bytes
conformed 2040394416 bytes; actions:
transmit
exceeded 441311510 bytes; actions:
drop
conformed 18742000 bps, exceeded 4021000 bps
Class-map: AF11 (match-any)
1122765 packets
Match: dscp af11 (10)
0 packets, 0 bytes
5 minute rate 0 bps
Queueing
(total drops) 7193802
(bytes output) 1725566766
bandwidth 10% (10000 kbps)
Class-map: AF21 (match-any)
1759571 packets
Match: dscp af21 (18)
0 packets, 0 bytes
5 minute rate 0 bps
Queueing
(total drops) 10600194
(bytes output) 2704096890
bandwidth 20% (20000 kbps)
Class-map: AF31 (match-any)
2349422 packets
Match: dscp af31 (26)
0 packets, 0 bytes
5 minute rate 0 bps
Queueing
(total drops) 13701468
(bytes output) 3610726698
bandwidth 30% (30000 kbps)
Class-map: class-default (match-any)
148 packets
Match: any
(total drops) 0
(bytes output) 1472
When this policy-map is applied, it looks as expected:
- EF: 21.0 Mbits/sec
- AF11: 15.7 Mbits/sec
- AF21: 25.2 Mbits/sec
- AF31: 34.6 Mbits/sec
The queues for AF11, AF21, and AF31 get slightly more than what I configured. The bandwidth percent
command is an absolute percentage of the total bandwidth (100 Mbit). The priority queue is policed to 20 Mbit so my three remaining queues have more available than what I configured for them. There is also the class-default class.
If I would generate some packets that don’t match any of my queues, they’ll end up in class-default and my non-priority queues would be limited to what I set with the bandwidth percent
command.
If you use bandwidth remaining percent
then you set the minimum bandwidth as a relative percentage of the remaining bandwidth. What that means, is the bandwidth available after the priority queue (and RSVP reservations).
For example:
SW1-LAB#show policy-map TRUNK2
Policy Map TRUNK2
Class EF
priority level 1
police rate percent 20
conform-action transmit
exceed-action drop
Class AF11
bandwidth remaining 10 (%)
Class AF21
bandwidth remaining 20 (%)
Class AF31
bandwidth remaining 30 (%)
Apply it:
SW1-LAB(config)#int gi1/0/48
SW1-LAB(config-if)#no service-policy output TRUNK
SW1-LAB(config-if)#service-policy output TRUNK2
This is what I get:
- EF: 21.0 Mbits/sec
- AF11: 13.6 Mbits/sec
- AF21: 25.2 Mbits/sec
- AF31: 37.6 Mbits/sec
The priority queue has 20 Mbps. The other queues get a minimum bandwidth of 10%, 20%, and 30% of the remaining bandwidth (80 Mbit).
10% of 80 = 8 Mbps
20% of 80 = 16 Mbps
30% of 80 = 24 Mbps
I could generate some iperf traffic that hits the class default class:
iperf -c 192.168.12.2 -b 50000K -i 1 -t 3600
Once I do that, my traffic looks like this:
- EF: 21.0 Mbits/sec
- AF11: 8.39 Mbits/sec
- AF21: 14.7 Mbits/sec
- AF31: 22.0 Mbits/sec
That’s looking good. It matches what we configured.
In my examples, the interface is set to 100 Mbit and it has an actual bandwidth of 100 Mbit. That’s when everything works as it should.
If you have sitting something in between that reduces your bandwidth, then you should add a parent shaper to artificially set the correct bandwidth. Under the parent shaper, you add the policy-map with the queues. That’s what you did in your example.
SW1-LAB(config)#policy-map PARENT
SW1-LAB(config-pmap)#class class-default
SW1-LAB(config-pmap-c)#shape average percent 40
SW1-LAB(config-pmap-c)#service-policy TRUNK2
SW1-LAB(config)#interface gi1/0/48
SW1-LAB(config-if)#no service-policy out TRUNK2
SW1-LAB(config-if)#service-policy out PARENT
Here’s the output:
SW1-LAB#show policy-map interface gigabitEthernet 1/0/48
GigabitEthernet1/0/48
Service-policy output: PARENT
Class-map: class-default (match-any)
162998 packets
Match: any
Queueing
(total drops) 53371362
(bytes output) 18905603164
shape (average) cir 40000000, bc 400000, be 400000
target shape rate 40000000
Service-policy : TRUNK2
queue stats for all priority classes:
Queueing
priority level 1
(total drops) 13662
(bytes output) 4109919128
Class-map: EF (match-any)
0 packets
Match: dscp ef (46)
0 packets, 0 bytes
5 minute rate 0 bps
Priority: Strict,
Priority Level: 1
police:
rate 20 %
rate 8000000 bps, burst 250000 bytes
conformed 0 bytes; actions:
transmit
exceeded 0 bytes; actions:
drop
conformed 0000 bps, exceeded 0000 bps
Class-map: AF11 (match-any)
0 packets
Match: dscp af11 (10)
0 packets, 0 bytes
5 minute rate 0 bps
Queueing
(total drops) 8174430
(bytes output) 2105640240
bandwidth remaining 10%
Class-map: AF21 (match-any)
0 packets
Match: dscp af21 (18)
0 packets, 0 bytes
5 minute rate 0 bps
Queueing
(total drops) 15400110
(bytes output) 4001389786
bandwidth remaining 20%
Class-map: AF31 (match-any)
70235 packets
Match: dscp af31 (26)
0 packets, 0 bytes
5 minute rate 0 bps
Queueing
(total drops) 23809830
(bytes output) 6842339460
bandwidth remaining 30%
Class-map: class-default (match-any)
92763 packets
Match: any
(total drops) 5973330
(bytes output) 1846317586
We shape our traffic to 40 Mbit. The priority queue gets 20% of 40 = 8 Mbit.
The other queues receive 10, 20, and 30% of the remaining bandwidth (80% of 40 Mbit = 32 Mbit) so that’s a minimum bandwidth of 3,2 Mbit, 6,4 Mbit, and 9,6 Mbit.
With iperf still running (including the class-default traffic), this is what I see:
- EF: 7.34 Mbits/sec
- AF11: 3.15 Mbits/sec
- AF21: 6.29 Mbits/sec
- AF31: 9.44 Mbits/sec
- Class default: 12.6 Mbits/sec
So that’s looking good too. Exactly what we configured. In a nutshell, your config looks good. What software did you use to generate traffic?
Rene