Skip to content
Related Articles

Related Articles

Improve Article

Linux – Limit Network Bandwidth Using WonderShaper Tool

  • Last Updated : 11 Feb, 2021

So here in this article, we are going to see how to limit a network bandwidth in Linux using WonderShaper. It is a tool which is a small bash script that enables us to limit the network bandwidth in Linux. It works as the tc command-line program as the backend for configuring traffic control in systems. 

Here this tool allows us to set the maximum download rate and maximum upload rate. Even we can clear the limits that we have for downloading and uploading and even display the current status of the interface from the command line.

Installation:

Step 1: Let’s install WonderShaper in Linux:

sudo apt install wondershaper 

install wondershaper

Now we can install WonderShaper with a different method. By using this method we can have the latest updates of WonderShaper.



So before proceeding to this we need to have git (Git is a distributed version control system for tracking changes in any set of files) installed.

sudo apt install git  

Step 2: First Navigate to the bin directory using the cd command in terminal

cd /bin

Step 3: Next using the below command download the latest version 

git clone https://github.com/magnific0/wondershaper.git

installing wondershaper

Step 4: Now we want to WonderShaper directory and install it using the below one.

cd wondershaper 
sudo make install 

installing wondershaper

So now installation and setup is done for WonderShapper 

Enable and start the service:

Now we will Enable and start the WonderShaper service. Next, we have to enable the service to allow it to start every time we automatically when the system boots. WonderShaper can run as a service like the other is Linux systems.



Now we have to enable and start the service in our system: 

sudo systemctl enable wondershaper.service 

Enable and start the service in wondershaper

sudo systemctl start wondershaper.service

Enable and start the service in wondershaper

Even we can verify if the WonderShaper service is active. Using the following below command 

sudo systemctl status wondershaper.service

Enable and start the service in wondershaper

If we want to stop the service we can use the below command

sudo systemctl stop wondershaper.service

We can even restart the service if we have any problem with the service using the below command:

sudo systemctl restart wondershaper.service

Now we can see how to use the WonderShapper tool:

Now we want to find the interface for which we have to limit the bandwidth. We can find the respective interface name using the following commands:

ifconfig

Now after knowing the interface name on which we want to limit the bandwidth using the below Command:



Syntax: sudo wondershaper -a <interface> -d<rate> -u <rate>

Where:

  • -a: defines interface name
  • -d: defines download rate in kbps
  • -u: defines upload rate in kbps

So for example,

sudo wondershaper -a eth0 -d 2048  -u  512  

Above, set the download rate to 2048 kbps and the upload rate to 512 kbps.

Even we can set both downloads rate and upload rate separately.

Like: sudo wondershaper -a eth0 -d 4096 

The above one will set the download rate to 4096 kbps 

So now to clear or remove the bandwidth limits of an interface we can use the below command. 

sudo wondershaper -c -a eth0

My Personal Notes arrow_drop_up
Recommended Articles
Page :