1. Introduction
kbps means kilobytes and kbit means kilobits
100 kbps = 800kbit = 800000bit
2. Link Sharing
The definition of a root class is one with the htb qdisc as its parent. A root class, like other classes under an htb qdisc
allows its children to borrow from each other, but one root class cannot borrow from another.
root class (qdisc as its parent)间不能互借带宽
Example
#!/bin/bash
tc qdisc del dev eth4 root handle 1:
tc qdisc add dev eth4 root handle 1: htb default 1
tc class add dev eth4 parent 1: classid 1:1 htb rate 10Mbit ceil 10Mbit
tc qdisc add dev eth4 parent 1:1 handle 2: htb default 3
tc class add dev eth4 parent 2: classid 2:1 htb rate 8000kbit ceil 8000kbit
tc class add dev eth4 parent 2: classid 2:2 htb rate 1000kbit ceil 10Mbit
tc class add dev eth4 parent 2: classid 2:3 htb rate 1000kbit ceil 10Mbit
tc filter add dev eth4 protocol ip parent 2: prio 1 u32 match ip dport 10001 0xffff flowid 2:1
tc filter add dev eth4 protocol ip parent 2: prio 1 u32 match ip dport 10002 0xffff flowid 2:2
HTB 1:1 is used to shaping the whole outging bandwidth.
HTB 2:1, 2:2, 2:3 are root class, so they can not borrow bandwith from each other.
Use Iperf to simulate the traffic, Flow 1&2&3 are all 10Mbit/s
First you will see Flow 1, 2, 3 are about 8Mbit/s, 1Mbit/s, 1Mbit/s
Then disable Flow1, Flow 2, 3 remains the same, and they could not borrow the excessive bandwith from Flow1
Conclusion: root class (qdisc as its parent)间不能互借带宽