There is a simple configuration:
set qos interface eth0 egress 'test' set qos policy shaper test bandwidth '330mbit' set qos policy shaper test default bandwidth '300mbit' set qos policy shaper test default queue-type 'fair-queue'
The debug of commit:
vyos@r14# commit [ qos ] DEBUG/QoS: tc qdisc replace dev eth0 root handle 1: htb r2q 206 default 1 DEBUG/QoS: tc class replace dev eth0 parent 1: classid 1:1 htb rate 330000000 DEBUG/QoS: tc class replace dev eth0 parent 1:1 classid 1:1 htb rate 300000000 burst 15k quantum 1514 prio 20 DEBUG/QoS: tc qdisc replace dev eth0 parent 1:1 sfq {'bandwidth': '330mbit', 'default': {'bandwidth': '300mbit', 'burst': '15k', 'codel_quantum': '1514', 'flows': '1024', 'interval': '100', 'priority': '20', 'queue_type': 'fair-queue', 'target': '5'}} DEBUG/QoS: tc filter replace dev eth0 parent 1: prio 255 protocol all basic action police rate 300000000 burst 15k
Expected traffic 300mbit
Get
vyos@r14# sudo iperf3 -c 192.168.122.11 Connecting to host 192.168.122.11, port 5201 [ 5] local 192.168.122.14 port 5992 connected to 192.168.122.11 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 1.75 MBytes 14.7 Mbits/sec 996 74.9 KBytes [ 5] 1.00-2.00 sec 573 KBytes 4.69 Mbits/sec 570 31.1 KBytes [ 5] 2.00-3.00 sec 954 KBytes 7.82 Mbits/sec 565 22.6 KBytes [ 5] 3.00-4.00 sec 700 KBytes 5.73 Mbits/sec 609 117 KBytes [ 5] 4.00-5.00 sec 382 KBytes 3.13 Mbits/sec 403 26.9 KBytes [ 5] 5.00-6.00 sec 382 KBytes 3.13 Mbits/sec 580 45.2 KBytes [ 5] 6.00-7.00 sec 1.30 MBytes 11.0 Mbits/sec 974 35.4 KBytes [ 5] 7.00-8.00 sec 954 KBytes 7.82 Mbits/sec 495 22.6 KBytes [ 5] 8.00-9.00 sec 0.00 Bytes 0.00 bits/sec 487 36.8 KBytes [ 5] 9.00-10.00 sec 954 KBytes 7.82 Mbits/sec 606 28.3 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.00 sec 7.84 MBytes 6.57 Mbits/sec 6285 sender [ 5] 0.00-10.00 sec 6.60 MBytes 5.54 Mbits/sec receiver iperf Done.
Show filter
vyos@r14# sudo tc -s -d filter show dev eth0 filter parent 1: protocol all pref 255 basic chain 0 filter parent 1: protocol all pref 255 basic chain 0 handle 0x1 action order 1: police 0x1 rate 300Mbit burst 15300b mtu 2Kb action reclassify overhead 0b linklayer ethernet ref 1 bind 1 installed 138 sec used 0 sec firstused 138 sec Action statistics: Sent 171713394 bytes 113616 pkt (dropped 0, overlimits 8468 requeues 0) backlog 0b 0p requeues 0
The main issue with this command tc filter
tc filter replace dev eth0 parent 1: prio 255 protocol all basic action police rate 300000000 burst 15k
If we exclude it:
tc qdisc del dev eth0 root tc qdisc replace dev eth0 root handle 1: htb r2q 206 default 1 tc class replace dev eth0 parent 1: classid 1:1 htb rate 330000000 tc class replace dev eth0 parent 1:1 classid 1:1 htb rate 300000000 burst 15k quantum 1514 prio 20 tc qdisc replace dev eth0 parent 1:1 sfq
It shapes correct:
vyos@r14# sudo iperf3 -c 192.168.122.11 Connecting to host 192.168.122.11, port 5201 [ 5] local 192.168.122.14 port 15616 connected to 192.168.122.11 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 35.8 MBytes 300 Mbits/sec 0 184 KBytes [ 5] 1.00-2.00 sec 35.0 MBytes 293 Mbits/sec 0 215 KBytes [ 5] 2.00-3.00 sec 33.9 MBytes 285 Mbits/sec 0 181 KBytes [ 5] 3.00-4.00 sec 33.9 MBytes 285 Mbits/sec 0 181 KBytes [ 5] 4.00-5.00 sec 34.8 MBytes 292 Mbits/sec 0 221 KBytes [ 5] 5.00-6.00 sec 34.1 MBytes 286 Mbits/sec 0 212 KBytes [ 5] 6.00-7.00 sec 33.9 MBytes 285 Mbits/sec 0 221 KBytes [ 5] 7.00-8.00 sec 33.9 MBytes 285 Mbits/sec 0 229 KBytes [ 5] 8.00-9.00 sec 34.7 MBytes 291 Mbits/sec 0 215 KBytes [ 5] 9.00-10.00 sec 33.9 MBytes 285 Mbits/sec 0 5.66 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.00 sec 344 MBytes 289 Mbits/sec 0 sender [ 5] 0.00-10.00 sec 342 MBytes 287 Mbits/sec receiver iperf Done.