Welcome to Server Circle. It's a friendly site and all levels of experience are welcome. Be aware that we use cookies for your login.
Server Circle - Ask questions about Servers and get answers from experts.
Beta (0.84 sec)
Bandwidth throttling on Ubuntu

How do I stop SMTP using more than 1Mbit on Ubuntu and making sure that HTTP gets, say, 5Mbit for example ?

Is there an easy way ?

Thanks.
Asked by:
twosongs
920 points
 Report Abuse
 Share Page - Category: Ubuntu Linux - Tags: Bandwidth throttling on Ubuntu
 Enter your response
Please use Pastie.org to paste lengthy code or to fix formatting issues with code
  • Responses in reverse (2)

Take a look at trickle (http://monkey.org/~marius/pages/?page=trickle). It is available in yum and apt-get.

Response by:
nwlinux
0 points
You could use something like:

# limit outbound smtp traffic to 1M

iptables -A OUTPUT -p tcp --dport 25 -m limit --limit 67/sec -j ACCEPT

iptables -A OUTPUT -p tcp --dport 25 -j DROP

# limit outbound http traffic to 5M

iptables -A OUTPUT -p tcp --sport 80 -m limit --limit 333/sec -j ACCEPT

iptables -A OUTPUT -p tcp --sport 80 -j DROP

The top one will restrict the sending of smtp mail to 1Mbit/s and http replies to 5Mbit.

The limit is packets per second, the above is based on a network interface with an MTU of 1500.

If you're wanting to limit inbound too you'll want to add these rules to the INPUT chain too.

For each pair of rules, the first one will match and accept until the --limit is reached, above that the packets will be dropped which will cause retransmission.

Source: http://moze.koze.net/?p=46

Response by:
_SteveWilson ...
4290 points


  • Related Questions
About Us : Contact Us : Etiquette : Terms : CDN Failover : ShorterURL : CDN Fallback : © 2013 Server Circle