Best QoS Policy for VoIP

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hello all,

I've got a couple redundant (Spanning Tree Protocol) boxes running FC1 minimal install + bridge-utils and they are working great for QoS + ntop monitoring. I'm wondering if I should handle the VoIP traffic a little differently. I don't mind letting VoIP and Video lend out traffic when it isn't being used, so that's why I gave them such large chunks of the bandwidth. Especially the video, which is only used sometimes, and even then it only usually needs around 400 / 400. It seems that CBQ is pretty good just because I can vary the bounded / isolated stuff. For example, Citrix is isolated and always gets that bandwidth. Video and VoIP are bounded, but not isolated. Sametime is a instant messaging client. Here's my script (have 2 scripts, both the same except that one is for eth0, the other for eth1. Also, we have 3Mb / 3Mb connection.

#!/bin/sh
#####################################
############ VARIABLES ##############
#                                   #
e=eth0       # interface
t1=2.40Mbit  # 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.
el=100Mbit   # size of eth0
w=0.24Mbit   # weighting of your WAN (10% of t1)

sizeCitrix=0.4Mbit
sizeVoIP=0.8Mbit
sizeVideo=1.0Mbit
sizeBulk=0.1Mbit
sizeSametime=0.1Mbit

weightCitrix=0.04Mbit
weightVoIP=0.08Mbit
weightVideo=0.1Mbit
weightBulk=0.01Mbit
weightSametime=0.01Mbit

CONNECTRIA1="XXX.XXX.XXX.XXX"
CONNECTRIA2="XXX.XXX.XXX.XXX"
SAMETIME="XXX.XXX.XXX.XXX"

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

# Delete any old rules #
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

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

# 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
tc qdisc add dev $e parent 1:3 handle 30: sfq perturb 20

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

tc class add dev $e parent 1:1 classid 1:6 cbq bandwidth 100Mbit rate $sizeVideo weight $weightVideo prio 8 allot 1514 cell 8 maxburst 20 avpkt 580 bounded

tc class add dev $e parent 1:1 classid 1:7 cbq bandwidth 100Mbit rate $sizeSametime weight $weightSametime prio 8 allot 1514 cell 8 maxburst 20 avpkt 550
tc qdisc add dev $e parent 1:7 handle 70: sfq perturb 20

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
tc qdisc add dev $e parent 1:9 handle 90: sfq perturb 20

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

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

# CITRIX/ICA #
tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip sport 1494 0xffff flowid 1:3
tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip dport 1494 0xffff flowid 1:3

# CITRIX Metaframe #
tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip src $CONNECTRIA1/32 flowid 1:3
tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip dst $CONNECTRIA1/32 flowid 1:3

tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip src $CONNECTRIA2/32 flowid 1:3
tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip dst $CONNECTRIA2/32 flowid 1:3

#####################################
############### 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 5036 0xffff flowid 1:5
tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip dport 5036 0xffff flowid 1:5

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

#### Remotely VPNd SIP Phones   #####

# Ron Senykoff Home
tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip src XXX.XXX.XXX.XXX/32 flowid 1:5
tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip dst XXX.XXX.XXX.XXX/32 flowid 1:5

#####################################
############### Video ###############
#                                   #

# H323 #
tc filter add dev $e protocol ip parent 1:0 prio 2 u32 match ip sport 1720 0xffff flowid 1:6
tc filter add dev $e protocol ip parent 1:0 prio 2 u32 match ip dport 1720 0xffff flowid 1:6

tc filter add dev $e protocol ip parent 1:0 prio 2 u32 match ip sport 15328 0xffff flowid 1:6
tc filter add dev $e protocol ip parent 1:0 prio 2 u32 match ip dport 15328 0xffff flowid 1:6

tc filter add dev $e protocol ip parent 1:0 prio 2 u32 match ip sport 15329 0xffff flowid 1:6
tc filter add dev $e protocol ip parent 1:0 prio 2 u32 match ip dport 15329 0xffff flowid 1:6

tc filter add dev $e protocol ip parent 1:0 prio 2 u32 match ip sport 15330 0xffff flowid 1:6
tc filter add dev $e protocol ip parent 1:0 prio 2 u32 match ip dport 15330 0xffff flowid 1:6

tc filter add dev $e protocol ip parent 1:0 prio 2 u32 match ip sport 15331 0xffff flowid 1:6
tc filter add dev $e protocol ip parent 1:0 prio 2 u32 match ip dport 15331 0xffff flowid 1:6

tc filter add dev $e protocol ip parent 1:0 prio 2 u32 match ip sport 15332 0xffff flowid 1:6
tc filter add dev $e protocol ip parent 1:0 prio 2 u32 match ip dport 15332 0xffff flowid 1:6

tc filter add dev $e protocol ip parent 1:0 prio 2 u32 match ip sport 3230 0xffff flowid 1:6
tc filter add dev $e protocol ip parent 1:0 prio 2 u32 match ip dport 3230 0xffff flowid 1:6
.
. shortened for posting purposes
.
.
tc filter add dev $e protocol ip parent 1:0 prio 2 u32 match ip sport 3247 0xffff flowid 1:6
tc filter add dev $e protocol ip parent 1:0 prio 2 u32 match ip dport 3247 0xffff flowid 1:6

#####################################
############ Sametime ###############
#                                   #

tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip src $SAMETIME/32 flowid 1:7
tc filter add dev $e protocol ip parent 1:0 prio 1 u32 match ip dst $SAMETIME/32 flowid 1:7

#####################################
######### 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
tc filter add dev $e protocol ip parent 1:0 prio 3 u32 match ip dst 0.0.0.0/0 flowid 1:9



[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux