magnific0 / wondershaper

Command-line utility for limiting an adapter's bandwidth
GNU General Public License v2.0
1.71k stars 256 forks source link

Wondershaper interferes with tc qdisc rules #56

Open Raycoms opened 3 years ago

Raycoms commented 3 years ago

I was attemtping to use wondershaper to reduce the bandwidth to 100mb/s and tc qdisc rules to add 20/100ms of latency.

However, it appears the two things are incompatible. The set rule:

sudo tc qdisc add dev enp5s0f0 root netem delay 20ms 

Disappears after starting wondershaper with?

sudo wondershaper enp5s0f0 102400 102400

And after starting wondershaper, attempting to add the rule will trigger:

Error: Exclusivity flag on, cannot modify.
magnific0 commented 3 years ago

I am not surprised, as wondershaper uses tc behind the scenes. It also quite indiscriminately clears current rules. So it definitely does not play nice with other setups that use tc. This is a bug and should be fixed.

However, not many people use custom rules and/or want delays, so my advice would be to make it work for yourself. See where in the script you might combine your delay rule with the rule from wondershaper. For instance https://github.com/magnific0/wondershaper/blob/master/wondershaper#L249

Let us know your results!

magnific0 commented 3 years ago

Oh I forgot there's a related issue #29, you should chime in if you have any results!

Raycoms commented 3 years ago

I ended up using plane netem sudo tc qdisc add dev enp5s0f0 root netem delay 20ms limit 400000 rate 100mbit which solved it for me (found that out after digging around for weeks). Since wondershaper uses tc behind the scenes, latency could potentially become an optional parameter.

magnific0 commented 3 years ago

@Raycoms , thanks for sharing. This combined latency and rate rule shoud be straight-forward to add to wondershaper. Still need some time for testing. Glad to hear the plane approach is working for your!