QOS on switches(Snoms plus Asterisk)
tested on Catalyst 2960/3560 but on higher like 3750 also should work
VoIP phones - Snom 300,320 and 360 series
PBX - Asterisk
All traffic to/from PBX is tagged and prioritsed with dscp 46 and CoS 5
Â 1.Enable QoS globally
First we configure switches from 2 to 8.Switch 1 keep as a last
2.Trust DSCPÂ in packets on access ports
(config)#interface range fa0/1-48
(config-if-range)#mls qos trust dscp
If ports are "access" or "routed" set dscp because all frames are not taggedd.CoS value can be set only in tagged frames.
If port is "trunk" we can set either dscp or CoS
In our case phones tag traffic with dscp value 184(ef),PC are connected to secondÂ port in phones.
Â 3.Set "trust: state on trunk
(config)#interface range gigabitEthernet 0/1-2
(config-if-range)#mls qos trust
if we do not type any parametr by default will be "dscp".Besides that we can trust also CoS or ip-precedence.
4.Check maps dscp-cos and cos-dscp, which are automatically generated during enabling qos on switch.
from output we see CoS 5 is assigned to DSCP 40.We are sending voice with dscp 46 value(EF-101 110,TOS-184(10111000)) so we change CoS 5 assignment to dscp 46
(config)#mls qos map cos-dscp 0 8 16 24 32 46 48 56
check again qos maps cos-dscp
5.Repeat steps on other switches besides switch 1
6.Time to configure switch 1 where Asterisk is connected
(config)#interface fastEthernet 0/43
(config)#mls qos cos 5
Set CoS 5Â value for all untagged frames on port where Asterisk is connected.
Another option is to trust dscp for all packets coming from Asterisk however we have to configure Asterisk to set dscp value in its packets(it is possible!)
(config)#interface range fa0/1-10
(config-cmap)#mls qos trust dscp
Trust all dscp values in LWAPP packets coming from Access-points.APs do not mark frames via CoS.(interfaces 0/1-10)
(config)#interface range fa0/44-48
(config-cmap)#mls qos trust cos
Trust CoS value on ports where Wireless Controller is connected,in my case Cisco 2612(Qos on WLC already set) - interfaces 0/44-48
(config)#show mls qos input-queue
CIsco 3560 uses SRR(shared round-robin) to control traffic from queue to switch
SRR dived bandwidth between queues based on weight.If one queue is empy,second can take their bandwidth
Catalyst 3560 has 2 input queues
(config)#mls qos srr-queue input priority-queue 2 bandwidth 20
Output above shows us we set queue 2 as a priority and add their 20% of interface bandwidth
(config)#show mls qos maps cos-input-q
Check mapping CoS value to queues,by default CoS 5 is added to second queue,the rest to first queue.
(config)#show mls qos maps dscp-input-q
Check map dscp-input-queue,by default dscp from 40 to 47 are sent to second queue, the rest to first queue.Do not change this settings.
(config)#mls qos srr-queue input buffers 80 20
We changed buffer settings for queues(80% forÂ first and 20% for second).Bandwidth parametr keep as it is, it is abstract value and it is not real bandwidth but rather frequency how ofter switch takes data from queues.
(config)#mls qos srr-queue input threshold 1 50 80
(config)#mls qos srr-queue input cos-map threshold 1 0 1 2 3
(config)#mls qos srr-queue input cos-map threshold 2 4
(config)#mls qos srr-queue input cos-map threshold 3 5 6 7
We changed thresholdsÂ after crossing themÂ frames with CoS are started to drop.
When threshold 1 is reached frames with CoS 0 1 2 3Â switchÂ starts to drop(queue 1)
When threshold 2 framesÂ with CoS 4 switch starts to drop(frames with 0,1,2,3 all are dropping) - queue 1
Threshold for frames withÂ CoS 6 and 7(queue 1) andÂ frames with CoS 5(queueÂ 2) is 100%
(config)#mls qos srr-queue input dscp-map threshold 1 0 8 16 24
(config)#mls qos srr-queue input dscp-map threshold 2 32
(config)#mls qos srr-queue input dscp-map threshold 3 46 48 54
We did similar with packets with dscp value set.
8. Chek output-queue settings
(config)#do show mls qos queue-set
Cisco 3560 has 4 outputÂ queues on output interface.
We can set priority on output queue on condition it will be queue nr 1.
We can assign to interface either first queue set or second, we cannot assign 2 queue-sets to one interface.
Queues are working in accordance to SRR(shaped round-robin) or SRR(shared round-robin).
Clasification works in following way:
if dscp is set switch checks dscp-cos maps and choose CoS value,next based on CoS-to-queue map choose queue where to put this frame.
in other way it relies on CoS value and put frame to appropiate output-queue
In case of needs we change settings like below:
(config)#mls qos queue-set output 1 buffers 40 30 20 10
Command above changes buffer settings in queue-set 1. In my case I will use standard settings,that is 25 25 25 25
#show mls qos maps cos-output-q
Ouput above shows us default cos-output-queue map with assigned to them their threshold
#show mls qos maps dscp-output-q
Default dscp-output-queue map.In my opinion decison where to put frame is based on Cos (dscp-qos maps) but it has to be checked.Till now I did not do this.
(config)#mls qos srr-queue output cos-map threshold 1 0 1 2 3
Assign frames with CoS 0 1 2 and 3 to threshold 1
(config)#mls qos srr-queue output cos-map threshold 2 4
Assign frames with CoSÂ 4 to threshold 2
(config)#mls qos srr-queue output cos-map threshold 3 5 6 7
Â Assign frames with CoS 5,6 and 7Â to threshold 3
CoS-output-queue after our changes
(config)#mls qos srr-queue output dscp-map threshold 1 0 8 16 24
(config)#mls qos srr-queue output dscp-map threshold 2 32
(config)#mls qos srr-queue output dscp-map threshold 3 46 48 56
Dscp-output-q after our changes
(config)#mls qos queue-set output 1 threshold 2 100 200 50 400
We set threshold for queue 2 in the following way:
Start to drop frames with CoS 0,1,2 and 3 after 100% of filled buffers
Start to drop frames with CoS 4 after 200% of filled buffers - at that time queue already started to share buffers.All frames with CoS 0,1,2,3 are dropped.
50% of buffers are reserved for that queue,50% are coming to shared pool.
Queue can borrow all buffers from all other queues(400% parametr).
In accordance to our CoS-output-q to second queue are put only frames with CoS 0 and 1 so this limit affect only these frames.
Warning!!!Settings above cause quite a lot loss of performance for normal trafic(,e.g. copying files,etc).
I set it due to specific network I administer however in most of networks default settings are sufficient,especially where voip traffic is not huge and without hit there is no any other important traffc which should has priority over normal traffic.
Output above shows us default settings like:
priority queue is disabled
FirstÂ queue in queue-set 1 has limitation to 25% of interface bandwidth,the rest 3 has quaranty 25% of bandwidth and can share free bandwidth from the others.
Remember "bandwidth" is only ratio,not a physical value,e.g. srr-queue 1 1 1 1 is the same to 25 25 25 25 or 100 100 100 100
Value "0" means shapping is disabled,e.g.
shaped round robin(absolute) 25 0 0 0Â Â - shapping for queues 2-4 is disabled
Â enable priority queue
(config)#interface range fastEthernet 0/1-48
Priority queue enable on all ports where voip phons are connected and on trunks.
Settings after our changes
Â 9.Repeat procedure on switches 2-8
10. Configure snom phonesto tag traffic with dscp value(ef) in vlan 5