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

Bob Amen
Fri, 22 Sep 2006 13:14:50 -0000

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 10000:20000 -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.