A Simple but effective QOS script for all IAX traffic going to a certain host.
I have been trying to get this working off and on for a year now. Part of the reason was my lack of linux administrator experience and QoS is a rather advanced topic. After spending many hours researching and trying scripts that are too complicated and dont seem to work and hours of waised time dealing with customers who like to bomb out their internet connection with outlook and the like, i have created this script which i have borrowed ideas from many different places on the web as well as spending a few hours reading about the iproute and tc application tool set. I have tested this script and it will make a huge difference on crappy DSL connections although it doesn't fix it perfectly. On T1 connections, it does make a huge difference. This script is meant for use with IAX server to server communication or with limited effects, a sip phone with the QoS bit set to 0x10 (minimize latency) I hope it helps you out so we can make VOIP the dominant technology in the world.
on your Debian stable build...
1) apt-get install iproute
2) nano qos.sh
#copy this into the scrips and save and exit the program
#-------------------------------------------------------------------------------------------
# Ztelco.com Simple QoS Script v0.2
# Script is tested working with asterisk and polycom 501 phones.
#remove any old rules before continuing
tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1: prio priomap 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 0
tc qdisc add dev eth0 parent 1:1 handle 10: sfq limit 3000
tc qdisc add dev eth0 parent 1:2 handle 20: sfq
#uncomment out this line if you want to rate limit your connection.
#tc qdisc add dev eth0 parent 1:3 handle 30: tbf rate 0.20mbit burst 5kb latency 250ms peakrate 0.22mbit minburst 1540
#if you uncommented the line above, then comment this line out
tc qdisc add dev eth0 parent 1:3 handle 30: sfq #no limit on traffic (could still bomb your pipe if you try)
#filter the packets into the correct places
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 match ip dport 4569 0xffff flowid 1:1
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 match ip sport 4569 0xffff flowid 1:1
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 match ip tos 0x10 0xff flowid 1:1
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dport 4569 0xffff match ip dst a.b.c.d/32 classid 1:10
#----------------------------------------
3) now assuming your in the same directory as your program
chmod +x qos.sh ; ./qos.sh
ETH0 is assumed to be the external interface
a.b.c.d is assumed to be the IP ADDRESS TO VOIP server that your routing your traffic to
This script sets up 3 different pipes. It will always allow pipe 1:10 to go before 1:20. It will always allow 1:20 to go before 1:30. It then classifies all traffic that is on port 4569 (IAX) to be in the 1:10 group. Anything that simply has a 0x10 QOS FLAG (minimize latency) is placed in the 1:20 group(many voip phones have this option but you may need to enable it in the phones interface). Then finally every thing that was not matched goes last(this is basically everything not voip).
TESTING is simple. While on an iax connected call, run one of those speed tests. While doing that browse around in google earth (a huge bandwidth hog). Before you enable the script, you will have a 30 second breakup in your conversation. Now run the script and see the difference.
Please comment if you try this and it works or doesn't work for you.
WATCH YOUR SCRIPT IN ACTION: TYPE THE FOLLOWING AT THE CONSOLE
watch tc -s qdisc ls dev eth0
REMOVE THE SCRIPT AND GO BACK TO DEFAULT SETTINGS:
tc qdisc del dev eth0 root

Recent comments
2 years 13 weeks ago
2 years 23 weeks ago
2 years 23 weeks ago
2 years 29 weeks ago
2 years 35 weeks ago
2 years 37 weeks ago
2 years 49 weeks ago
2 years 50 weeks ago
2 years 50 weeks ago
3 years 13 weeks ago