Controlling network bandwidth in Linux

Default featured post

Sometimes, it happens that you want to limit network bandwidth of a certain computer or even your computer for testing purposes. For example, you can check your socket/network application, client/server application, etc. on different conditions or limited network speed to see how it works.

Linux provides facilities to do this task really easily. This post is about imposing limitation on network in Linux.

At first, you need to install Wondershaper application. In Ubuntu you can install it easily with typing following command in terminal.

$ sudo apt-get install wondershaper

The next step after installing the application is running it. Keep in your mind that you need root permission in order to run Wondershaper. Therefore, running the application should be like below,

$ sudo wondershaper

Interface name is the name of the network device which you want to impose speed limitation on it and obviously down speed and up speed are receiving and sending speed respectively.

For example, we want to impose speed limitation in wireless network card with 512KB download speed and 128KB upload speed, we should set parameters similar to below.

$ sudo wondershaper wlan0 512 128

If you want to limit the speed of wire network, instead you should set interface name parameter like following,

$ sudo wondershaper eth0 512 128

In order to remove/disable the speed limitation use following command with appropriate network name,

$ sudo wondershaper clear

For instance,

$ sudo wondershaper clear wlan0

More information can be found in the man page of Wondershaper and this page.