Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

since Teamspeak version 3 sends lots of packets per user and our provider is getting problems with his infrastructure above 20.000 packets per second we have to limit it that our servers are not going to be shut down.

Red a lot about iptables but was not able to find the right rules. Could you give me an advise how to manage that the server is not going to send more than 19k packets per seconds?

We are running on debian 4

Thanks in Advance

share|improve this question

migrated from Apr 10 '10 at 18:59

This question came from our site for professional and enthusiast programmers.

You have a couple of options. iptables and traffic shaping. For iptables, check out the how-to. In the Filtering Specifications section there is an example of using the Limit Extension to limit traffic.

The other option is traffic shaping, which can be (is?) complicated. Take a look at the Linux Advanced Routing & Traffic Control HOWTO for an introduction, in particular chapter 9.

Another option is to tune TeamSpeak. Try changing the codec used to one that is of a lower quality. I believe the TeamSpeak client has bandwidth limiting options. See if the server does too.

share|improve this answer

Thank you for you reply!

I ended up with this iptables code:

/sbin/iptables -A OUTPUT -p udp -m state --state NEW -j ACCEPT
/sbin/iptables -A OUTPUT -p udp -m limit --limit 10000/s -j ACCEPT
/sbin/iptables -A OUTPUT -p udp -j DROP

The maximum packet count in the limit module seems to be 10.000 pps.
Unfortunately to low for my needs.

I am going to check chapter 9 of the Linux HOWTO. Maybe i can handle it with traffic shaping.
If anybody knows another way it could work please let me know it.

share|improve this answer

Here is a solution to this problem.

You can use iptables in such way

sudo iptables -I OUTPUT 1  -m owner --uid-owner debian-tor -j NFQUEUE --queue-num 1
sudo iptables -A OUTPUT                                    -j NFQUEUE --queue-num 0

This will redirect all tor traffic to queue number 1, and all other traffic to queue number 0.

Next step is to write a user-space app, which will read out packets from queues and issue verdicts: ACCEPT or DROP.

[Here is an excellent description of how to build such app].(

And here is implementation of this app. The main part of the app is in TScheduler::operator()

TVerdictAction Action;
   if(QueueNum != TorClass) {
      Action = TVerdictAction::Accept;
   } else {
      Action = CurrentRate > d->OverallRate ? TVerdictAction::Drop : TVerdictAction::Accept;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.