[asterisk-users] Setting QOS settings in asterisk and/or CentOS?
Rich Adamson
radamson at routers.com
Fri Sep 22 21:00:40 MST 2006
Nick Hoffman wrote:
> On Sat September 23 2006 06:14, Bob Amen <amen at oreilly.com> wrote:
> <snip>
>> which sets the TOS bit on all IAX, SIP and RTP packets. Using iptables
>> means that we can set up our rules on the router without using ACLs. Our
>> Cisco Cookbook (http://www.oreilly.com/catalog/ciscockbk/) has a nice
>> section on QoS (Chapter 11) and an appendix on TOS, etc. The author
>> advises not to use ACLs when possible as they take more CPU in the
>> router to implement and on a heavily loaded router can cause packet
>> delays. So here's what our config looks like:
> <snip>
>> Cheers,
>> Bob
>
>
> Hi Bob. I'm new to TOS and DSCP, but after going over your and Rich
> Adamson's responses to Steve BerkHolz's question, I read up about them.
>
> With what you wrote above, does this mean that your Cisco router(s) deny,
> allow, and route traffic based on TOS/DSCP flags, and you don't bother
> with traditional ACL rules like below?:
> access-list 123 permit udp 1.2.3.4 ...
ACL's in cisco hardware can be used for pattern matching in addition to
the old permit, deny, etc, functions.
Here's a working example from a cisco 1750 with QoS:
class-map match-all voice-rtp
match access-group 103
class-map match-all www-traffic
match access-group 105
!
!
policy-map voice-policy
class voice-rtp
priority percent 40
class www-traffic
bandwidth percent 30
class class-default
fair-queue
access-list 103 permit ip any any dscp cs3
access-list 103 permit ip any any dscp ef
access-list 103 permit ip any any tos min-delay
access-list 103 permit ip any any tos 12
access-list 105 permit tcp any eq www any
In the above, any packet matching the access-list 103 gets treated as a
"voice-rtp" class, and in the policy map, is acted upon as "priority"
(which means low latency queue) and can use up to 40% of the interfaces
bandwidth.
The "bandwidth 384" statement on the interface "is" used by QoS to
determine how much is actually going to be used for voip.
interface Dialer0
bandwidth 384
ip address negotiated
encapsulation ppp
dialer pool 1
dialer-group 1
service-policy output voice-policy
ppp pap sent-username xxxxx_dsl password 7 136775499987
That bandwidth statement should be the "actual" amount of bandwidth
available and not the value that your dsl/broadband provider says they
provide.
Once the policy map is implemented, one can review the operational
statistics by doing something like this:
C1750#show policy-map interface dialer0
Dialer0
Service-policy output: voice-policy
Class-map: voice-rtp (match-all)
1441504 packets, 191386680 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: access-group 103
Weighted Fair Queueing
Strict Priority
Output Queue: Conversation 136
Bandwidth 40 (%)
Bandwidth 153 (kbps) Burst 3825 (Bytes)
(pkts matched/bytes matched) 0/0
(total drops/bytes drops) 0/0
Class-map: www-traffic (match-all)
484061 packets, 341420115 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: access-group 105
Weighted Fair Queueing
Output Queue: Conversation 137
Bandwidth 30 (%)
Also, by doing the following:
C1750#show access-list 103
Extended IP access list 103
permit ip any any dscp cs3
permit ip any any dscp ef (1680 matches)
permit ip any any tos min-delay (808709 matches)
permit ip any any tos 12 (1 match)
one can "see" which piece of an access list is being matched. One can
also see that both TOS and DSCP definitions can be used within the same
access list. Its kind of a handy way to ensure voip phones and asterisk
are properly configure and thus properly treated from a QoS perspective.
It should also be noted the above router is running v 12.2(4)T7 code.
Cisco has made several changes to the syntax and parameters implemented
in each version in the last few years. In the newer IOS versions (for
both switches and routers), the syntax and parameters are becoming much
more standardized across all product lines.
The OP was specifically asking about QoS on a cisco switch, and without
researching exactly what was implemented in "his" switch, there really
isn't any way to give him a QoS template that would be accurate. For
example, if I posted something that worked in the 12.4 code, its highly
likely not to be acceptable syntax for 12.1 or 12.2.
Whether one uses access lists to do pattern matching is mostly
immaterial "except" on a heavily loaded router. In my case, the
processor utilization looks like:
C1750#show proc
CPU utilization for five seconds: 1%/0%; one minute: 1%; five minutes: 1%
where lengthy access lists would have almost zero impact.
For those that have read this far, it should be noted the implementation
is a 3-queue policy (one for rtp, one for www, and one as the default).
If the traffic for the rtp queue is low (or none), the unused bandwidth
is automatically made available to other lower priority queues. In other
words, the allocation of bandwidth to the various queues only occurs
when demand is greater then the bandwidth available. Also, QoS can only
be applied to "outbound" interfaces; inbound QoS must be done at the isp.
Rich
More information about the asterisk-users
mailing list