Learn How To Limit Traffic with WonderShaper on CentOS 6
Table of Contents
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. (IT Web Services 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 IT Web Services 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 IT Web Services VPS. Like other packages using the yum
package manager, removing WonderShaper
is easy:
yum remove wondershaper -y
Need help?
Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!