How to limit network bandwidth on linux

Limiting Network Bandwidth

One of the easiest way to control over the network traffic is via command line tool called “trickle“. It can be limit application bandwidth, upload or download speed, or prioritizing daemons (a computer program that runs as a background process). tickle works on the concept based on “Linux Pre-Loader”. It controls the network using send and receive the data through sockets.

Installing Trickle

To install trickle package, use the following command –$ sudo apt-get install trickle

The sample output should be like this –Reading package lists… Done Building dependency tree Reading state information… Done The following NEW packages will be installed: trickle 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 34.6 kB of archives. After this operation, 158 kB of additional disk space will be used. Get:1 http://in.archive.ubuntu.com/ubuntu/ trusty/universe trickle amd64 1.07-10ubuntu2 [34.6 kB] ……..

Usage of Trickle

When using Trickle, choose the appropriate download and upload speeds to limit applications.

For instance, If you are using Firefox as your browser, then limit its downloading capacity to 25 KB/s, and upload badwidth to 15 KB/s. To use trickle in standalone mode, use the following command –

$ trickle -d 25 -u 15 firefox

The above command will open a custom Firefox launcher with network limitations.

Limiting a Network Interface on Linux

Alternatively, control over the network traffic is by enforcing bandwidth limit on per-interface basis. This is most useful way when sharing upstream internet connection with someone else. Using wondershaper tool, you can enforce bandwidth limit on per-interface basis.

To install wondershaper, use the following command –

$ sudo apt-get install wondershaper

The sample output should be like this –Reading package lists… Done Building dependency tree Reading state information… Done The following NEW packages will be installed: wondershaper 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 15.0 kB of archives. After this operation, 77.8 kB of additional disk space will be used. Get:1 http://in.archive.ubuntu.com/ubuntu/ trusty/universe wondershaper all 1.1a-6 [15.0 kB] ….

Usage of wondershaper

Use the following command to control the Ethernet0 (Number-Zero) in Linux system-$ sudo wondershaper eth0 1000 500

You can remove wondershaper limit using the following command

–$ sudo wondershaper clear eth0

Congratulations! Now, you know “How to limit Network Bandwidth on Linux”. We’ll learn more about these types of commands in our next Linux post. Keep reading!