Koozali.org: home of the SME Server
Obsolete Releases => SME VoIP (Asterisk, SAIL etc) => Topic started by: edeganay on September 10, 2007, 02:04:48 PM
-
Hello there,
I'm trying to get the QoS working fine,
Is there any one who can explain me what is the purpose of the purcentage of the bandwith etc ?
Thanks,
Edd
-
Hello
QOS was withdrawn from SAIL in -505. There is an announcement on the docs site to this effect (www.selintra.com/docs). This is because the qos algorithms we used (a variant on Wondershaper from Hans Cees) do not work well with recent variable rate broadband services. If you need QOS might we suggest you deploy a specialised appliance which can handle high-speed broadband circuits.
Kind Regards
S
-
ok then,
is there any possibility to integrate something like that directly in a SME in gateway mode, what module would you recommend.
I just want to reserve a fixed part of the bandwidth when calls are initiated (on everytime if it's easier).
Regards,
Edd
-
Hi edeganey,
Most of the QOS algorithms we've seen are based off the original "Wondershaper" work by Hans Cees. It's well documented but still pretty complex. I don't have a url but you should just be able to Google it.
Alternatively, most mid-range routers can reserve bandwidth for a particular port or ip address.
Kind Regards
S
-
I found this Qos when searching around one day and replaced the one that comes with SAIL (/etc/selintra/QoS/qos). This one was written specifically for DSL and works very well on my 1/1.5M DSL line.
#!/bin/sh
#quality of service script for DSL
# ---. /etc/functions.sh
IPT=/sbin/iptables
IP=/sbin/ip
TC=/sbin/tc
# Specify ethernet device (eth0, eth1, ppp0, etc), queue length, MTU
DEV=eth1
OUT_QLEN=30
MTU=1492
# Set to ~80% of tested maximum
UPLINK=640
# Specify class rates
UPLINK_1_R=200 # VOIP only
UPLINK_2_R=64 # Interactive traffic and ICMP/ACK
UPLINK_3_R=36 # Everything else
# Each class is also permitted to consume all of available bandwidth
# if no other classes are in use
UPLINK_1_C=${UPLINK}
UPLINK_2_C=${UPLINK}
UPLINK_3_C=${UPLINK}
if [ "$1" = "status" ]
then
tc -s qdisc ls dev $DEV
tc -s class ls dev $DEV
exit
fi
# clean existing down- and uplink qdiscs, hide errors
tc qdisc del dev $DEV root 2> /dev/null > /dev/null
tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null
if [ "$1" = "stop" ]
then
exit
fi
# Set outgoing queue length
$IP link set dev $DEV qlen ${OUT_QLEN}
# Remove old qdiscs
$TC qdisc del dev $DEV root 2> /dev/null > /dev/null
$TC qdisc del dev $DEV ingress 2> /dev/null > /dev/null
# Create HTB root qdisc with an htb default of 30
$TC qdisc add dev $DEV root handle 1: htb default 30
# Create main rate limit class
$TC class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit ceil ${UPLINK}kbit
# Create leaf rate limit classes
$TC class add dev $DEV parent 1:1 classid 1:10 htb rate ${UPLINK_1_R}kbit ceil ${UPLINK_1_C}kbit prio 0
$TC class add dev $DEV parent 1:1 classid 1:20 htb rate ${UPLINK_2_R}kbit ceil ${UPLINK_2_C}kbit prio 1
$TC class add dev $DEV parent 1:1 classid 1:30 htb rate ${UPLINK_3_R}kbit ceil ${UPLINK_3_C}kbit prio 2
# Attach qdisc to leaf classes - here we at SFQ to each priority class. SFQ
# insures that within each class connections will be treated (almost) fairly.
$TC qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
$TC qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
$TC qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10
$TC filter add dev $DEV parent 1:0 protocol ip prio 1 handle 1 fw classid 1:10
$TC filter add dev $DEV parent 1:0 protocol ip prio 2 handle 2 fw classid 1:20
$TC filter add dev $DEV parent 1:0 protocol ip prio 3 handle 3 fw classid 1:30
# UDP traffic in 1:10
tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 match ip protocol 17 0xff flowid 1:10
# Already marked TOS Minimum Delay (ssh, NOT scp) in 1:20:
tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 match ip tos 0x10 0xff flowid 1:20
# ICMP (ip protocol 1) in the interactive class 1:20 so we
# can do measurements & impress our friends:
tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 match ip protocol 1 0xff flowid 1:20
# To speed up downloads while an upload is going on, put ACK packets in
# the interactive class:
tc filter add dev $DEV parent 1: protocol ip prio 10 u32 match ip protocol 6 0xff match u8 0x05 0x0f at 0 match u16 0x0000 0xffc0 at 2 match u8 0x10 0xff at 33 flowid 1:20
-
That sounds intersting !
But I don't know where to put this code ?
The path you're talking about doesn't exist.
(yes I'm dumb)
Edd
-
ok, well, I'm dumb, this folder actually exists...I'm sorry
-
This is because the qos algorithms we used (a variant on Wondershaper from Hans Cees) do not work well with recent variable rate broadband services.
Jeff, do you mean by variable rate broadband services
you don't mean say 1.5/256 ADSL
when should users give up on the idea of software QOS
A lot users have said they are happy with htb qos
if we could define when this works it is going to help a (large?) class of users
-
Hi Stephen,
Hope you are well. I don't know the correct term for these services, but they are pretty much "standard" now in the UK. They are marketed by BT under the name ADSL MAX. As I understand it, they will run at "the maximum speed the line will allow", up to a maximum of 8Meg down (more recently 20Meg). After installation, the sending end (the carrier) gradually increases the download speed until they start to get synch errors. The line then resets itself and the process is repeated. This goes on for about two weeks after installation while the line settles down to its maximum sustainable rate. It also means that your real download speed can vary quite widely from day to day.
Unfortunately, the HTB Wondershaper algorithms we were using need to know the absolute line speed in order to work properly. I also wonder about the wisdom of SAIL doing the shaping. SAIL is a PBX app, not a network manager. I totally agree that a good QOS algorithm is/would be very useful, but I think maybe it should exist as a separate contrib in its own right.
I'd be happy to package the existing Wondershaper stuff as a Contrib for general use/community enhancement if you think it has merit. Maybe we could modularise it so that people can try different versions (like the one above). What do you think?
Kind Regards
Jeff
-
As a sidenote, we are experiencing the same issue here in OZ with ADSL2. Until I move to this service (typical 15000 down and 900 up), QOS in SAIl was working fine with my 1500/256 ADSL1 service. Speed was constant, no problems. With ADSL2, speed will vary widely at times, depending of network load etc. I suspect. D/L can drop to 6000. QOS in Sail could simply not handle this. This is not such an issue nowaday, most ADSL2 modems have inbuild QOS, i.e. Dynalink. Works like a charm for under $AU80 and should support ADSL1 also.
Rgds. chris.
-
Thanks Jeff,Chris
maybe it should exist as a separate contrib
that would be nice, I could get a new modem but it seems wasteful when software will work
(with the older 1.5/256 line)
also, do you have some diagnostics tests users can run to verify how effective the shaping is
-
I just finished a fresh install and qos wasn't working at all :shock:
Came to find out that the problem lies on the script being empty. So I copied it from a working server and I'm back on business :-P
Here's my /etc/e-smith/web/panels/manager/cgi-bin/sarkqos
#!/usr/bin/perl -T
#----------------------------------------------------------------------
# heading : SAIL PBX
# description : QoS
# navigation : 4000 4895
#
# Copyright (c) selitra.com 2005
#
#----------------------------------------------------------------------
#----------------------------------------------------------------------
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Technical support for this program is available from Selintra Ltd
# Please visit our web site www.selintra.com/ for details.
#----------------------------------------------------------------------
package esmith;
use strict;
use CGI ':all';
use CGI::Carp qw(fatalsToBrowser);
use esmith::cgi;
use esmith::config;
use esmith::util;
use esmith::db;
sub showInitial ($$);
sub updateQoS ($);
BEGIN
{
# Clear PATH and related environment variables so that calls to
# external programs do not cause results to be tainted. See
# "perlsec" manual page for details.
$ENV {'PATH'} = '';
$ENV {'SHELL'} = '/bin/bash';
delete $ENV {'ENV'};
}
esmith::util::setRealToEffective ();
$CGI::POST_MAX=1024 * 100; # max 100K posts
$CGI::DISABLE_UPLOADS = 1; # no uploads
my %conf;
tie %conf, 'esmith::config';
my %selintra;
tie %selintra, 'esmith::config', '/home/e-smith/db/selintra-work';
my %config;
tie %config, 'esmith::config', '/home/e-smith/db/configuration';
#------------------------------------------------------------
# examine state parameter and display the appropriate form
#------------------------------------------------------------
my $q = new CGI;
my $upbandwidthColor = 'black';
my $uppercentColor = 'black';
my $downbandwidthColor = 'black';
my $downpercentColor = 'black';
my $buttoncolour = 'lightskyblue';
my $maxundonum = '5';
if ($q->param ('help') eq 'Help')
{
helpScreen ($q);
}
elsif ($q->param ('commit') eq 'Commit')
{
updateQoS ($q);
}
elsif ($q->param ('start') eq 'Start')
{
performStart ($q);
}
elsif ($q->param ('stop') eq 'Stop')
{
performStop ($q);
}
elsif (! grep (/^state$/, $q->param) || $q->param ('back') eq 'Back')
{
showInitial ($q, '');
}
elsif ($q->param ('state') eq "updateQoS")
{
updateQoS ($q);
}
else
{
esmith::cgi::genStateError ($q, \%conf);
}
exit (0);
#------------------------------------------------------------
# subroutine to display initial form
#------------------------------------------------------------
sub showInitial ($$)
{
my ($q, $msg) = @_;
my $commit = db_get_prop(\%selintra, 'global', 'COMMIT') || 'YES';
my $systemmode = db_get_type(\%config, 'SystemMode') || '';
my $stopstart = db_get_prop(\%config, 'qosd', 'status') || 'disabled';
unless (exists $config {'qosd'}) {
db_set(\%config, 'qosd', 'service');
db_set_prop(\%config, 'qosd', 'status', 'disabled');
}
if ($msg eq '')
{
esmith::cgi::genHeaderNonCacheable ($q, \%conf,
'<img src="/server-common/sail_pbx1.jpg" align=absbottom border=0>');
}
else
{
esmith::cgi::genHeaderNonCacheable ($q, \%conf,
'<img src="/server-common/sail_pbx1.jpg" align=absbottom border=0>');
print $q->h4 ('Operation status report - '.$msg);
print $q->hr;
}
print $q->startform (-method => 'POST',
-action => $q->url (-absolute => 1));
#check to see if asterisk is running
unless ( -e "/var/run/asterisk.pid" )
{
print $q->p (esmith::cgi::genSmallRedCell ($q, 'NOTE: asterisk is not running. If it does not
start after saving a setting something is wrong...'));
}
unless ($systemmode eq 'servergateway') {
print $q->p (esmith::cgi::genSmallRedCell ($q, 'NOTE: It is not possible to implement QoS in server only mode'));
}
print "<br>";
my %qos = db_get_prop(\%selintra, 'QoS');
my $upbandwidth = ($qos{'upbandwidth'}) || '';
my $uppercent = ($qos{'uppercent'}) || '';
my $downbandwidth = ($qos{'downbandwidth'}) || '';
my $downpercent = ($qos{'downpercent'}) || '';
print $q->startform (-method => 'POST',
-action => $q->url (-absolute => 1));
print $q->table ({border => 0, cellspacing => 0, cellpadding => 4},
$q->Tr (
$q->td ({-class => "sme-noborders-label", -style => "Color: $upbandwidthColor"},
"Upload bandwidth in Kb:"),"\n",
$q->td ({-class => "sme-noborders-content"},
$q->textfield (
-name => 'upbandwidth',
-override => 1,
-default => $upbandwidth,
-size => 20))),
$q->Tr (
$q->td ({-class => "sme-noborders-label", -style => "Color: $uppercentColor"},
"Percentage of upload bandwidth:"),"\n",
$q->td ({-class => "sme-noborders-content"},
$q->textfield (
-name => 'uppercent',
-override => 1,
-default => $uppercent,
-size => 20))),
$q->Tr (
$q->td ({-class => "sme-noborders-label", -style => "Color: $downbandwidthColor"},
"Download bandwidth in Kb:"),"\n",
$q->td ({-class => "sme-noborders-content"},
$q->textfield (
-name => 'downbandwidth',
-override => 1,
-default => $downbandwidth,
-size => 20))),
$q->Tr (
$q->td ({-class => "sme-noborders-label", -style => "Color: $downpercentColor"},
"Percentage of download bandwidth:"),"\n",
$q->td ({-class => "sme-noborders-content"},
$q->textfield (
-name => 'downpercent',
-override => 1,
-default => $downpercent,
-size => 20))));
print "<br><br>";
print (esmith::cgi::genButtonRow ($q, $q->submit (-name => 'action',
-value => 'Save',
-style => "background-color:$buttoncolour")));
if ($commit eq 'YES') {
print (esmith::cgi::genButtonRow ($q, $q->submit (-name => 'commit',
-value => 'Commit',
-style => 'background-color:red')));
}
else {
print (esmith::cgi::genButtonRow ($q, $q->submit (-name => 'commit',
-value => 'Commit',
-style => "background-color:$buttoncolour")));
}
if ($systemmode eq 'servergateway') {
if ($stopstart eq 'enabled') {
print (esmith::cgi::genButtonRow ($q, $q->submit (-name => 'stop',
-value => 'Stop',
-style => "background-color:$buttoncolour")));
}
else {
print (esmith::cgi::genButtonRow ($q, $q->submit (-name => 'start',
-value => 'Start',
-style => "background-color:$buttoncolour")));
}
}
print '</table><p>';
print $q->hidden (-name => 'state', -override => 1, -default => 'updateQoS');
print $q->endform;
print $q->hr;
print '<a target=new href="http://www.selintra.com/docs/cgi-bin/view/Main/SysVers20"> <img src="/server-common/copyright_sel1.jpg" border=0></img></a>';
print '</FONT>';
print '</DIV>';
print $q->end_html;
}
#------------------------------------------------------------
# lines
#------------------------------------------------------------
sub updateQoS ($)
{
my ($q) = @_;
my $gonogo = 0;
my $upbandwidth = $q->param ('upbandwidth');
my $uppercent = $q->param ('uppercent');
my $downbandwidth = $q->param ('downbandwidth');
my $downpercent = $q->param ('downpercent');
my $commit = db_get_prop(\%selintra, 'global', 'COMMIT') || 'YES';
my $undonum = db_get_prop(\%selintra, 'global', 'UNDONUM') || '0';
my $line = 'QoS';
unless ($upbandwidth =~ /^\d+$/) {
$upbandwidthColor='red';
$gonogo = 1;
}
unless ($uppercent =~ /^\d+$/) {
$uppercentColor='red';
$gonogo = 1;
}
unless ($downbandwidth =~ /^\d+$/) {
$downbandwidthColor='red';
$gonogo = 1;
}
unless ($downpercent =~ /^\d+$/) {
$downpercentColor='red';
$gonogo = 1;
}
unless ($gonogo) {
unless (exists $selintra {$line}) {
db_set(\%selintra, $line, 'qos');
db_set_prop(\%selintra, $line, 'zzeor', 'EOR');
}
db_set_prop(\%selintra, $line, "upbandwidth", $upbandwidth);
db_set_prop(\%selintra, $line, "uppercent", $uppercent);
db_set_prop(\%selintra, $line, "downbandwidth", $downbandwidth);
db_set_prop(\%selintra, $line, "downpercent", $downpercent);
if ($q->param('commit') eq 'Commit') {
system "/bin/cp", "-f", "/home/e-smith/db/selintra", "/home/e-smith/db/selintra-undo$undonum";
system "/bin/cp", "-f", "/home/e-smith/db/selintra-work", "/home/e-smith/db/selintra";
system ("/sbin/e-smith/signal-event", "conf-asterisk") == 0
or die ("Error occurred during update of asterisk.\n");
db_set_prop(\%selintra, 'global', 'COMMIT', 'NO');
db_set_prop(\%selintra, 'global', 'UNDO', 'YES');
if ($undonum eq $maxundonum) {
$undonum = '0';
}
else {
$undonum++;
}
db_set_prop(\%selintra, 'global', 'UNDONUM', $undonum);
}
else {
db_set_prop(\%selintra, 'global', 'COMMIT', 'YES');
}
}
if ($gonogo == 1) {
showInitial ($q, "<font color = red> Errors were found in input!</font color = red><font color = black>");
}
else {
showInitial ($q, "<font color = red> QoS saved</font color = red><font color = black>");
}
}
sub performStart ($)
{
my ($q) = @_;
my $action = ();
system "/bin/chmod +x /home/QoS/qos";
$action = `/etc/init.d/qosd start`;
db_set_prop(\%config, 'qosd', 'status', 'enabled');
showInitial ($q, "<font color = red> QoS started</font color = red><font color = black>");
}
sub performStop ($)
{
my ($q) = @_;
my $action = ();
system "/bin/chmod +x /home/QoS/qos";
$action = `/etc/init.d/qosd stop`;
db_set_prop(\%config, 'qosd', 'status', 'disabled');
showInitial ($q, "<font color = red> QoS stopped</font color = red><font color = black>");
}
-
Hi Stuntshell,
It's not there 'cos we removed it. :lol: - take more than that to stop a determined guy!
Kind Regards
J