How to limit network bandwidth in Linux (2022)

How to limit network bandwidth in Linux (1) There may be cases when you need to limit network bandwidth in Linux. Learn how to limit the network bandwidth in Linux globally and application-specifically with two simple programs: wondershaper and trickle.


  • Why limit network bandwidth?
  • Limiting the bandwidth per network interface with Wondershaper
    • Install Wondershaper
    • Learn the syntax of Wondershaper
    • Find out the network interface name
    • Test Wondershaper
    • Run Wondershaper persistently
  • Limiting the bandwidth per application with trickle
    • Install trickle
    • How to use trickle
    • trickle with rsync
    • Test trickle
    • Apply application-specific limits persistently
    • Create trickle launchers for graphical apps
  • Disable automatic updates
  • Conclusion

Why limit network bandwidth?

There may be multiple reasons why you need to limit network bandwidth in Linux.

One of our subscribers says that the internet data prices are high where he lives, he wants to limit his network bandwidth to reduce the internet spending. As a former Windows user, he used to run Netlimiter for that. Now, he looks for a Netlimiter alternative in Linux.

Traffic limiting is also useful when the internet speed is low. Applications will compete for the traffic, and setting traffic limits on some applications helps to prioritize how the traffic is used.

In another case, a server admin had to limit the outbound traffic, so that the server will not go down due to heavy activity at peak times.

In this article, you will learn how to limit the network bandwidth in Linux globally and application-specifically with two lightweight and user-friendly applications.

Limiting the bandwidth per network interface with Wondershaper

Wondershaper is a simple command-line utility that can limit the network bandwidth in Linux. It can be configured to limit download and upload speed for each network interface of your Linux machine. Let’s have a look.

Install Wondershaper

To install Wondershaper, search for it in your Linux package manager. It is an open-source application that should be available in all Linux distros. This is the installation I recommend. In Ubuntu and other Debian-based distros, you can run this command:

sudo apt install wondershaper

If you want the latest version of Wondershaper, you can install it from GitHub:

git clone wondershapersudo make install

Hopefully, this installation goes without errors for you. It is a less reliable way to install Wondershaper than using the version provided with your distro. I have tested this installation on Ubuntu 20.04.3, it works fine. But if you have problems with the Github version, remove it by running this command from the wondershaper git-cloned directory:

sudo make uninstall

If you decide to keep the GitHub version of Wondershaper, keep in mind that unlike the version included with the distro, it will not update itself when the new version is released. You need to update it manually. You can do it by entering the wondershaper folder, pulling the updates from GitHub, and re-installing:

cd wondershapergit pull sudo make install

If you are a complete Linux newbie, I recommend you learn the basics of the Linux command line.

Learn the syntax of Wondershaper

Depending on the version of wondershaper, it may have a different syntax for configuration. You can check it with the man command:

man wondershaper

It will give you an output similar to this:

How to limit network bandwidth in Linux (2)

It is just a sequence of the interface, download and upload speed limit in my case:

wondershaper [ interface ] [ downlink ] [ uplink ]
(Video) How to limit network bandwidth in Linux

More recent versions require specifying the option names:

wondershaper -a [interface] -d [downlink] -u [uplink]

Find out the network interface name

Now, when you know the syntax of wondershaper, you only need to find out the network interface name to set the limits on it. In most modern Linux systems, you can list the available network interfaces with this command:

ip addr show

However, some older systems may require to run ifconfig from net-tools:

In my system, I only have the Ethernet interface enp0s3:

How to limit network bandwidth in Linux (3)

You may also have the Wi-Fi interface listed as wlan0 or similar.

Test Wondershaper

Knowing the network interface name, we can test wondershaper. For example, let’s set the bandwidth limit to 6 MB/s for download, and 1 MB/s to upload on the Ethernet interface enp0s3:

sudo wondershaper enp0s3 6144 1024

Now, you can check if these settings have been applied by testing your internet speed at This is the results I get with these settings:

How to limit network bandwidth in Linux (4)

If I clear all the limits:

sudo wondershaper clear enp0s3

And test my internet speed again, I get these values:

How to limit network bandwidth in Linux (5)

Note, if you have both the Wi-Fi and Ethernet connections, make sure you set the limit and test the same interface.

Run Wondershaper persistently

The settings we tested above work only until you reboot your Linux system. To apply the limits persistently, you need to create a systemd configuration and service files for Wondershaper.

Open the configuration file:

sudo nano /etc/systemd/wondershaper.conf

And paste the following content with your interface and limit settings:

[wondershaper]# AdapterIFACE="enp0s3"# Download rate in KbpsDSPEED="6144"# Upload rate in KbpsUSPEED="1024"

Then create a service file:

sudo nano /etc/systemd/system/wondershaper.service
(Video) Limit Bandwidth in Linux - Linux Tips

With the following content:

[Unit]Description=Bandwidth shaper/Network rate[Service]Type=oneshotRemainAfterExit=yesEnvironmentFile=/etc/systemd/wondershaper.confExecStart=/usr/sbin/wondershaper $IFACE $DSPEED $USPEEDExecStop=/usr/sbin/wondershaper clear $IFACE[Install]

Note, if your Wondershaper uses option names, you need to edit the ExecStart and ExecStop lines to:

ExecStart=/usr/sbin/wondershaper -a $IFACE -d $DSPEED -u $USPEEDExecStop=/usr/sbin/wondershaper -c -a $IFACE

FYI, if you are not familiar with the nano editor, to save the changes press Ctrl+O and to exit press Ctrl+X.

Now, activate Wondershaper to run persistently:

sudo systemctl enable --now wondershaper.service

The Wondershaper will now limit network bandwidth in your Linux even after you reboot your system.

If you want to disable the persistent run of Wondershaper, execute:

sudo systemctl disable --now wondershaper.service

Limiting the bandwidth per application with trickle

Trickle is a lightweight bandwidth shaper that can be used to set the data limits per application. By using the Unix loader preloading, it adds a new version of the data transferring functionality to an application through sockets and then limits traffic by delaying the sending and receiving of data over a socket. Unlike Wondershaper, trickle does not require root privileges, so you do not need to use sudo when you run it.

Install trickle

Trickle is available in most Linux distributions. In Ubuntu, you install it with this command:

sudo apt install trickle

How to use trickle

You can see all available options and how to use trickle with its help message:

trickle -h

How to limit network bandwidth in Linux (6)

In most cases, you only need to set the download/upload limits and the application name:

trickle -d [ download speed ] -u [ upload speed ] [ application/command ]

Here is an example of 6 MB/s limit for download, and 1 MB/s to upload in Firefox:

trickle -d 6144 -u 1024 firefox

You can also set download and upload rates separately if you want to limit only one of them:

trickle -d 6144 firefox

You can also limit network bandwidth for Linux commands. For example, you may want to limit the wget download speed:

trickle -d 512 wget
(Video) Unix & Linux: How to limit network bandwidth? (6 Solutions!!)

You can also launch bash shell with bandwidth limits for all commands:

trickle -d 6144 -u 1024 bash

To reset the bandwidth limits, simply close the bash with the exit command or Ctrl+Q.

You can also add some advanced settings to your trickle command. You can read the detailed description of each option with the man command:

man trickle

where you can find out, for example, what the smoothing time option does:

The smoothing time determines with what intervals trickle will try to let the application transceive data. Smaller values will result in a more continuous (smooth) session, while larger values may produce bursts in the sending and receiving data. Smaller values (0.1 - 1 s) are ideal for interactive applications, while slightly larger values (1 - 10 s) are better for applications that need a bulk transfer.

trickle with rsync

There is a small difference in using trickle with rsync to copy files over ssh. If you simply put trickle in front of rsync, it will not work because rsync forks the ssh process. Thus, ssh will run without trickle limits. To call rsync with trickle limits, run it like this:

rsync --rsh="trickle -d 6144 -u 1024 ssh" SORCE DESTINATION

Test trickle

We can test trickle similarly as we tested Wondershaper at Let’s set the download limits to Firefox and add a small smoothing value as it is an interactive application:

trickle -d 6144 -u 1024 -t 0.1 firefox

These settings result in the following network speed for me:

How to limit network bandwidth in Linux (7)

You can also test trickle with wget:

trickle -d 512 wget

You will see that the speed is limited to 547KB/s:

How to limit network bandwidth in Linux (8)

Apply application-specific limits persistently

Trickle can also be configured to have permanent network bandwidth limits and these limits can be global e.g. for all applications or application-specific. It is done through the trickled daemon.

See its options with the -h or man:

How to limit network bandwidth in Linux (9)

You can set the default bandwidth limits for all applications launched with trickle:

trickled -d 6144 -u 1024 -s

Now, every application you start with trickle application will have these limits and you do not need to specify the maximum upload and download rates. To keep these options permanent after the reboot, you can add this command to your ~/.bashrc or /etc/profile if you want these settings to be active for all users.

To set how these limits are shared by each application, you need to add them to the trickled.conf file. Open the configuration file:

sudo nano /etc/trickled.conf
(Video) How to manage bandwidth on Linux with Wondershaper

And add each application in the following format:

[service]Priority = <value>Time-Smoothing = <value>Length-Smoothing = <value>

We have looked at the time smoothing parameter above. The purpose of the length smoothing is the same, the only difference is that it is defined in KB. It is a fallback of the smoothing time option.

The priority parameter defines how the traffic is prioritized across applications. A lower value has a higher priority, and thus applications with a lower value get more bandwidth than the one with the higher value.

Here is an example of how a real trickled.conf file may look like:

[www]Priority = 1Time-Smoothing = 1[ssh]Priority = 2Time-Smoothing = 0.1Length-Smoothing = 2[ftp]Priority = 8Time-Smoothing = 5Length-Smoothing = 10

Create trickle launchers for graphical apps

Running trickle application in the terminal may not be the most convenient for graphical applications. Luckily, there is also an option to add trickle to the graphical launchers.

Open the launcher configuration file:

sudo nano /usr/share/applications/application.desktop

For example, to edit the Firefox launcher, create a backup copy and open edit the original file:

sudo cp /usr/share/applications/firefox.desktop /usr/share/applications/firefox.desktop.backupsudo nano /usr/share/applications/firefox.desktop

Find the lines starting with Exec= and edit them by adding trickle to each command. There are three such lines in firefox.desktop:

Exec=trickle -d 6144 -u 1024 firefox %u...Exec=trickle -d 6144 -u 1024 firefox -new-window...Exec=trickle -d 6144 -u 1024 firefox -private-window

How to limit network bandwidth in Linux (10)

Now, every time you click on the launcher in the menu, it will start Firefox with this modified command and limited network bandwidth.

If you want to remove these limits, restore the backup copy:

sudo cp /usr/share/applications/firefox.desktop.backup /usr/share/applications/firefox.desktop

Some applications may not have the application.desktop files in /usr/share/applications/. This is the case for AppImages, snap, and flatpak apps. You can easily create a custom launcher for them by following our tutorial on how to create a custom launcher in Linux.

Disable automatic updates

I would like to share with you just one more tip on how to limit the internet traffic in your Linux. You may want to disable automatic updates in your system, so you update less often and when you have access to the faster and cheaper internet connection.

In Ubuntu, you do that by enabling the “Metered connection”:

Settings -> Network -> Wired/Wi-Fi connection settings -> Details -> enable Metered connection

How to limit network bandwidth in Linux (11)

When you need to update your system, you do it manually in the Update Manager or the command line.


I tried to provide simple and clear instructions on how to limit network bandwidth in Linux with Wondershaper and trickle without technical details. I hope these instructions helped you to configure your Linux bandwidth, and it saved you a couple of backs.

If you want to learn more technical things about trickle, you are welcome to read the trickle technical paper. To get more information on Wondershaper, visit the Wondershaper GitHub page.

There is also an option to use the tc command and iptables configuration for traffic shaping, but this is one of the advanced topics which we do not cover on this website. However, you can get an idea of how tc is configured from the Arch Linux Wiki.

If you know more user-friendly tools that can help to limit network bandwidth in Linux, please share them in the comments below.

(Video) Is there a way to limit bandwidth in Linux? (5 Solutions!!)


How do I restrict network bandwidth? ›

How to limit bandwidth and data usage in Windows 10 or Windows 11
  1. Go to the Start menu search bar, type in 'settings,' and select the best match.
  2. From the settings menu, click on Network & internet.
  3. Now, under the Network & internet tab, click on Data usage.
  4. In the new dialog box, click on Enter the Limit.
11 Apr 2022

How do I see bandwidth usage on Linux? ›

Viewing the Statistics in the Console. We can easily see the bandwidth usage statistics in the console by running the vnstat command. This will display the received, transmitted, total, and estimated traffic for each network interface.

How do I change network settings in Linux? ›

To change your IP address on Linux, use the “ifconfig” command followed by the name of your network interface and the new IP address to be changed on your computer. To assign the subnet mask, you can either add a “netmask” clause followed by the subnet mask or use the CIDR notation directly.

What is limit command in Linux? ›

ulimit is a built-in Linux shell command that allows viewing or limiting system resource amounts that individual users consume. Limiting resource usage is valuable in environments with multiple users and system performance issues. In this tutorial, you will learn to use the ulimit command in Linux with examples.

How do I limit bandwidth applications? ›

The summary is:
  1. Select the network adapter to use in "Network Interfaces"
  2. Add a process definition for the program to throttle.
  3. Add a filterset with a rule for the defined process.
  4. Enable the speed limit traffic shaper for that filterset and apply.
  5. Click "Start/Stop Capture" to enable/disable throttling.

How do I control how much bandwidth each device is using? ›

The most accurate way to monitor the bandwidth used by devices on your network is to head to the router. All devices connect to your router. In the router's settings, you'll be able to work out the data usage information for each device by using their IP and MAC addresses.

What is bandwidth Linux? ›

Bandwidth in computer networking refers to the data rate supported by a network connection or interface. One most commonly expresses bandwidth in terms of bits per second (bps).

What is the command to check bandwidth? ›

Article Content
  1. Download the iperf utility. ...
  2. On the server that will be receiving data, open an elevated command window and run the following command: "iperf.exe –s –w 2m".
  3. On the server that will be sending data, open an elevated command window and run the following command: "iperf –c x.x.x.x –w 2m –t 30s –i 1s".
6 Oct 2021

How can I see network activity in Linux? ›

  1. How to monitor network activity on a Linux system.
  2. netstat -tulpen output.
  3. netstat -atupen output.
  4. sudo netstat -atupen | grep ESTABLISHED output.
12 Sept 2020

How do I manage networks in Linux? ›

Network Management In Linux Explained With Examples
  1. How To Set a Static IP address In Linux.
  2. Set Static IP address by editing the NIC config file.
  3. Set a Static IP address by Using nmcli.
  4. Set a Static IP address by Using nmtui.
  5. Set a Static IP address By Using GUI.
  6. Other Important Network Configuration Files In Linux.
16 Jun 2020

How do I modify my network settings? ›

  1. Open your phone's Settings app.
  2. Tap Network & internet. Internet. If you can't find it, search for the setting you want to change. ...
  3. At the bottom, tap Network preferences.
  4. Tap an option. These vary by phone and Android version. Turn on Wi-Fi automatically: Have Wi-Fi automatically turn on near saved networks.

How do I check limits in Linux? ›

ulimit command :

ulimit -n –> It will display number of open files limit. ulimit -c –> It display the size of core file. umilit -u –> It will display the maximum user process limit for the logged in user. ulimit -f –> It will display the maximum file size that the user can have.

Which command is used to set limit? ›

With the ulimit command, you can change your soft limits for the current shell environment, up to the maximum set by the hard limits. You must have root user authority to change resource hard limits.

How do I limit threads in Linux? ›

You can control the maximum number of threads using the thread-max kernel parameter. “file /proc/sys/kernel/threads-max” defines this parameter. Using the “cat” command, you can view this file. Here, the output 45444 shows the maximum 45444 threads the kernel can execute.

How do I enable bandwidth control? ›

Please log in to the web management interface to setup bandwidth control.
  1. Open the web browser and in the address bar type in the default access like::
  2. Type the username and password in the login page. ...
  3. Click on Bandwidth Control-Control Settings on the left menu.
  4. Click Save to save the Settings.
1 Sept 2022

How do I limit data per device? ›

To set a data usage limit:
  1. Open your phone's Settings app.
  2. Tap Network & internet. Internet.
  3. Next to your carrier, tap Settings .
  4. Tap Data warning & limit.
  5. If it's not already on, turn on Set data limit. Read the on-screen message and tap Ok.
  6. Tap Data limit.
  7. Enter a number. ...
  8. Tap Set.

What are the three types of bandwidth? ›

Types of Bandwidth
  • PUBLIC WIRELESS. Long Term Evolution (LTE) cellular service, also referred to as 4G, and satellite tend to be more expensive than terrestrial services offering similar bandwidth. ...
11 Jul 2018

How do I make Linux less laggy? ›

Ubuntu Running Slow? 8 Tips to Speed Up Your Linux PC
  1. Manage Startup Applications. ...
  2. Enable Proprietary Graphics Drivers. ...
  3. Switch to a Lighter Desktop Environment. ...
  4. Change Swappiness. ...
  5. Clean Out Junk. ...
  6. Removing GRUB Timer. ...
  7. Improve Your Machine's Hardware. ...
  8. Use Preload to Enhance Applications Sourcing.
11 Jan 2022

How can I tell which IP address is using more bandwidth? ›

Navigate to Dashboard | Real-Time Monitor to check which applications are using the most bandwidth. Also navigate to Dashboard | AppFlow Monitor. Click the Initiators tab and select the check box to the IP address to monitor. Select Filter View to only see results for the IP address selected.

How do I check my bandwidth throttling? ›

Internet Speed Test
  1. Go to Ookla's online speed test.
  2. Press Go.
  3. Write down your ping, download speed, and upload speed.
  4. Navigate to your VPN app.
  5. Connect to a server.
  6. Repeat steps one through three. If you are seeing slower speeds on the same websites with the VPN on, then you have been throttled.
14 Jun 2022

How do I know if I have bandwidth? ›

Local network bandwidth tests

Sometimes, it is useful to know about the bandwidth on the local network. This requires a locally installed bandwidth tool or monitoring software. For a simple bandwidth measurement on a single PC, Windows Task Manager can show basic data about your Wi-Fi and ethernet connection.

How do I check local bandwidth? ›

1. LAN Speed Test
  1. Create a 1 MB random test packet file in memory.
  2. Start the Write Timer.
  3. Write the file to the network folder you chose.
  4. Stop the Write Timer.
  5. Clear the Windows File Cache.
  6. Start the Read Timer.
  7. Read the file from the network folder.
  8. Stop the Read Timer.
22 Jul 2010

What is the use of netstat command in Linux? ›

The network statistics ( netstat ) command is a networking tool used for troubleshooting and configuration, that can also serve as a monitoring tool for connections over the network. Both incoming and outgoing connections, routing tables, port listening, and usage statistics are common uses for this command.

How do you set a resource limit in Linux? ›

Following are the steps to set the resource limits:
  1. Check the CPU use limit with $ulimit –t .
  2. To set new limit, open limits.conf with the following command: $sudo nano /etc/security/limits.conf.
  3. Scroll to the end of the file and add following lines: ...
  4. Enter Ctrl + O to save the changes.
  5. Enter Ctrl ...

How do I change hard and soft limits in Linux? ›

To Increase the File Descriptor Limit (Linux)
  1. Display the current hard limit of your machine. ...
  2. Edit the /etc/security/limits.conf and add the lines: * soft nofile 1024 * hard nofile 65535.
  3. Edit the /etc/pam.d/login by adding the line: session required /lib/security/

How do I change my Ulimit settings in Linux? ›

To set or verify the ulimit values on Linux:
  1. Log in as the root user.
  2. Edit the /etc/security/limits.conf file and specify the following values: admin_user_ID soft nofile 32768. admin_user_ID hard nofile 65536. ...
  3. Log in as the admin_user_ID .
  4. Restart the system: esadmin system stopall. esadmin system startall.

How do I set Ulimit to unlimited in Linux? ›

Set the ulimit values on UNIX and Linux operating systems
  1. CPU time (seconds): ulimit -t unlimited.
  2. File size (blocks): ulimit -f unlimited.
  3. Maximum memory size (kbytes): ulimit -m unlimited.
  4. Maximum user processes: ulimit -u unlimited.
  5. Open files: ulimit -n 8192 (minimum value)

Which command is used to set limits? ›

The ulimit command sets or reports user process resource limits. The default limits are defined and applied when a new user is added to the system. Limits are categorized as either soft or hard.

What is in limit conf in Linux? ›

limits. conf is a configuration that is used to limit the resources to the user, groups.

How check hard and soft limits in Linux? ›

Use the following ulimit commands to verify the updated settings:
  1. To verify the updated hard limit, enter the following command: ulimit -aH.
  2. To verify the updated soft limit, enter the following command: ulimit -aS.

How do I limit a user in Linux? ›

Run the following command to make the user localuser 's . bash_profile file as immutable so that root/localuser can't modify it until root removes immutable permission from it. Make file . bash_profile as immutable so that user localuser can't change the environmental paths.

How does Ulimit work in Linux? ›

ulimit is admin access required Linux shell command which is used to see, set, or limit the resource usage of the current user. It is used to return the number of open file descriptors for each process. It is also used to set restrictions on the resources used by a process.

Where can I find Ulimit in Linux? ›

Use the ulimit command with the -a option to see a list of all your user's limits on the system, or just ulimit by itself to see a quick summary. To limit the max number of processes that a user can spawn, use the -u option.

What is default Ulimit in Linux? ›

Maximum size of core files created (kB, -c) 0 Maximum size of a process's data segment (kB, -d) unlimited Maximum size of files created by the shell (kB, -f) unlimited Maximum size that may be locked into memory (kB, -l) unlimited Maximum resident set size (kB, -m) unlimited Maximum number of open file descriptors (-n) ...

Does Linux have a path limit? ›

On Linux: The maximum length for a file name is 255 bytes. The maximum combined length of both the file name and path name is 4096 bytes. This length matches the PATH_MAX that is supported by the operating system.

What does Ulimit unlimited do? ›

To curb programs using massive amounts of stack space, a limit is usually put in place via ulimit -s . If we remove that limit via ulimit -s unlimited , our programs will be able to keep gobbling up RAM for their evergrowing stack until eventually the system runs out of memory entirely.


1. Top 5 Linux network bandwidth monitoring tools
(Penetration Testing in Linux)
2. Take Control of Network Traffic with Evil Limiter [Tutorial]
(Null Byte)
3. How to limit network speed in Linux
(m libre)
4. How to Use the Linux Traffic Control
5. Real-time Bandwidth monitor [Linux Terminal]
(Linux Lad)
6. How Using IPTables to limit number of connections | Linux Tutorials at Networknuts

Top Articles

Latest Posts

Article information

Author: Msgr. Refugio Daniel

Last Updated: 11/01/2022

Views: 6529

Rating: 4.3 / 5 (74 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Msgr. Refugio Daniel

Birthday: 1999-09-15

Address: 8416 Beatty Center, Derekfort, VA 72092-0500

Phone: +6838967160603

Job: Mining Executive

Hobby: Woodworking, Knitting, Fishing, Coffee roasting, Kayaking, Horseback riding, Kite flying

Introduction: My name is Msgr. Refugio Daniel, I am a fine, precious, encouraging, calm, glamorous, vivacious, friendly person who loves writing and wants to share my knowledge and understanding with you.