Use trickle to limit network upload and download speed
Yum Install trickle
How does trickle work?
Trickle controls and limits the upload/download speed of applications by controlling the read and write volume of socket data. It uses another version of the BSD socket API,
But the difference is that trickle also manages the socket call. Note that Trickle uses dynamic linking and loading, so it is only for use with the "GLIBC library"
Program is useful. Since trickle can set the transmission delay of data on the socket, it can be used to limit the network bandwidth of an application.
What can trickle do?
Trickle cannot be used to limit the bandwidth of an application using the UDP protocol, it can only be used for TCP connections, but you need to know that it is not for all TCP
The connection is valid. If you have been reading this article carefully, you can guess what the reason is. Do you remember that trickle only works with the GLIBC library app?
How to verify that trickle can be used by the program.
LDD FileZilla | grep libc.so
Using trickle
# Trickle-u 100-d FTP
The above command restricts the FTP client's upload speed to 100k/s and the download speed to 50k/s. You can also use the following command to limit the bandwidth of all commands running in a shell. Another way to see the followingLinux limits the bandwidth of the NIC, which can be used to simulate server bandwidth exhaustion, thus testing the server's access at this time.
1, installation Iproute
Yum-y Install Iproute
2, limit the bandwidth of the Eth0 network card is 50kbit:
/SBIN/TC qdisc add dev eth0 root TBF rate 50kbit Latency 50ms Burst 1000
3, limit the bandwidth of 50kbit, in the LAN wget download a large file:
[Email protected] ~]# wget http://192.168.1.7/test.zip
--19:40:27--Http://192.168.1.7/test.zip
Connecting to 192.168.1.7:80 ... Connected.
HTTP request sent, awaiting response ... OK
length:23862312 (23M) [Application/zip]
Saving to: ' Test.zip '
37% [=======>] 8,994,816 457k/s ETA 27s
download speed is 457k/s, the limit effect is reached.
4. Remove the bandwidth limit for the ETH0 network card:
/SBIN/TC Qdisc del Dev eth0 root TBF
5, Contrast: Without bandwidth constraints, in the LAN wget download a large file:
[Email protected] ~]# wget http://192.168.1.7/test.zip
--19:44:33--Http://192.168.1.7/test.zip
Connecting to 192.168.1.7:80 ... Connected.
HTTP request sent, awaiting response ... OK
length:23862312 (23M) [Application/zip]
Saving to: ' Test.zip '
100%[==========>] 23,862,312 6.14m/s in 3.7s
19:44:36 (6.16 MB/s)-' test.zip ' saved [23862312/23862312]
download speed is 6.16mb/s.
Use trickle to limit network upload and download speed