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.
Table of Contents
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!
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:
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:
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:
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.
- 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.
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!