I have UFW enabled, so the solution should not interfere with it. It should also work after reboot.
I currently know these commands which limit the data usage of ports:
sudo iptables -I OUTPUT -p tcp --sport 443 -j DROP
sudo iptables -I OUTPUT -p tcp --sport 443 -m quota --quota 50000000000 -j ACCEPT
But I don't know how to persist these without affecting UFW, and I very much prefer a speed rate limit.
Update: It seems I've got to use tc
. If it should work (I'm optimistic), I'll post the solution.
You can use the tool wondershaper to perform that.
This is my network speed before the configuration of wondershaper (I used the tool speedtest-cli to test my network in a terminal) :
And then I limit my speed and perform a new speed test :
This is the command :
wondershaper [interface] [downspeed] [upspeed]
(kb/s).To clear the limit use the command
sudo wondershaper clear <INT>
.Hope this is what your looking for. Sorry for my english.