+3 votes
908 views
How to limit bandwidth in Linux with Wondershaper

in Linux / Unix by (551k points)
reopened | 908 views

1 Answer

+4 votes
Best answer

1. How to install WonderShaper Linux
2. How to detect the Linux network interface
3. How to use WonderShaper on Linux
4. How to run WonderShaper persistently on the Linux system

The use of the network is one of the most important factors in any organization regardless of the type of economic activity since as long as the network provides the necessary accesses and is within the stipulated technical requirements everything will work in synchronized form, both roles and services of the server as the users access to the local and external network . All this forms a set of variables that must be optimized for operation..

At the network level we have many aspects to take into account but one of the most delicate is the bandwidth since this determines the amount of data that can be used in specific applications or sites and also a greater bandwidth will allow more browsing optimal. But it happens in many places that the more bandwidth the more access to unregulated sites is abused, such as movie, music, streaming sites, etc., which consume much of the bandwidth affecting services that really need better speeds. net.

TechnoWikis will explain how to install and use the WonderShaper tool to restrict bandwidth on Linux systems and thus have better control over this..

What is WonderShaper?
WonderShaper has been developed as a script through which each user will have the possibility to limit the bandwidth of one or more network adapters, this restriction will be achieved using the iproute tc command, but with much more advanced and more direct features on this control.

In version 1.3 of WonderShaper, the HTB queue was used instead of CBQ, which allows better bandwidth management on high-speed links greater than 10 MB, then in version 1.4 a method was implemented Improved input configuration and the ability to limit the bandwidth down or up, thereby establishing the maximum download speed and / or the maximum upload speed.

With this utility it will be possible to erase the limits we have set and display the current status of an interface from the command line..


1. How to install WonderShaper Linux


To carry out the installation of this utility we can execute any of the following lines:
 sudo apt install wondershaper (Debian / Ubuntu) sudo yum install wondershaper (CentOS / RHEL) sudo dnf install wondershaper (Fedora) 
image

Alternatively, to extract and install the latest WonderShaper updates, we must clone the WonderShaper GitHub repository into the system, then go to the local repository and install it using the following commands:

 cd bingit clone https://github.com/magnific0/wondershaper.gitcd wondershapersudo make install 
Note
For this we must count the git utility installed in the system.

2. How to detect the Linux network interface


Now, we must know what is the interface or network interfaces in our system, for this we can execute any of the following commands:
 ifconfig ip addr 
image

In this case we see that the interface used is enp0s3.


3. How to use WonderShaper on Linux


Defined this, it is time to use this utility to restrict the use of bandwidth in the system.
Step 1

If we want to define the maximum download speed in Kbps for a particular interface, we must execute the following command with the option -to which defines the interface and -d which defines the speed in Kbps):
 wondershaper -a enp0s3 -d 4048 
We can also define the upload rate using the -u parameter like this
 wondershaper -a enp0s3 -u 1048 
Or, we can apply both options in a single command as follows:
 wondershaper -a enp0s3 -d 4048 -u 1048 
The -s option allows us to see the current status of the selected interface:
 wondershaper -sa enp0s3 
image
Step 2

If we want to clean up and down restrictions we must execute the following:
 wondershaper -ca enp0s3 
image

4. How to run WonderShaper persistently on the Linux system


It is possible to run the WonderShaper utility as a service, where the parameters to configure the bandwidth in a specific configuration file are defined which allows the WonderShaper to start at the time of system startup and limit the use of bandwidth automatically.
Step 1

To achieve this, we must execute the following line with the desired editor to create a new configuration file:
 sudo nano /etc/conf.d/wondershaper 
Step 2

There we will paste the following:
 [wondershaper] # AdapterIFACE = "wlp1s0" # Download rate in KbpsDSPEED = "4048" # Upload rate in KbpsUSPEED = "512" 
image

There we define the rates of both download and upload. We save the changes using the Ctrl + O keys and exit the editor using the Ctrl + X keys.

Step 3

After this we will execute the following lines:
 sudo systemctl start wondershaper (Start the service) sudo systemctl enable wondershaper (Enable the service) sudo systemctl status wondershaper (Check the service status) 
In case of making any changes to the file we can restart the service to apply these changes:
 sudo systemctl restart wondershaper 
If it is required to stop the service we can execute the following:
 sudo systemctl stop wondershaper 
Step 4

The various options for using WonderShaper are:
Display the help
 -h 
Configure the selected adapter
 -a <adapter> 

Set the maximum download speed (in Kbps)
 -d <rate> 

Set the maximum upload speed (in Kbps)
 -u <rate> 

Makes use of the presets in /etc/conf.d/wondershaper.conf
 -p 

Clear adapter limits
 -c 

Shows the current state of the adapter
 -s 

Thanks to this utility it will be possible to manage in a concrete and direct way all the bandwidth in Linux.


by (3.5m points)
edited

Related questions

+3 votes
1 answer
+4 votes
1 answer
asked Nov 1, 2019 in Linux / Unix by backtothefuture (551k points) | 300 views
+5 votes
1 answer
asked Oct 4, 2019 in Linux / Unix by backtothefuture (551k points) | 341 views
+3 votes
1 answer
asked Sep 20, 2019 in WiFi and ADSL by backtothefuture (551k points) | 790 views
+5 votes
1 answer
asked Nov 17, 2019 in Linux / Unix by backtothefuture (551k points) | 462 views
Sponsored articles cost $40 per post. You can contact us via Feedback
10,634 questions
10,766 answers
510 comments
3 users