How do I throttle or limit the rate of the outbound traffic of my Linode?
I want to limit the rate of outbound traffic to 20 Mbps instead of the current maximum rate of 1000 Mbps. Can Linode do this for me? If not, can I do it myself?
Linode can't limit your traffic below the maximum rate of your Linode plan. However, you can accomplish this yourself.
Linux has a powerful built-in tool called
tc (traffic control) that will allow you set rules to limit the rate of outbound traffic from your Linode.
tc is bundled with
iproute — to make sure it’s installed, enter
sudo apt-get install iproute or
sudo apt-get install iproute2.
You may also need to be logged in as root to run
tc, which you can do with the command
su - root.
Once you have
tc installed, you can set a token buffer filter (TBF) to limit outbound traffic to 20 Mbps with the following command:
tc qdisc add dev eth0 root tbf rate 20mbit burst 20kb lat 400.0ms
You can remove the TBF with the following command:
tc qdisc del dev eth0 root
After successfully Installing tc and while limiting outbound traffic to 20MB it got following error on centos 6.
I did some digging around online to see if anyone else had encountered this, and I found a github page that talks about running into an illegal "rate" error. This page is geared toward Ubuntu, but the principles should still apply:
I hope that helps!
@bbigger Your command has the word rate written twice which is why people are getting issues with illegal value for rate.