Usually, you want to police the priority queue (VoIP). Give it a guaranteed minimum bandwidth, and police everything above that bandwidth. Not policing the priority queue lets the priority traffic end up in non-priority queues, too, and that part of the traffic could get stepped on by non-priority traffic. That causes problems with call quality.
If you are using the outbound interface a line speed, then you shouldn't shape on it. If you are using a sub-rate service, then you should shape to something less than your services rate. How much lower depends on your packet size. VoIP uses very small packets, so the packet overhead is large. If you have a lot of VoIP traffic, then you want a larger difference between the shape rate and the service rate.
What you really want to do is to have a comprehensive, consistent QoS policy across your network. Mark traffic as close to the source as possible. Preferably, on the access switch, but usually do not trust host markings. Most traffic should be left at BE, but you want voice and video to be priority, and you want things like server backups to be treated the worst.
I noticed that you are trying to include AF31
in the VoIP, but that is a mistake. AF31
is control traffic, and it should be treated as such.
Below is a sample that works on Cisco routers. You need to adjust queue sizes and shaping rates for your bandwidth service level:
class-map match-any VOICE
match ip dscp cs4 cs5 ef
class-map match-any VIDEO
match ip dscp af41 af42 af43
class-map match-any CONTROL
match ip dscp cs3 af31 af32 af33 cs6 cs7
class-map match-any BUSINESS
match ip dscp cs2 af21 af22 af23
class-map match-any BULK
match ip dscp cs1 af11 af12 af13
!
policy-map QUEUING-POLICY
class VOICE
priority percent 20
police cir percent 20 conform-action transmit exceed-action drop
class VIDEO
bandwidth remaining percent 15
police cir percent 15 conform-action transmit exceed-action drop
class CONTROL
bandwidth remaining percent 10
queue-limit 2822
random-detect dscp-based
random-detect dscp 56 1410 1411
random-detect dscp 48 1410 1411
random-detect dscp 24 1057 1058
random-detect dscp 26 705 1057
random-detect dscp 28 564 1057
random-detect dscp 30 423 1057
class BUSINESS
bandwidth remaining percent 20
queue-limit 5640
random-detect dscp-based
random-detect dscp 16 2819 2820
random-detect dscp 18 2115 2820
random-detect dscp 20 1410 2115
random-detect dscp 22 705 1410
class BULK
bandwidth remaining percent 5
queue-limit 352
random-detect dscp-based
random-detect dscp 8 175 176
random-detect dscp 10 132 176
random-detect dscp 12 88 132
random-detect dscp 14 44 88
class class-default
bandwidth remaining percent 50
queue-limit 8192
random-detect dscp-based
random-detect dscp 0 2048 4096
!
policy-map SHAPING-POLICY
class class-default
shape average <RATE> <BC>
service-policy QUEUING-POLICY
!