Although this is an old question, I came across this when looking for an answer to the same question. The OS and interface limits are already addressed in an earlier answer, so here is a way to set up application specific limits. Use an application called trickle. So do sudo apt-get install trickle. You can limit upload/download for a specific app by running
trickle -u (upload limit in KB/s) -d (download limit in KB/s) application
This will launch the application with the specified limits. You can also specify "smoothing" time, so that trickle samples over the desired time period in case your application has bursts of bandwidth consumption and you'd like the bursts to be allowed so long as the average is within your specifications.
Limiting single interface is easy, but global rate limits need more complex rules as do application based rules. I'm not saying that it can't be done, but it requires quite a bit digging in to the internals of the networking.
Here is a quick How to on setting up a per interface limit
If you really want to set up application based rules, you should look in to some firewall framework, like shorewall, which have helper features to configure shaping. Even with these tools, it requires quite bit of forethought and testing to get it in to place. Doing something like this ad-hoc is not yet quite that easy.
Although this is an old question, I came across this when looking for an answer to the same question. The OS and interface limits are already addressed in an earlier answer, so here is a way to set up application specific limits. Use an application called trickle. So do
sudo apt-get install trickle
. You can limit upload/download for a specific app by runningtrickle -u (upload limit in KB/s) -d (download limit in KB/s) application
This will launch the application with the specified limits. You can also specify "smoothing" time, so that trickle samples over the desired time period in case your application has bursts of bandwidth consumption and you'd like the bursts to be allowed so long as the average is within your specifications.
Limiting single interface is easy, but global rate limits need more complex rules as do application based rules. I'm not saying that it can't be done, but it requires quite a bit digging in to the internals of the networking.
Here is a quick How to on setting up a per interface limit
If you really want to set up application based rules, you should look in to some firewall framework, like shorewall, which have helper features to configure shaping. Even with these tools, it requires quite bit of forethought and testing to get it in to place. Doing something like this ad-hoc is not yet quite that easy.
If you want to limit bandwidth for a specific IP address, you can use this: