Linux通过trickleFTP Client限速

Trickle是一款用户端带宽管理软件。

Trickle通过控制socket数据读写量来控制和限制应用的上传/下载速度。

 

ldd工具可以帮我们找出某个特定的程序是否使用了libc.so库。如果程序使用了这个库,就可以使用trickle来限制它的网络带宽使用。

[root@linuxdrp ~]# which ftp | xargs ldd |grep libc.so

        libc.so.6 => /lib64/libc.so.6 (0x00007f8e4c95e000)

主机自带的ftp 使用了 libc.so库,所以trickle可以用来限制ftp的网络带宽。

 

安装包

rpm –ivh trickle-1.07-19.el6.x86_64.rpm

 

测试功能,download限速50k

[root@linuxdrp sdbs]# trickle -d 50 /usr/kerberos/bin/ftp 10.240.10.15

trickle: Could not reach trickled, working independently: No such file or directory

Connected to 10.240.10.15.

220 cim7tst1 FTP server ready.

Name (10.240.10.15:root): sdbs

331 Password required for sdbs.

Password:

230 User sdbs logged in.

Remote system type is UNIX.

Using binary mode to transfer files.

 

ftp> get brocade200E-1-config.txt

local: brocade200E-1-config.txt remote: brocade200E-1-config.txt

227 Entering Passive Mode (10,240,10,15,131,30)

150 Opening BINARY mode data connection for brocade200E-1-config.txt (12064 bytes).

226 Transfer complete.

12064 bytes received in 0.26 seconds (45 Kbytes/s)

 

对比不使用限速,抓取同样的文件

ftp> get brocade200E-1-config.txt

local: brocade200E-1-config.txt remote: brocade200E-1-config.txt

227 Entering Passive Mode (10,240,10,15,232,25)

150 Opening BINARY mode data connection for brocade200E-1-config.txt (12064 bytes).

226 Transfer complete.

12064 bytes received in 0.00095 seconds (1.2e+04 Kbytes/s)

 

 

 

参考文档:

安装包下载

https://pkgs.org/download/config(trickle)

Linux 下使用Trickle限制下载/上传带宽

https://linux.cn/article-2375-1.html