16

I have a need to throttle the bandwidth usage, similar to how some ISPs do it, so that after a couple of seconds, it throttles down the speed.

Zoredache
  • 128,755
  • 40
  • 271
  • 413
Glen Solsberry
  • 1,506
  • 5
  • 28
  • 35

3 Answers3

19

What you're looking for is called Traffic Shaping. The best source of information for it (that I know of) is Linux Advanced Routing and Traffic Control. It's a little bit dated, but still has a ton of good information. If you google for Linux Traffic Shaping, you can find some scripts and tools to make the traffic shaping configuration a little bit easier.

The specific commands you will use, unless you find a tool or script to do the work for you, are tc and/or tcng. I also want to warn you that traffic shaping can get very complicated if you haven't done it before, particularly if you're trying to do it by hand.

Additionally, also remember that you can only reliably control the speed of data that you are sending out.

You might also want to check out these similar serverfault questions:

Christopher Cashell
  • 8,999
  • 2
  • 31
  • 43
  • I should have mentioned it in my original answer, but another common term for this (although it includes a little more) is QoS (Quality of Service). It's another good term to watch for when trying to manage traffic. – Christopher Cashell Aug 29 '12 at 21:53
0

We use tc.bash (link) for traffic control, in combination with IPTables. Its done the trick for everything we've needed it for so far.

(Tested on CentOS 4 and 5, and should work with any flavor of linux with tc and iptables.)

grufftech
  • 6,620
  • 4
  • 35
  • 37
0

For Ubuntu, try wondershaper.

http://ubuntu-snippets.blogspot.com/2008/07/easy-network-traffic-shaping-on-your.html

Edward van Kuik
  • 226
  • 2
  • 6