How to Limit Traffic with WonderShaper on CentOS 6

Last Updated: Thu, Jan 5, 2017
CentOS Linux Guides Networking
Archived content

This article is outdated and may not work correctly for current operating systems or software.

Introduction

In this tutorial, we'll be installing WonderShaper, a utility used to limit incoming/outgoing traffic. This can be used for a variety of purposes:

  • limiting download speed for a docker container

  • limiting overall speed to prevent abuse

Prerequisites

This tutorial requires you to have a:

  • CentOS 6/7 installation

  • yum

Installation

In order to begin installing WonderShaper, we must first install the epel repository:

yum install epel-release -y

Now, use yum to install WonderShaper:

yum install wondershaper -y

Congratulations! WonderShaper has now been installed. We can now begin to apply rules to eth0, or venet0 if you're on OpenVZ. (Vultr is KVM, and uses eth0 as the default adapter)

Configuring WonderShaper

Basic speed limiting is quite simple. The basic syntax is as follows:

wondershaper (ethernet_adapter) (download_rate_in_kbits) (upload_rate_in_kbits)

Modify the syntax accordingly.

(ethernet_adapter) should be replaced with eth0, since it is the default adapter for Vultr servers.

(download_rate_in_kbits) should be replaced with the download limit in kbit/s (kilobits per second).

(upload_rate_in_kbits) should be replaced with the download limit in kbit/s (kilobits per second).

An example, limiting the speed to 10 mbit/s download, and 15 mbit/s upload would be:

wondershaper eth0 10000 15000

If you want to remove the limit that you set, run the following command (replace eth0 with the ethernet adapter that you imposed the limit on):

wondershaper clear eth0

Conclusion

Congratulations! You have now successfully installed WonderShaper on your Vultr VPS. Like other packages using the yum package manager, removing WonderShaper is easy:

yum remove wondershaper -y

Want to contribute?

You could earn up to $600 by adding new articles.