Skip to contentSkip to conversation

trying to prioritize voip traffick

LARTC John covici 2 participants 2 messages Aug 13, 2006 – Aug 14, 2006

lore
Share & tools
lore
#0 lore raw

I am using a server with asterisk and I am trying to prioritize voip traffick -- I am a newbie at this traffic shaping, so please bear with me. I used the script below and what happens is thatall traffic in the bulk class stops after a couple of minutes. Also, should I include the ports for rtp in the filter statements with the ports 5061 and 4569? Note I have a fairly big pipe -- supposed to be able to do the full 100mb out.

Here is the script.

#!/bin/sh
#####################################
############ VARIABLES ##############
# #
e=eth0 # interface
t1pMbit # size of your WAN - remember you can't max this or you'll experience latency. 75-80% of max is a good place to start.
el0Mbit # size of eth0
w=7.5Mbit # weighting of your WAN (10% of t1)
sizeCitrix=5Mbit
sizeVoIPUMbit

sizeBulkMbit

weightCitrix=0.5Mbit
weightVoIP=5.5Mbit
weightBulk=1Mbit

# #
#####################################
#####################################

# Delete any old rules #
set -v
set -x
tc qdisc del root dev $e

## each class is able to take more bandwidth as it is available, but must ## surrender it as the higher priorities (2, 3, then 4) need it. ## The lower the priority number, the more priority it gets. Thus when ## there is extra bandwidth available, the lower number classes get it as ## they need it.

# root qdisc /  qdisc = queueing discipline #
tc qdisc add dev $e root handle 1:0 cbq bandwidth 100Mbit avpkt 1000 cell 8||exit 1

tc class add dev $e parent 1:0 classid 1:1 cbq bandwidth 100Mbit rate $t1 weight $w prio 8 allot 1514 cell 8 maxburst 20 avpkt 1000 bounded||exit 1

# child qdiscs (like child nodes on a tree) #
tc class add dev $e parent 1:1 classid 1:3 cbq bandwidth 100Mbit rate $sizeCitrix weight $weightCitrix prio 8 allot 1514 cell 8 maxburst 20 avpkt 300 isolated||exit 1
tc qdisc add dev $e parent 1:3 handle 30: sfq perturb 20||exit 1

tc class add dev $e parent 1:1 classid 1:5 cbq bandwidth 100Mbit rate $sizeVoIP weight $weightVoIP prio 8 allot 1514 cell 8 maxburst 20 avpkt 204 bounded ||exit 1

tc class add dev $e parent 1:1 classid 1:9 cbq bandwidth 100Mbit rate $sizeBulk weight $weightBulk prio 8 allot 1514 cell 8 maxburst 20 avpkt 1000||exit 1 tc qdisc add dev $e parent 1:9 handle 90: sfq perturb 20||exit 1

#####################################
############### Citrix ##############
# #

# SSH #

tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip sport 22 0xffff flowid 1:3||exit 1
tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip dport 22 0xffff flowid 1:3||exit 1

#####################################
############### VoIP ################
# #

# IAX # this is the old format - IAX2 should be what's really seen going #on

tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip sport 5061 0xffff flowid 1:5||exit 1
tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip dport 5061 0xffff flowid 1:5||exit 1

# IAX2 #

tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip sport 4569 0xffff flowid 1:5||exit 1
tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip dport 4569 0xffff flowid 1:5||exit 1

#####################################
######### Bulk / Default ############
# #

tc filter add dev $e protocol ip parent 1:0 prio 3 u32 match ip src 0.0.0.0/0 flowid 1:9||exit 1
tc filter add dev $e protocol ip parent 1:0 prio 3 u32 match ip dst 0.0.0.0/0 flowid 1:9||exit 1

Any assistance would be appreciated.

Signature · 10 lines
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

         John Covici
         [email protected]
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
#1 lore raw

Hi

Take a look to this link:

http://www.krisk.org/astlinux/misc/astshape

roberto

2006/8/12, John covici <[email protected]>:

Quoted 105 lines

I am using a server with asterisk and I am trying to prioritize voip traffick -- I am a newbie at this traffic shaping, so please bear with me. I used the script below and what happens is thatall traffic in the bulk class stops after a couple of minutes. Also, should I include the ports for rtp in the filter statements with the ports 5061 and 4569? Note I have a fairly big pipe -- supposed to be able to do the full 100mb out.

Here is the script.

#!/bin/sh
#####################################
############ VARIABLES ##############
# #
e=eth0 # interface
t1pMbit # size of your WAN - remember you can't max this or you'll experience latency. 75-80% of max is a good place to start.
el0Mbit # size of eth0
w=7.5Mbit # weighting of your WAN (10% of t1)
sizeCitrix=5Mbit
sizeVoIPUMbit

sizeBulkMbit

weightCitrix=0.5Mbit
weightVoIP=5.5Mbit
weightBulk=1Mbit

# #
#####################################
#####################################

# Delete any old rules #
set -v
set -x
tc qdisc del root dev $e

## each class is able to take more bandwidth as it is available, but must ## surrender it as the higher priorities (2, 3, then 4) need it. ## The lower the priority number, the more priority it gets. Thus when ## there is extra bandwidth available, the lower number classes get it as ## they need it.

# root qdisc /  qdisc = queueing discipline #
tc qdisc add dev $e root handle 1:0 cbq bandwidth 100Mbit avpkt 1000 cell 8||exit 1

tc class add dev $e parent 1:0 classid 1:1 cbq bandwidth 100Mbit rate $t1 weight $w prio 8 allot 1514 cell 8 maxburst 20 avpkt 1000 bounded||exit 1

# child qdiscs (like child nodes on a tree) #
tc class add dev $e parent 1:1 classid 1:3 cbq bandwidth 100Mbit rate $sizeCitrix weight $weightCitrix prio 8 allot 1514 cell 8 maxburst 20 avpkt 300 isolated||exit 1
tc qdisc add dev $e parent 1:3 handle 30: sfq perturb 20||exit 1

tc class add dev $e parent 1:1 classid 1:5 cbq bandwidth 100Mbit rate $sizeVoIP weight $weightVoIP prio 8 allot 1514 cell 8 maxburst 20 avpkt 204 bounded ||exit 1

tc class add dev $e parent 1:1 classid 1:9 cbq bandwidth 100Mbit rate $sizeBulk weight $weightBulk prio 8 allot 1514 cell 8 maxburst 20 avpkt 1000||exit 1 tc qdisc add dev $e parent 1:9 handle 90: sfq perturb 20||exit 1

#####################################
############### Citrix ##############
# #

# SSH #

tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip sport 22 0xffff flowid 1:3||exit 1
tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip dport 22 0xffff flowid 1:3||exit 1

#####################################
############### VoIP ################
# #

# IAX # this is the old format - IAX2 should be what's really seen going #on

tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip sport 5061 0xffff flowid 1:5||exit 1
tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip dport 5061 0xffff flowid 1:5||exit 1

# IAX2 #

tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip sport 4569 0xffff flowid 1:5||exit 1
tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip dport 4569 0xffff flowid 1:5||exit 1

#####################################
######### Bulk / Default ############
# #

tc filter add dev $e protocol ip parent 1:0 prio 3 u32 match ip src 0.0.0.0/0 flowid 1:9||exit 1
tc filter add dev $e protocol ip parent 1:0 prio 3 u32 match ip dst 0.0.0.0/0 flowid 1:9||exit 1

Any assistance would be appreciated.

--
Your life is like a penny. You're going to lose it. The question is:
How do
you spend it?

John Covici
[email protected]
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

Signature · 8 lines
Ing. Roberto Pereyra
ContenidosOnline
Looking for Linux Virtual Private Servers ? Click here:
http://www.spry.com/hosting-affiliate/scripts/t.php?a_aidB6&a_bidV
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc