I am trying to test Linux HTB, doing the simplest example just to see it actually works.
I am creating a root and giving it 200kbps, then I create 3 classes which each one gets assigned a portion of the 200kbps.
- Root -
/ | \
/ | \
/ | \
/ | \
/ | \
/ | \
100kbps 60kbps 40kbps
What I want to see at the end is that when they run for 60 seconds I get that first class used half of the bandwidth, second one 30% of the bandwidth and the last class used 20% of the bandwidth.
Now comes the setting up for the test.
I created the above tree, and applied the filters.
tc qdisc add dev eno2 root handle 1: htb default 30
tc class add dev eno2 parent 1: classid 1:1 htb rate 200kbps ceil 200kbps
tc class add dev eno2 parent 1:1 classid 1:10 htb rate 100kbps ceil 200kbps
tc class add dev eno2 parent 1:1 classid 1:20 htb rate 60kbps ceil 200kbps
tc class add dev eno2 parent 1:1 classid 1:30 htb rate 40kbps ceil 200kbps
tc filter add dev eno2 protocol ip parent 1:0 prio 1 u32 match ip dport 80 0xffff flowid 1:10
tc filter add dev eno2 protocol ip parent 1:0 prio 1 u32 match ip dport 25 0xffff flowid 1:20
tc filter add dev eno2 protocol ip parent 1:0 prio 1 u32 match ip dport 36 0xffff flowid 1:30
For the testing I used iperf.
I opened 3 terminals for the servers:
sudo iperf -s -p 25 -i 1
sudo iperf -s -p 36 -i 1
sudo iperf -s -p 80 -i 1
Then connected the 3 clients with a parameter of how much time to run (60 seconds).
iperf -c 132.74.120.45 -p 25 -t 60
iperf -c 132.74.120.45 -p 36 -t 60
iperf -c 132.74.120.45 -p 80 -t 60
Results are a bit odd... it seems that each used the same amount of bandwidth regardless of the original allocation ?
Furthermore, I did check the queue discipline is HTB using bmon
command as you can see in the picture below.
What am I doing wrong ?
ifconfig
and saw eno2 with and ip so I used them. I am not an expert in networking. I hope it was a right approach