As a system administrator, you may encounter times where you need to limit bandwidth on a running process. For example, you're downloading a Linux ISO file and you don't want it to take up all of the server's bandwidth. You may also want to limit speeds while using an FTP utility on the server.
This article explains how to limit bandwidth on CentOS 5/6 using a utility called Trickle.
Execute the following command as root.
yum install epel-release && yum install trickle
Really, there isn't much to installing this software. Let's get to the uses.
Now that you have Trickle installed, it's time to see what it can do. To start, I'll show you an example of a normal
trickle -s -d 1000 wget http://cdimage.debian.org/debian-cd/8.1.0/i386/iso-cd/debian-8.1.0-i386-netinst.iso
You may press Ctrl+C after you've seen the speed of the download. In that example, Trickle limited the bandwidth to 1000kb/s (1mb/s). You can adjust the "1000" parameter to fit your needs.
To limit FTP, or anything within a shell session, use the following commands.
trickle -s -d 1000 /bin/bash ftp <ftphost>
Anything run in that shell session will be limited to 1mb/s. Therefore, FTP would be limited. When you're done, you can type exit on the bash session.
As the examples above show, Trickle makes it very easy to prevent your server from being tied up by bandwidth-heavy processes.