bandwith limitation ...

bill davidsen davidsen at
Wed Jun 12 21:06:49 UTC 2002

In article <005b01c20437$429441c0$2a80c13e at lightxp>,
Petar Zivanovic <zpetar at> wrote:
| how or can i limit bandwith from/to some IP or per connection base ...
| 4.emp.
|     we limited out outgoing band. to 512k from news readering server to
| users
|     limitation of 300 user :) ....
|     sometimes there are 100 sometimes 250 users reader/writeing etc...
|     some user have up 56k dial-up ... some have cable,dsl,T1,or even 100Mb/s
|     and when someone over net have T1 ... and he peak_out smaller user...
|     i want to limit to 64k per connection .. or per IP ... :) ...
| can i do it from INN or must i do it from OS ... linux ...

Unless you want to delve into the QOS stuff and advanced netfilter, do
it the easy way and add the code to nnrpd. I did this ages ago and
haven't touched it since, but what I did was relatively simple.

Where nnrpd send the actual data to the user, you just limit the size of
a single transmit and then use msleep to stall the send. I did this back
when file-per-article was the best we had, and I believe I had a routine
called something like write_socket_slowly or such.

So when you have a large message, article or xover, you send N bytes and
then start msleep and sned M bytes in a loop. By making N larger than M
you can adjust how well the system responds to small requests. I dropped
this when CNFS came along, because the memory hit from all the nnrpd
processes drooling data was more than the bandwidth hit, and everyone
had upgraded to 33k6 anyway (does that date it?).

That should give you an idea of what I did and hopefully some thought on
adding similar to you system.

bill davidsen <davidsen at>
  CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.

More information about the inn-workers mailing list