1. The problem
You have limited bandwidth, which you need to share with some others or just between different services on you PC. So you need a tool that can shape, control and manage the bandwidth so everybody can make a responsible use of it. 2. The solution
Here is where trickle comes to help us. trickle - a lightweight userspace bandwidth shaper, that will help use control the use of our bandwidth.
- Installing it.
For Centos and Fedora
yum install trickle
For Debian and Ubuntu
apt-get install trickle
This will actually install two binaries: trickle which is the stand alone version trickled which is the daemon version
How to use it
The syntax is: trickle [-h] [-v] [-V] [-s] [-d rate] [-u rate] [-w length] [-t time] [-l length] [-n path] command man trickle for more details The example is: <p class="codigo">trickle -d 20 wget http://url.of.the.site/file.to.download<p class="codigo">
The use of the daemon version is more useful specially because you will not need to enter the parameters each time you use trickle just enter.
i.e. trickle ssh -l user ip.of.the.server And the daemon will look on its config file to follow that policies.
All the configuration should be done in the file: /etc/trickled.conf
Here is an example of that file:
[ssh] Priority = 1 Time-Smoothing = 0.1 Length-Smoothing = 2 [ftp] Priority = 8 Time-Smoothing = 5 Length-Smoothing = 20
Priority: Sets the priority a session have the lowest the priority number is, the highest priority the protocol have.
Length-Smoothing: Set smoothing length to length KB. The smoothing length is a fallback of the smoothing time. If trickled cannot meet the requested smoothing time, it will instead fall back on sending length KB of data. The default value is 10 KB.
Time-Smoothing: Set smoothing time to seconds s. The smoothing time determines with what intervals trickled will try to let the application transcieve data. Smaller values will result in a more continuous (smooth) session, while larger values may produce bursts in the sending and receiving data. Smaller values (0.1 - 1 s) are ideal for interactive applications while slightly larger values (1 - 10 s) are better for applications that need bulk transfer. This parameter is customizable on a per-application basis via trickled.conf(5). The default value is 5 s.
Remember that trickle only works for TCP connections and not for UDP ones.
More info: here