Advance

A Clever Guide to Limiting Bandwidth on Ubuntu and Debian

Limiting Bandwidth on Ubuntu and Debian

When you have a low internet speed or limited bandwidth, traffic limiting becomes even more important. In such situations, multiple applications or users sharing the network connection may lead to congestion and reduced performance for everyone involved. This article will explore two effective methods to limit network bandwidth on Ubuntu and Debian systems. If purchasing a Linux VPS server is your goal, looking into the packages available on the Eldernode website would be advisable.

2 Way to Limit Network Bandwidth on Ubuntu and Debian

In today’s connected world, controlling our network bandwidth usage is crucial for optimizing internet performance and ensuring fair resource allocation. If you are an Ubuntu or Debian user seeking effective ways to limit network bandwidth, this guide will walk you through two clever methods. By employing these techniques, you will be able to prioritize critical tasks, manage network congestion, and enhance your overall browsing experience. Let’s dive in!

Recommended Article: How to check Linux kernel version on VPS

Method 1: Limiting Bandwidth Using Wondershaper

Wondershaper is a handy and open-source command-line utility that allows you to easily limit network bandwidth in Linux. It provides a simple way to configure the download and upload speeds for each network interface on your Linux machine.

Step 1: Install the Wondershaper tool

Wondershaper simplifies bandwidth management on Ubuntu and Debian systems. To install it, use the following command:

sudo apt-get install wondershaper

Step 2: Limit the bandwidth

To limit your bandwidth to 2 Mbps on a chosen interface (e.g., eth0), execute the following command:

sudo wondershaper eth0 2000 2000

Here, 2000 represents the limit for both upstream and downstream, measured in kilobits per second (Kbps). Please alter these values according to your needs.

Step 3: Verify the changes

To verify that the bandwidth control has been applied successfully, use the following command:

sudo wondershaper eth0

It should display the configured limits and other relevant information.

Testing Wondershaper on Ubuntu and Debian

After you know the network interface name, you will be able to test Wondershaper. For example, to set the bandwidth limit to 6 MB/s for download and 1 MB/s for upload on the enp0s3 Ethernet interface, do the following:

sudo wondershaper enp0s3 6144 1024

Now test your Internet speed at Speedtest.net to check if the above settings are applied or not. You should get the following result:

 

Test-Internet-speed

 

You can clear all the limits with the following command:

sudo wondershaper clear enp0s3

If you test your Internet speed after you clear all the limits, you will get the following result:

 

Removed-bandwidth-limits-Speedtest-results

 

Method 2: Using TC (Traffic Control)

Step 1: Check requirements

Before proceeding, ensure that the “tc” and “traffic-control” packages are installed on your Ubuntu or Debian system. If any are missing, use the following command to install them:

sudo apt-get install iproute2

Step 2: Identify the network interface

To limit the bandwidth, we first need to identify the network interface that needs adjustment. Execute the following command to list your network interfaces:

ifconfig

Identify the relevant interface (e.g., eth0) for TC configuration.

Step 3: Limit the bandwidth

To limit the bandwidth of your chosen interface (for illustration purposes, let’s assume it’s eth0) to 1 Mbps, execute the following command:

sudo tc qdisc add dev eth0 root tbf rate 1mbit burst 10kb latency 70ms

Feel free to adjust the values (rate, burst, latency) according to your requirements. The “rate” and “burst” values control the maximum allowed bandwidth, while “latency” defines the simulated network delay.

Step 4: Verify the changes

To ensure that the bandwidth limit has been successfully applied, execute the following command:

$ sudo tc -s -d qdisc show dev eth0

You should see the configured values and no errors.

 

Additional Tips:

  • To remove bandwidth limitations, use the following command (dependent on the method used):
  • For TC: `sudo tc qdisc del dev eth0 root`
  • For Wondershaper: `sudo wondershaper clear eth0`
  • Experiment and fine-tune the parameters to suit your specific needs.
  • Utilize tools like Network Analyzer to monitor and analyze your network.

 

Recommended Article: How to Install Lamp on Ubuntu 20.04 LTS [Complete]

Conclusion

Controlling network bandwidth on your Ubuntu or Debian system doesn’t have to be a complex task. By using these clever methods of either employing TC or harnessing the power of Wondershaper, you can effectively limit your bandwidth and optimize your network usage. Enjoy a smoother browsing experience, prioritize tasks, and manage network congestion with confidence!

View More Posts
Tom Veitch
Eldernode Writer
We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

Leave a Reply

Your email address will not be published. Required fields are marked *

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day