Which Option Helps to Restrict Bandwidth in Cloudlinux

mlopez

Active Member
Dec 17, 2020
29
6
3
iAiOxJi78`
cPanel Access Level
Root Administrator
Hello,
I wanted to know how to limit a CloudLinux package bandwith but Limits documentation isn't really clear, at all. It's information is vage and it doesn't specify how to apply it for packages.
I'd like to have some examples, say:
"To restrict package1 to a maximum of 512 Mbps you need to run this command: xxxx"

Can anyone explain a this matter little further?

Best regards,
 

cPDavidL

Linux Analyst II
Staff member
Oct 15, 2012
79
17
133
cPanel Access Level
Root Administrator
Hello @mlopez

To clarify, CloudLinux does not actually limit bandwidth for a given LVE. bandwidth tracking is done at the LVE level, and thus configured there. However, one must use the TC application provided by iproute2.

As described in the CloudLinux documentation at Limits

Example:

  1. As an example we create class with HTB qdiscs and rate 100mbit and class 1:10 will be used by default:
Code:
tc qdisc add dev eth3 root handle 1: htb default 10
tc class add dev eth3 parent 1: classid 1:1 htb rate 100mbit

  1. For class 1:1 we create two branches with rate 5 mbit and 10 kbit accordingly, with classid 1:10 and 1:20.
Code:
tc class add dev eth3 parent 1:1 classid 1:10 htb rate 5mbit
tc class add dev eth3 parent 1:1 classid 1:20 htb rate 10kbit

  1. All packets marked with LVE id=2121 are processed by 10 kbit class.
Code:
tc filter add dev eth3 protocol ip parent 1: prio 1 handle 2121 fw flowid 1:20

To summarize, the system administrator must create a tc class(identified as 1:1 above), then branch it, and then set TC to filter traffic if it exceeds the rules put forth in a specific branch.
 

mlopez

Active Member
Dec 17, 2020
29
6
3
iAiOxJi78`
cPanel Access Level
Root Administrator
Hi @cPDavidL,

Thank you for your explanation. Now what's really clear to me is I need to learn a lot about TC and networking before using this.
I don't know what HTB, qdiscs, 1:10 or fw are :eek:

Regards!