Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux installation and use of Trickle for better broadband control

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "Linux installation and use of Trickle in order to better broadband control methods", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Linux installation and use of Trickle in order to better broadband control methods" bar!

What is Trickle?

Trickle is a bandwidth control provider that limits the bandwidth of programs such as Firefox, FTP, SSH, and other applications that use network bandwidth. Do you want your Youtube music experience to affect your ftp download? If you don't want to, please continue reading this article to learn how to install and use trickle on your machine.

How to install Trickle on Linux

The trickle tool has some dependency packages, and the "libevent library" must be installed before installing and using trickle, but this library is installed by default on most modern Linux machines.

On Debian/Ubuntu/Linux Mint

Run apt-get install trickle on the Debian/Ubuntu/Mint machine to install. 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 amount of socket data read and written. It uses another version of the BSD socket API, but the difference is that trickle also manages socket calls.

It is important to note that trickle uses dynamic linking and loading, so it is only useful for programs that use the Glibc library. Because trickle can set the transmission delay of data on socket, it can be used to limit the network bandwidth of an application.

What can't Trickle do?

Trickle cannot be used to limit the bandwidth of applications that use the UDP protocol, it is only available for TCP connections, but you should know that it is not valid for all TCP connections. If you have been reading this article carefully, you can guess the reason. Do you remember that trickle is only valid for applications using Glibc libraries?

Also, trickle does not 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 out which applications trickle works.

The ldd tool can help us find out whether a particular program uses the libc.so library. If the program uses this library, it can use trickle to limit its network bandwidth usage.

The ldd command is used to print the shared libraries that each program needs. If you are a curious Linux Geek, you can use the man command to find out more about the ldd tool.

# man ldd

Filezilla is a program that uses the ftp protocol to transfer files. Can trickle be used to limit its download or upload speed? While you are thinking about it, I use the following command to find out if trickle is available for filezilla.

# ldd filezilla | grep libc.so

As far as I'm concerned, it outputs as follows:

Oltjano@oltjano-X55CR:/usr/bin$ ldd filezilla | grep libc.so

Libc.so.6 = "/ lib/i386-linux-gnu/libc.so.6 (0xb6bc4000)

Now that filezilla uses the "libc.so" library, trickle can be used to limit its network bandwidth. This method can be applied to any program you are interested in.

Learn how to use Trickle

Use the following command to output the version of the trickle tool.

Root@oltjano-X55CR:~# trickle-V

Trickle: version 1.07

Linux has many command-line tools to make testing (experiments) interesting and beautiful. The following command uses the wget tool to download the latest Pear OS image.

Root@oltjano-X55CR:~# wget http://sourceforge.net/projects/pearoslinux/files/Pear%20OS%208/pearos8-i386.iso/download

-- 2013-11-20 11 56 Rose 32-http://sourceforge.net/projects/pearoslinux/files/Pear%20OS%208/pearos8-i386.iso/download

Resolving sourceforge.net (sourceforge.net). 216.34.181.60

Connecting to sourceforge.net (sourceforge.net) | 216.34.181.60 |: 80.. Connected.

HTTP request sent, awaiting response. . . 302 Found

Location: http://downloads.sourceforge.net/project/pearoslinux/Pear%20OS%208/pearos8-i386.iso? R=&ts=1384928843&use_mirror=kaz [following]

-- 2013-11-20 11 56 Rose 33 muri-http://downloads.sourceforge.net/project/pearoslinux/Pear%20OS%208/pearos8-i386.iso? R=&ts=1384928843&use_mirror=kaz

Resolving downloads.sourceforge.net (downloads.sourceforge.net). 216.34.181.59

Connecting to downloads.sourceforge.net (downloads.sourceforge.net) | 216.34.181.59 |: 80.. Connected.

HTTP request sent, awaiting response. . . 302 Found

Location: http://kaz.dl.sourceforge.net/project/pearoslinux/Pear%20OS%208/pearos8-i386.iso [following]

-- 2013-11-20 11 56 Rau 33 muri-http://kaz.dl.sourceforge.net/project/pearoslinux/Pear%20OS%208/pearos8-i386.iso

Resolving kaz.dl.sourceforge.net (kaz.dl.sourceforge.net). 88.204.157.163

Connecting to kaz.dl.sourceforge.net (kaz.dl.sourceforge.net) | 88.204.157.163 |: 80.. Connected.

HTTP request sent, awaiting response. . . 200 OK

Length: 1093664768 (1.0g) [application/octet-stream]

Saving to: 'download'

0% [] 30pm 78278 381KB/s eta 1h 50m

As you can see from the output, the download speed is about 381KB/s. I want to limit the download speed to 13 KUnip s so that I can use my bandwidth to do other things. The following command is used to limit the wget speed to 13K Universe.

Ravisaive@ravisaive-OptiPlex-380:~$ trickle-d 13 wget http://sourceforge.net/projects/pearoslinux/files/Pear%20OS%208/pearos8-i386.iso/download

-- 2013-11-20 12 01RV 19muri-http://sourceforge.net/projects/pearoslinux/files/Pear%20OS%208/pearos8-i386.iso/download

Resolving sourceforge.net (sourceforge.net). 216.34.181.60

Connecting to sourceforge.net (sourceforge.net) | 216.34.181.60 |: 80.. Connected.

HTTP request sent, awaiting response. . . 302 Found

Location: http://downloads.sourceforge.net/project/pearoslinux/Pear%20OS%208/pearos8-i386.iso? R=&ts=1384929129&use_mirror=kaz [following]

-- 2013-11-20 12 01Rose 19muri-http://downloads.sourceforge.net/project/pearoslinux/Pear%20OS%208/pearos8-i386.iso? R=&ts=1384929129&use_mirror=kaz

Resolving downloads.sourceforge.net (downloads.sourceforge.net). 216.34.181.59

Connecting to downloads.sourceforge.net (downloads.sourceforge.net) | 216.34.181.59 |: 80.. Connected.

HTTP request sent, awaiting response. . . 302 Found

Location: http://kaz.dl.sourceforge.net/project/pearoslinux/Pear%20OS%208/pearos8-i386.iso [following]

-- 2013-11-20 12 01Rose 20muri-http://kaz.dl.sourceforge.net/project/pearoslinux/Pear%20OS%208/pearos8-i386.iso

Resolving kaz.dl.sourceforge.net (kaz.dl.sourceforge.net). 88.204.157.163

Connecting to kaz.dl.sourceforge.net (kaz.dl.sourceforge.net) | 88.204.157.163 |: 80.. Connected.

HTTP request sent, awaiting response. . . 200 OK

Length: 1093664768 (1.0g) [application/octet-stream]

Saving to: 'download.1'

0% [] 2 01550 13.1KB/s eta 21h 5m

As you can see from the output, the download speed is limited to 13K/s. The download will last 21 hours and 5 minutes. The "- d" option above indicates download, and you can also use the "- d" option in combination with the upload option (- u), as shown in the following example.

# trickle-u 100-d 50 ftp

The above command limits the upload speed of the ftp client 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.

Trickle-d 130-u 13 bash

Each command line tool provides help to the user, using the "trickle-h" command to find out more about the use of the trickle tool.

Root@oltjano-X55CR:/usr/bin# trickle-h

Usage: trickle [- hvVs] [- d "rate"] [- u "rate"] [- w "length"] [- t "seconds"]

[- l "length"] [- n "path"] command.

-h Help (this)

-v Increase verbosity level

-V Print trickle version

-s Run trickle in standalone mode independent of trickled

-d "rate" Set maximum cumulative download rate to "rate" KB/s

-u "rate" Set maximum cumulative upload rate to "rate" KB/s

-w "length" Set window length to "length" KB

-t "seconds" Set default smoothing time to "seconds" s

-l "length" Set default smoothing length to "length" KB

-n "path" Use trickled socket name "path"

-L "ms" Set latency to "ms" milliseconds

-P "path" Preload the specified .so instead of the default one

Thank you for your reading, the above is the content of "Linux installation and use of Trickle for better broadband control". After the study of this article, I believe you have a deeper understanding of the problem of Linux installation and use of Trickle in order to better carry out broadband control, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report