|
trickle is an interesting tool with which it is possible limitar el bandwidth both up and down of ALL our applications. It can be run "on demand" to control a specific application, or as a daemon, thus controlling all applications that try to connect to the Internet. |
Installation
sudo apt-get install trickle
How to use trickle
Trickle's syntax is as follows:
trickle -d Download_Bandwidth -u Upload_Bandwidth Command
Here are some examples:
a) Limit the download bandwidth to 10kbps used to transfer a file using ssh:
trickle -d 10 scp file.mp3 10.0.0.1:/home/puntolibre/musica/
b) Limit the bandwidth to 200kpbs of download of a system update through Apt:
trickle -d 200 apt-get upgrade
c) To modify the bandwidth of an application, such as Firefox:
trickle -d 10 -u 10 firefox% u
d) Using trickle to limit wget's bandwidth
trickle -d 50 wget -O “planet earth.divx” http://video.stage6.com/1402821/.divx
Run trickle like a demon
To start trickle like a daemon and limit ALL bandwidth, use the trickled command:
sudo trickled -d 20 -u 20
… Where the parameters -d and -u respond to the download and upload limit, respectively.
Configuring trickle
Trickle has a configuration file that will allow us to fine-tune some parameters and make them permanent individually for each service.
The configuration file is as follows: /etc/trickled.conf
The simplest configuration file that can be made looks like this:
[ssh] Priority = 1
[www] Priority = 8
With this method we get quite good download speeds and at the same time we can do ssh sessions to the machine that is downloading. Basically, a config file like the one above tells trickle to prioritize ssh transfers over www.
Trickle's documentation recommends the use of the Time-Smoothing and Length-Smoothing parameters to avoid fluctuations in transfer rates.
[ssh] Priority = 1
Time-Smoothing = 0.1
Length-Smoothing = 2
[www] Priority = 8
Time-Smoothing = 5
Length-Smoothing = 20
These values define the normalization time and length that Trickle applies to the program it is controlling.
Source: trickle