Linux – Limiting network throughput of an already launched process ? (Linux/FreeBSD)

bandwidthbandwidth-controlbsdlinuxprocess

Is there any utility to limit the network throughput of a process after it has been launched? Simple example: you note that a user takes all your upload bandwidth using scp and you'd like to limit the rate or decrease the priority of the transfer.

I guess i could use a combination of iptables/tc or pf to achieve that, but i was wondering if there is a "one-shot" tool available (like trickle with a –pid option ^^) ?

Best Answer

Unfortunately there is no such a solution for FreeBSD. There are many solutions like dummynet/ipfw or altq/pf which are used to limit network usage based on different patterns but not on pids.

On linux there is a way to limit network usage on a user basis:

iptables -t mangle -A OUTPUT -p tcp -m owner --uid-owner test -j MARK --set-mark 1

I think there is no solution to limit the network utilization based on pid.