I've been working with Ubuntu18.04 and trying to shape the traffic with linux tc. Things went well in the passed few months. Here's my commands:
# init queue
sudo tc qdisc add dev enp2s0 root handle 1:0 tbf rate 20mbit limit 16k burst 10k
sudo tc qdisc add dev enp2s0 parent 1:0 handle 10: netem rate 20mbit
# continuously adjust the traffic using following command with python
sudo tc qdisc add dev enp2s0 parent 1:0 handle 10: netem rate <bandwidth>kbit delay <rtt>ms loss <loss>%
However recent days I noticed that TBF seemed to stop working.
How do I know that
I used iperf3 to test the link:
# receiver, a windows pc
iperf3 -s
# sender, a linux PC performing tc & iperf client
iperf3 -u -c <receiver's ip> -b 1.5M -t 1000
The bandwidth was set to vary around 1M bps.
- I observed a huge lag between the fluctuation of bandwidth set on the sender and throughput observed on the receiver.
- After the sender exited, the receiver could still receive remaining packets in a few seconds. (sum up to around 5~10 Mbit)
- Things went on normally when I tried to iperf with TCP:
iperf3 -c <receiver's ip> -b 1.5M -t 1000
. I think it was because TCP had a scheme to perf the bandwidth and would not produce excessive packets. And it's why I think it was TBF that failed instead of other components.
I've tried
- replacing the network card
- changing iperf client
- replacing the cable
None of the above helped.