Have you ever encountered a program occupying all your network bandwidth? If you have met, You need to limit the bandwidth of the application. Whether you are a system administrator or a common Linux user, you should learn how to control the upload and download speeds of applications to ensure that your network bandwidth is not consumed by a program.
What is Trickle?
Trickle is a bandwidth control supply used to limit the bandwidth of Firefox, FTP, SSH, and other programs that use network bandwidth. Do you want your Youtube music experience to affect ftp download? If you don't want to, read this article to learn how to install and use trickle on your machine.
How to install Trickle on Linux
The trickle tool has some dependent packages. Before installing and using trickle, you must install the "libevent library". However, this library has been installed by default on most existing Linux machines.
On Debian/Ubuntu/Linux Mint
Run apt-get install trickle On Debian/Ubuntu/Mint to install the tool. Make sure that the source list has been updated, and then install the application you want.
$ sudo apt-get update$ sudo apt-get install trickle
On RHEL/CentOS/Fedora
First, you need to update the system, and then use the following command to install trickle.
# yum update# yum install trickle
How does Trickle work?
Trickle controls and limits the upload/download speed of applications by controlling the socket data read/write volume. It uses the BSD socket API of another version, but the difference is that trickle also manages socket calls.
Note that trickle uses dynamic links and loads, so it is only useful for programs that use the "Glibc library. Because trickle can set the transmission delay of data on the socket, it can be used to limit the network bandwidth of an application.
What does Trickle do?
Trickle cannot be used to limit the bandwidth of UDP-enabled applications. It can only be used for TCP connections, but you need to know that it is not valid for all TCP connections. If you keep reading this article carefully, you can guess why. Do you still remember that trickle is only valid for applications using the Glibc library?
Also, trickle cannot work on executable programs that use static links.
Determine whether Trickle can run on a specific application
Since trickle cannot limit the upload/download speed of each application, there should be a way to find the application that trickle can work.
The ldd tool helps us find out whether a specific program uses the libc. so library. If the program uses this library, you can use trickle to limit its network bandwidth usage.
The ldd command is used to print the shared libraries required by each program. If you are curious about Linux Geek, you can use the man command to find more information about the ldd tool.
# man ldd
Filezilla is a program that transfers files using the ftp protocol. can trickle limit its download or upload speed? During your consideration, I use the following command to find out If trickle can be used in filezilla.
# ldd filezilla | grep libc.so
For me, it outputs the following:
oltjano@oltjano-X55CR:/usr/bin$ ldd filezilla | grep libc.so libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb6bc4000)
Since filezilla uses the "libc. so" library, trickle can be used to limit its network bandwidth. This method can be used in any program you are interested in.
Experience in bandwidth control in Linux