Difference between revisions of "Wondershaper"

From SME Server
Jump to navigationJump to search
Line 1: Line 1:
 
==HTBWondershaper Traffic Shaping script==
 
==HTBWondershaper Traffic Shaping script==
{{Note box| you can see the contrib [[qos|smeserver-qos]] if you need the ability to set qos on your network}}
+
{{Note box| you can see the contrib [[qos|smeserver-qos]] if you need the ability to set quality of service on your network}}
 
===Description===
 
===Description===
  

Revision as of 12:14, 22 November 2013

HTBWondershaper Traffic Shaping script

Important.png Note:
you can see the contrib smeserver-qos if you need the ability to set quality of service on your network


Description

The HTBWondershaper script implements traffic shaping/QoS by filtering outgoing traffic into classes and setting limits/priorities for these classes. Each class gets a lower and upper bandwidth limit. Each class also has a priority, and if the priority is lower, the traffic goes first. The script as designed only shapes upward (outgoing) traffic.

Design Benefits

It uses HTB filter - this guarantees minimum bandwidth per class and divides surplus bandwidth evenly

It uses "iptables marks" to filter traffic into classes - this means you can use the rather simple iptables language to put specific traffic into TC classes rather than the complex non-documented TC stuff.

Nomenclature

Shaping - The process of delaying packets before they go out to make traffic confirm to a configured maximum rate. Shaping is performed on egress (outgoing traffic). Colloquially, dropping packets to slow traffic down is also often called Shaping.

Policing - Delaying or dropping packets in order to make traffic stay below a configured bandwidth. In Linux, policing can only drop a packet and not delay it - there is no 'ingress queue'.


Installation instructions

Log in to your sme server as root or as a user with root privileges and do

mkdir -p /opt/scripts/htbw
cd /opt/scripts/htbw
wget http://www.hanscees.com/sme7/HTBWondershaper

Edit the script to make basic changes for your broadband connection speed

pico -w /opt/scripts/htbw/HTBWondershaper

As a minimum adjust the variables DOWNLINK, CEIL, EXTDEV & LANDEV to suit your situation

DOWNLINK should be your actual (not rated) download speed in Kb

CEIL should be 75% of your actual (not rated) upstream bandwidth in Kb

EXTDEV is your external internet device usually eth1

LANDEV is your local device usually eth0

Typical settings for a "real world" ADSL connection that is 2 or 3 km from a telephone exchange

on line 99

DOWNLINK=4000

on line 103

CEIL=560

on line 108 & 109

EXTDEV=eth1
LANDEV=eth0

Save the changes & exit

Ctrl o
Ctrl x

Make make the script executable

cd /opt/scripts/htbw
chmod +x HTBWondershaper


Add the script to the start up sequence to load it at reboot

pico -w /etc/rc.d/rc.local

Add the following line to the end of the file (change location to suit where you actually put the script)

/opt/scripts/htbw/HTBWondershaper

Save & exit

Ctrl o
Ctrl x

Start the HTBWondershaper script

/opt/scripts/htbw/HTBWondershaper

Check the status of the script

/opt/scripts/htbw/HTBWondershaper status

Next time your server reboots check that the HTBWondershaper script runs during the startup process.


Removal instructions

To totally remove the script from your system and stop the script from running at startup time do the following.

To stop the script do

/opt/scripts/htbw/HTBWondershaper stop

Delete the script

rm /opt/scripts/htbw/HTBWondershaper

Remove the startup entry from /etc/rc.d/rc.local

pico -w /etc/rc.d/rc.local

Remove the following line from the file

/opt/scripts/htbw/HTBWondershaper

Save & exit

Ctrl o
Ctrl x


Additional configuration tips & information

The script is highly customisable. There is detailed information within the script, so please carefully read the script contents to see the extent of configuration possibilities. Please read the information at the authors website http://www.hanscees.com/sme7/wondershaperbeefedup.html

Also read information provided in the forum posts (linked in the References section) for additional & very informative configuration & customisation tips.

Contribs for Wondershaper & QOS

Adding all this information here to help sort out & track what's going on with these packages, will tidy it up later & remove unwanted information.

There are two contribs rpm packages that have been developed but the status of them both is unsure. It appears that smeserver-htbwondershaper may have problems & is no longer being developed. It appears that smeserver-qos is awaiting import into the contribs cvs system.

There are also suggestions here http://forums.contribs.org/index.php/topic,45037.msg217958.html#msg217958 by knuddi that software based qos may not work very well in certain types of situations, so the effectiveness of these types of contribs is unsure.

The first contrib is here:

http://distro.ibiblio.org/smeserver/releases/7/smetest/i386/RPMS/smeserver-htbwshaper-1.0-14.el4.sme.noarch.rpm

See the original release announcement here http://forums.contribs.org/index.php/topic,43321.0.html

Comments by S Noble from http://forums.contribs.org/index.php/topic,45037.msg217934.html#msg217934 see http://bugs.contribs.org/show_bug.cgi?id=5005 for a later version of smeserver-htbwshaper

"I made a few minor changes, but it still had a fundamental flaw it issues an iptables command to enable shaping after booting but if you run a sme event that restart masq the command isn't rerun I couldn't work out how to insert the command into a template"

According to http://bugs.contribs.org/show_bug.cgi?id=5005 S Noble says the contrib is abandoned, refer http://forums.contribs.org/index.php/topic,45037.msg217923.html


The other contrib package is here:

http://repo.firewall-services.com/sme/noarch/smeserver-qos-1.0-4.noarch.rpm or later versions here for el4 and el5 are here: http://repo.firewall-services.com/centos/4/noarch/smeserver-qos-1.1-10.el4.fws.noarch.rpm and http://repo.firewall-services.com/centos/5/noarch/smeserver-qos-1.2.0-1.el5.fws.noarch.rpm

Some comments from Nov 2009 re above packages from VIP-ire at http://forums.contribs.org/index.php/topic,45037.msg217927.html#msg217927

"This contrib (smeserver-qos) is not documented yet, because I'd first like to import it in the smecontrib repo. I've already asked for it, but it seems it wasn't accepted. The reason is that there's already a contrib called smeserver-htbwshaper imported, which does the same job. This contrib was not sufficient for my need, so I've "forked" it and created smeserver-qos. But now, the changes I've made are too important to merge it with the smeserver-htbwshaper with small patches. If I find some time to talk to the author of the original contrib, I'll try to merge the changes."

and by mary "The HTBWondershaper script method has been replaced by the smeserver-htbwshaper rpm, which has been superseded by the smeserver-qos rpm. It's just that processes and documentation have not been updated to match the newer releases."

In December 2012 at http://bugs.contribs.org/show_bug.cgi?id=7100 Daniel wrote "I'll try to write a little wiki page as soon as the package is imported in CVS and built"

Also refer to http://bugs.contribs.org/show_bug.cgi?id=7100 for progress re development of smeserver-qos

Also read http://forums.contribs.org/index.php/topic,45037.0.html for general details of usage & development progress

References

http://forums.contribs.org/index.php?topic=29546.0

http://forums.contribs.org/index.php?topic=29495.0

http://www.hanscees.com/sme7/wondershaperbeefedup.html

http://www.hanscees.com/sme7/HTBWondershaper

http://lartc.org/