Traffic shaping using Wondershaper

Even if you have a fast internet connection, the response times (ping, initiating connections, loading webpages, etc) can go slow (high latency) if you have lot of net traffic.

Effective way to improve the response times is using traffic shaping. Traffic shaper can be a software installed in your router or even a separate device. Basically traffic shaping prioritizes traffic so that the response times stay fast when initiating new connections (i.e. opening web page). Complex traffic shaping might need substantial amounts of configuration and testing work, so I wanted to find a quick and working solution for small office and home needs.

Wondershaper is a simple traffic shaping software for Linux. It doesn't have all the whistles and bells but you can easily get it up and running under 10 minutes. Despite it looks the last version is quite old, it works quite well when properly configured.

These examples are done in Debian Linux using network interface eth2 with a dynamic IP-address, so differences might apply using different distributions of Linux.

 


Installing Wondershaper

You can install wondershaper by using package manager like Synaptic or by using command:

apt-get install wondershaper 

 


Starting and configuration of Wondershaper

Syntax: wondershaper [network interface] [down speed kbit/s] [up speed kbit/s]

Example for 8/1M ADSL connection:

wondershaper eth2 6700 800 

If you want to clear wondershaper queues (disabling traffic shaping):

Syntax: wondershaper clear [network interface]

wondershaper clear eth2 

 

Generally I think quite usable speed settings you will find around 80% of the connection nominal speeds, like in this example, 6700/800 for 8/1M connection.

Of course the actual connection speeds can change and also personal network usage can be different, so for the best performance, you should do some testing, what setting is right for your net connection and your needs.

One easy way to test is to ping some server nearby and start downloading big file from fast server outside of LAN. During file transfer you can clear the wondershaper settings, and set new speeds to it, and same time observing how the ping response times change. You will be in right range when the ping response time doesn't significantly get better even if you limit the traffic more by setting lower speed to wondershaper. Test the ping response times also when uploading a file.

 


Starting wondershaper automatically when OS starts

This can be done adding couple lines to file /etc/network/interfaces

Before:

iface eth2 inet dhcp 
auto eth2 

After:

iface eth2 inet dhcp 
   up /sbin/wondershaper eth2 6700 800 
   down /sbin/wondershaper clear eth2 
auto eth2  
 

Notice this is just an example. Actual settings might differ a bit in your system. For example, in your system the network interface might be eth0 instead of eth2.

 


Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.