How to manage bandwidth on Linux with Wondershaper

Limiting bandwidth is an excellent idea if you need to download something but don’t want it to saturate the rest of the network. On Linux, many individual applications you install may have this ability, and that’s great, but it’s much better to set the limit system-wide. There are many different ways to manage bandwidth on Linux, but the most straightforward way is to install the Wondershaper application. The reason? It works in the terminal and will work on both server and desktop operating systems.

Install Wondershaper

The app must be installed before we go over how to use it. Wondershaper is well-known, and as a result, it is available on most popular Linux OS software sources so getting it working is easy.

To start the installation of Wondershaper, you’ll need to start up the terminal window. Get it open by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Then, follow the command-line instructions that correspond with the Linux operating system you are currently running.

Ubuntu

Wondershaper is readily available for installation on Ubuntu Linux via the “Ubuntu Universe” software repository. Sadly, on some releases of Ubuntu (mainly Server,) the repository must be manually enabled.

To enable Ubuntu’s “Universe” software repository, use the repo command in a terminal window below.

sudo add-apt-repository universe

Next, run the update command to finish setting up the software repository.

Debian

Debian 10, as well as 9, and other releases have Wondershaper in their “Debian Main” software repository. To get it working no further configuration is required. Instead, use the apt-get install command below.

sudo apt-get install wondershaper

Arch Linux

Arch Linux is one of the only Linux operating systems not carrying the Wondershaper application in their software sources. Instead, Arch users looking to use it must build it through the AUR.

To build the app through the AUR, open up a terminal and start by installing the Base-devel and Git packages with the Pacman manager.

sudo pacman -S git base-devel

Next, grab the AUR package with the Git tool.

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

Move into the sources folder and install Wondershaper on your Arch PC.

cd wondershaper

makepkg -sri

Fedora

Fedora users can install Wondershaper through the primary Fedora software repositories with ease. To do it, run the following Dnf package manager command below.

sudo dnf install wondershaper -y

OpenSUSE

On OpenSUSE, Wondershaper is well supported on every release, from Leap 15 to 42.3 and Tumbleweed. The app is available on the “OSS All” software repository. To get it working, run the following Zypper command.

sudo zypper install wondershaper

Generic Linux

The source code for Wondershaper is on GitHub and ready for installation. To get it, do the following.

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

cd wondershaper

Run with:

./wondershaper

Set up Wondershaper

Now that the Wondershaper application is done installing on your Linux operating system, you must make use of the Systemd init system so that it will automatically load up the app at boot-up.

Ubuntu/Debian

When you install the Wondershaper application on Ubuntu or Debian, there is no need to deal with Systemd. This is due to the technology of Apt, and how it can automatically set these things up.

Arch/Fedora/SUSE, Etc

On Arch, Fedora, SUSE and others using systemd, you need to start and enable Wondershaper with Systemd manually. To do it, run the following commands.

sudo systemctl enable wondershaper.service

sudo systemctl start wondershaper.service

To disable the Wondershaper application from automatically booting up, make use of the disable command with Systemd.

Manage bandwidth with Wondershaper

Look through the output and figure out what network card is in use. Generally, the one that is in use is one that has a local IPv4 address.

Take the label from the ip addr show command and pipe it into Wondershaper. It should follow the example syntax below. Be sure to write out the download limit after the “d” command-line switch and the upload limit after “c.”

Note: MB stands for megabytes, adapter stands for the label of the device shown in the ip addr command.

sudo wondershaper adapter mb mb

To clear Wondershaper, so that it stops limiting the bandwidth upload and download speed, you can make use of the c command-line switch. For example: