Difference between revisions of "Wondershaper"

From SME Server
Jump to navigationJump to search
(added HTBWondershaper script Howto)
 
(added HTBWondershaper script Howto)
Line 3: Line 3:
 
===Description===
 
===Description===
  
The HTBWondershaper script implements traffic shaping 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 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
+
'''Design Benefits'''
  
It uses HTB filter: this guarantees minimum bandwidth per class and divides surplus bandwidth evenly
+
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.
+
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
+
'''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.
+
''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'.
+
''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'.
  
  
Line 28: Line 28:
 
  pico -w /opt/scripts/htbw/HTBWondershaper
 
  pico -w /opt/scripts/htbw/HTBWondershaper
  
As a minimum adjust the variables DOWNLINK, CEIL, EXTDEV & LANDEV to suit yuour situation
+
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
 
DOWNLINK should be your actual (not rated) download speed in Kb
 +
 
CEIL should be 75% of your actual (not rated) upstream bandwidth in Kb
 
CEIL should be 75% of your actual (not rated) upstream bandwidth in Kb
 +
 
EXTDEV is your external internet device usually eth1
 
EXTDEV is your external internet device usually eth1
 +
 
LANDEV is your local device usually eth0
 
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
 
Typical settings for a "real world" ADSL connection that is 2 or 3 km from a telephone exchange
eg on line 99
+
 
 +
on line 99
 
  DOWNLINK=4000
 
  DOWNLINK=4000
 
on line 103
 
on line 103
Line 80: Line 86:
 
  rm /opt/scripts/htbw/HTBWondershaper
 
  rm /opt/scripts/htbw/HTBWondershaper
  
Remove the starup entry from /etc/rc.d/rc.local
+
Remove the startup entry from /etc/rc.d/rc.local
 
  pico -w /etc/rc.d/rc.local
 
  pico -w /etc/rc.d/rc.local
  
Line 97: Line 103:
 
Please read the information at the authors website  http://www.hanscees.com/sme7/wondershaperbeefedup.html
 
Please read the information at the authors website  http://www.hanscees.com/sme7/wondershaperbeefedup.html
  
Also read information provided in the forum posts shown in the References section for additional configuration tips.
+
Also read information provided in the forum posts (linked in the References section) for additional & very informative configuration & customisation tips.
  
  
Line 103: Line 109:
  
 
http://forums.contribs.org/index.php?topic=29546.0
 
http://forums.contribs.org/index.php?topic=29546.0
 +
 
http://forums.contribs.org/index.php?topic=29495.0
 
http://forums.contribs.org/index.php?topic=29495.0
 +
 
http://www.hanscees.com/sme7/wondershaperbeefedup.html
 
http://www.hanscees.com/sme7/wondershaperbeefedup.html
 +
 
http://www.hanscees.com/sme7/HTBWondershaper
 
http://www.hanscees.com/sme7/HTBWondershaper
 +
 
http://lartc.org/
 
http://lartc.org/
 +
 +
 +
----
 +
[[Category:Howto]]
 +
[[Category: Administration]]

Revision as of 13:43, 15 November 2007

HTBWondershaper Traffic Shaping script

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.


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/