Re: [asterisk-users] Setting QOS settings in asterisk and/or CentOS?

2006-09-22 Thread Bob Amen

BerkHolz, Steven wrote:
How would I go about setting the TOS bit to RTP IP TOS Byte:  18 
(hex) for SIP and IAX traffic at the asterisk server?


   We do it by setting the DSCP value to 40, which sets the TOS bit to 
5 using iptables. Here's our rules_save for these opertations:


[350334:180338667] -A OUTPUT -p udp -m udp --dport 5060 -j DSCP 
--set-dscp 0x28
[12085728:2417094759] -A OUTPUT -p udp -m udp --sport 1:2 -j 
DSCP --set-dscp 0x28

[4531:356102] -A OUTPUT -p udp -m udp --sport 4569 -j DSCP --set-dscp 0x28
[4531:356102] -A OUTPUT -p udp -m udp --dport 4569 -j DSCP --set-dscp 0x28

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:


class-map match-any Class-A
description Voice (IPP Critical)
match ip precedence 5
match protocol rtp
!
!
policy-map MPLS
class Class-A
 bandwidth percent 25
class class-default
 fair-queue 512
 random-detect

Then you just apply the policy-map to the outgoing interface.

Cheers,
Bob

--
Bob Amen
O'Reilly Media, Inc.
http://www.ora.com/
  http://www.oreilly.com/

___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Setting QOS settings in asterisk and/or CentOS?

2006-09-22 Thread Rich Adamson

BerkHolz, Steven wrote:
How would I go about setting the TOS bit to RTP IP TOS Byte:  18 (hex) 
for SIP and IAX traffic at the asterisk server?
 
Also,
Do you have a quick reference on how to configure a Cisco switch to 
prioritize SIP traffic?
I check in various Cisco docs, and there are so many references, and 
none of them seem to relate directly to using the TOS bit for QOS.
 
I am looking into using the TOS bit because that is the only method that 
my SIP devices use. (Citel Handset Gateway)


For asterisk, take a look at sip.conf.sample and you'll find something 
like this for v1.2 and earlier:

 tos=lowdelay;ox18 sets ip tos bits (=lowdelay, throughput)

After v1.2, the look in the asterisk/docs directory and you'll find a 
readme file relative to QoS. The format of the QoS parameters have 
changed from the older TOS bits to the newer terminology Differentiated 
Services, and coding within sip.conf looks something like this:

 tos_sip=cs3
 tos_audio=ef

Differentiated Services is a superset of TOS; anything you want to do in 
TOS bits have an equivalent in Differentiated Services, and the bits map 
exactly.


The cisco web site has a very significant amount of documentation for 
configuring routers and switches for QoS, and they have a very excellent 
700+ page book that is oriented 100% towards implementing QoS on various 
cisco boxes. Cisco's search engine leaves something to be desired in 
some cases, but the info you want is there.


Not all cisco switches have the same QoS implementations. For example, 
most of the workgroup type switches support something like 3 or 4 
outbound queues, while the higher end switches support more queues. If 
you're going to deal with RTP only from a QoS perspective, you only need 
two queues (eg, RTP  Default). The Default queue (or Class) is a 
special case that includes everything not in other queues.


For the most part, QoS on switches is not required unless: a) trunk port 
traffic exceeds the bandwidth available (for that port), or, b) outbound 
port is a slower speed then the majority of other switch ports (eg, 
congestion).



___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Setting QOS settings in asterisk and/or CentOS?

2006-09-22 Thread Nick Hoffman
On Sat September 23 2006 06:14, Bob Amen [EMAIL PROTECTED] 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 ...

Cheers,
-- Nick
e: [EMAIL PROTECTED]
p: +61 7 5591 3588
f: +61 7 5591 6588

If you receive this email by mistake, please notify us and do not make any 
use of the email.  We do not waive any privilege, confidentiality or 
copyright associated with it.
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Setting QOS settings in asterisk and/or CentOS?

2006-09-22 Thread Rich Adamson

Nick Hoffman wrote:

On Sat September 23 2006 06:14, Bob Amen [EMAIL PROTECTED] 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 x_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 

RE: [asterisk-users] Setting QOS settings in asterisk and/or CentOS?

2006-09-21 Thread Redouane Doumer



Hello,

For the Cisco QOS:

Based on a Cisco Router all you need is a simple 
access-list. 

class-map match-any voip-class
 match ip rtp 10001 
 match access-group 150
!
!
policy-map voip-policy
 class voip-class
 priority xxx (in Kbits)

access-list 150 permit udp any any eq 
5060
access-list 150 permit udp any any eq 
4569

Voila!

Redouane


De: BerkHolz, Steven 
[mailto:[EMAIL PROTECTED] Envoyé: jeudi 21 
septembre 2006 15:33À: 
asterisk-users@lists.digium.comObjet: [asterisk-users] Setting 
QOS settings in asterisk and/or CentOS?

How would I go 
about setting the TOS bit to "RTP IP TOS Byte: 18 (hex)" for SIP and IAX traffic at the asterisk 
server?

Also, 

Do you have a quick 
reference on how to configure a Cisco switch to prioritize SIP 
traffic?
I check in various 
Cisco docs, and there are so many references, and none of them seem to relate 
directly to using the TOS bit for QOS.

I am looking into using the TOS bit because that is the only 
method that my SIP devices use. (Citel Handset 
Gateway)

ref:
QOS settings from Citel Handset 
Gateway:
Handset Gateway - QoS 
Configuration
IP Type of Service RTP IP TOS Byte: 18 (hex) 
Silence Suppression Mute Mode: On, UDP keep-alive every 10 
secondsG.711 Voice Activity Detection: Off
Codec Preferences G.711u: 1 (Highest priority) G.711a: 
2



Thank You,
Steven 
BerkHolz- MCSA 
- MCSE -Manager of Information SystemsTESCO Group 
CompaniesFax. 248-836-5101www.TESCOGroup.com
Board member 
ofwww.glimasoutheast.org

___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users