How to Limit Traffic with WonderShaper on CentOS 6
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
This tutorial requires you to have a:
- CentOS 6/7 installation
In order to begin installing WonderShaper, we must first install the
yum install epel-release -y
yum to install WonderShaper:
yum install wondershaper -y
Congratulations! WonderShaper has now been installed. We can now begin to apply rules to
venet0 if you're on OpenVZ. (Vultr is KVM, and uses
eth0 as the default adapter)
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
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