0

I want to limit bandwidth for interface eth1, I read command in this link.

sudo tc qdisc add dev eth1 root handle 1:0 htb default 10
sudo tc class add dev eth1 parent 1:0 classid 1:10 htb rate 200kbps ceil 200kbps

It works well (download speed ~ 200 kb/s). When I add 1 command I think download speed will be ~ 170 kb/s but it's not (download speed ~ 500 kb/s).

sudo tc qdisc add dev eth1 root handle 1:0 htb default 10
sudo tc class add dev eth1 parent 1:0 classid 1:10 htb rate 200kbps ceil 200kbps
sudo tc class add dev eth1 parent 1:10 classid 1:100 htb rate 170kbps ceil 170kbps

Can anyone help me? Thank you very much!

1 Answers1

-1

You are specifying two classes/speeds. Is that what you wanted? You don't explain why you set such values. You need iptables rules to go along with those rules but make no mention of such.

http://www.cyberciti.biz/faq/linux-traffic-shaping-using-tc-to-control-http-traffic/

Define a class with limitations i.e. set the allowed bandwidth to 512 >Kilobytes and burst bandwidth to 640 Kilobytes for port 80:

# /sbin/tc class add dev eth1 parent 1:0 classid 1:10 htb rate 512kbps ceil 640kbps prio 0

Please note that port 80 is NOT defined anywhere in above class. You will >use iptables mangle rule as follows:

# /sbin/iptables -A OUTPUT -t mangle -p tcp --sport 80 -j MARK --set-mark 10
Ryan Babchishin
  • 6,260
  • 2
  • 17
  • 37
  • The values isn't important becasue I just want to test (to understand the tc command). I create a child class (id 1:10) of root eth1, then I create a child class(id 1:100) of classid 1:10. I think class 1:100 will be applied with all traffic through eth1. But it's not. – You're awesome Sep 26 '16 at 13:48