How I Manage Bandwidth Using Trickle On Ubuntu
Trickle is a portable application bandwidth shaper lightweight. It can run in collaborative mode “together with trickled” or in stand alone mode.
Trickle is a great tool command line based. trickle can be limit application bandwidth, upload or download speed, and prioritizing daemons. You can use Trickle to cap application speeds per application, download, filetype or globally.
Trickle works by taking advantage of the unix loader preloading. Basically it provides, to the application, the new version of the functionality required to send and receive data through sockets. Then limit traffic based on delaying to send and receive data throughsockets. trickle runs entirely in userspace and does not need root privileges.
How to Install and Usage Trickle on Ubuntu
Trickle Installation
Trickle it’s available on Ubuntu Software Repository, to install trickle you can install via Ubuntu Software Center or install via terminal by typing command:
sudo apt-get install trickle
Basic Use Trickle
To use a trickle in standalone mode, you can use a single command, in this method the syntax is:
trickle -d download-bandwidth -u upload-bandwidth command
See Example:
- Limit the download bandwidth at 100Kbps for wget
trickle -d 100 wget http://cdimage.ubuntu.com/daily/current/precise-alternate-i386.iso
- Start Firefox limiting its download to 25 KB/s, and upload badwidth to 15 KB/s
trickle -d 25 -u 15 firefox
- Limit to 384kpbs the download bandwidth for a system update via apt-get:
trickle -d 200 apt-get upgrade
Running trickle as a Daemon Collaborative-Mode
To start trickle as daemon mode and limit all the bandwidth, use the command trickled with the following syntax:
sudo trickled -d download-bandwidth -u upload-bandwidth command
This is Example to start the daemon and limit upload 100Kbps and download at 200Kbps
sudo trickled -d 200 -u 100
trickle daemon above will limit the total bandwidth available to all programs run via trickle to 200 KB/s both up and down. if you run a single program using trickle, it can consume 200 Kbps. Two programs can each consume 100 Kbps
Trickle Configuration File
If you run Trickle, it checks to see if the trickled daemon is running and implements the parameters defined in the file for the program it is running. Trickle will override the options defined in the /etc/trickled.conf file if you specify values with the Trickle command
This is Example of trickle default configuration:
[ssh] Priority = 1 Time-Smoothing = 0.1 Length-Smoothing = 1 [www] Priority = 2 Time-Smoothing = 5 Length-Smoothing = 10 [ftp] Priority = 8
Here, SSH has the highest priority so that remote sessions aren’t slow and the time- and length-smoothing values ensure the same. Nothing upsets people more than slow browsing, so WWW is next in the priority chain. Finally, I don’t do much of FTP, so it has the lowest priority, and since I haven’t assigned any smoothing values, Trickle will use the default value.