* [LARTC] Simple traffic shaping
@ 2005-07-11 17:41 Barbara M.
2005-07-11 17:47 ` ICI Support
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Barbara M. @ 2005-07-11 17:41 UTC (permalink / raw)
To: lartc
My needs is limiting the outbound traffic of an smtp mail server.
It is connected to a gateway via 100Mbit ethernet. I want limits its
outbound traffic to max 3 Mbit.
I have read lot of docs and tried various script without great results.
Any simplest solutions?
TIA.
Regards, B.
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [LARTC] Simple traffic shaping
2005-07-11 17:41 [LARTC] Simple traffic shaping Barbara M.
@ 2005-07-11 17:47 ` ICI Support
2005-07-11 22:45 ` Barbara M.
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: ICI Support @ 2005-07-11 17:47 UTC (permalink / raw)
To: lartc
http://members.cox.net/laitcg/slack1.html
Go to the bottom about throttling the bandwidth of a single host.
If you just want the daemon itself to be throttled (IE, just the mail
traffic) someone else with a bigger clue than me will have to help you.
-Michael
> -----Original Message-----
> From: lartc-bounces@mailman.ds9a.nl [mailto:lartc-bounces@mailman.ds9a.nl]
> On Behalf Of Barbara M.
> Sent: Monday, July 11, 2005 1:41 PM
> To: lartc@mailman.ds9a.nl
> Subject: [LARTC] Simple traffic shaping
>
>
> My needs is limiting the outbound traffic of an smtp mail server.
> It is connected to a gateway via 100Mbit ethernet. I want limits its
> outbound traffic to max 3 Mbit.
>
> I have read lot of docs and tried various script without great results.
>
> Any simplest solutions?
>
> TIA.
> Regards, B.
>
>
>
> _______________________________________________
> LARTC mailing list
> LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [LARTC] Simple traffic shaping
2005-07-11 17:41 [LARTC] Simple traffic shaping Barbara M.
2005-07-11 17:47 ` ICI Support
@ 2005-07-11 22:45 ` Barbara M.
2005-07-12 0:53 ` nix4me
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Barbara M. @ 2005-07-11 22:45 UTC (permalink / raw)
To: lartc
On Mon, 11 Jul 2005, ICI Support wrote:
> http://members.cox.net/laitcg/slack1.html
>
> Go to the bottom about throttling the bandwidth of a single host.
>
> If you just want the daemon itself to be throttled (IE, just the mail
> traffic) someone else with a bigger clue than me will have to help you.
>
> -Michael
Thanks for replay. As you suggested I tried to modify the script for my
needs. I finally have this:
--------------------------------------------------------
#!/bin/bash
# Slow down one ip address on internal network
# If you changed anything and want to reload the script, execute
# /etc/rc.d/rc.throttle stop
# to clean up your existing configuration.
# Place IP address to be throttled in TIP
TIP="192.168.1.25"
# Place device to internal network here
DEV="eth0"
if [ "$1" = "stop" ]; then
echo "Removing Throttle"
tc qdisc del dev $DEV root
else # assume $1 = start:
echo "Throttling $TIP"
tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth 100mbit
tc class add dev $DEV parent 1: classid 1:1 cbq rate 2512kbit allot
1500 prio 5 bounded isolated
tc filter add dev $DEV parent 1: protocol ip prio 16 u32 match ip src
$TIP flowid 1:1
tc qdisc add dev $DEV parent 1:1 sfq perturb 10
fi
--------------------------------------------------------
Have done some test using scp from other internal box.
Before starting the tc rules I have UP/DL to the smtp server at 8-10MB/s
After activation of rules I have DL to about 270KB/s (as aspected),
UP to 550-600KB. ??? Why UPload is affected?
Any optimization?
TIA, Barbara
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LARTC] Simple traffic shaping
2005-07-11 17:41 [LARTC] Simple traffic shaping Barbara M.
2005-07-11 17:47 ` ICI Support
2005-07-11 22:45 ` Barbara M.
@ 2005-07-12 0:53 ` nix4me
2005-07-12 3:25 ` gypsy
2005-07-12 11:59 ` Barbara M.
4 siblings, 0 replies; 6+ messages in thread
From: nix4me @ 2005-07-12 0:53 UTC (permalink / raw)
To: lartc
Barbara M. wrote:
>
> My needs is limiting the outbound traffic of an smtp mail server.
> It is connected to a gateway via 100Mbit ethernet. I want limits its
> outbound traffic to max 3 Mbit.
>
> I have read lot of docs and tried various script without great results.
>
> Any simplest solutions?
>
> TIA.
> Regards, B.
>
>
>
> _______________________________________________
> LARTC mailing list
> LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
>
You should be able to mark all the smtp packets with iptables and then
shape them with tc. There are examples of marking and the shaping
commands in the docs.
For reference, this is how i mark and shape ftp traffic. You will need
something similar. I mark ftp traffic by port and then shape.
iptables -t mangle -N MYSHAPER-OUT
iptables -t mangle -I OUTPUT -o eth0 -j MYSHAPER-OUT
iptables -t mangle -A MYSHAPER-OUT -m mark --mark 0 -j MARK --set-mark 20
iptables -t mangle -A MYSHAPER-OUT -p tcp --sport 59999 -j MARK
--set-mark 26
iptables -t mangle -A MYSHAPER-OUT -p tcp --sport 50000:51000 -j MARK
--set-mark 26
iptables -t mangle -A MYSHAPER-OUT -p tcp -m length --length :64 -j MARK
--set-mark 20
# clear it
tc qdisc del dev eth0 root
#add the root qdisk
tc qdisc add dev eth0 root handle 1: htb default 20
#add main rate limit class
tc class add dev eth0 parent 1: classid 1:1 htb rate 100mbit
#add leaf classes
tc class add dev eth0 parent 1:1 classid 1:26 htb rate 40kbps
tc class add dev eth0 parent 1:1 classid 1:20 htb rate 100mbit
#filter traffic into classes
tc filter add dev eth0 parent 1:0 prio 0 protocol ip handle 20 fw
flowid 1:20
tc filter add dev eth0 parent 1:0 prio 0 protocol ip handle 26 fw
flowid 1:26
Mark
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LARTC] Simple traffic shaping
2005-07-11 17:41 [LARTC] Simple traffic shaping Barbara M.
` (2 preceding siblings ...)
2005-07-12 0:53 ` nix4me
@ 2005-07-12 3:25 ` gypsy
2005-07-12 11:59 ` Barbara M.
4 siblings, 0 replies; 6+ messages in thread
From: gypsy @ 2005-07-12 3:25 UTC (permalink / raw)
To: lartc
"Barbara M." wrote:
>
> My needs is limiting the outbound traffic of an smtp mail server.
> It is connected to a gateway via 100Mbit ethernet. I want limits its
> outbound traffic to max 3 Mbit.
>
> I have read lot of docs and tried various script without great results.
>
> Any simplest solutions?
>
> TIA.
> Regards, B.
HTB:
tc qdisc add dev $DEV root handle 1: htb default 20
tc class add dev $DEV parent 1: classid 1:1 htb rate 3000kbit burst 6k
tc class add dev $DEV parent 1:1 classid 1:20 htb rate 3000kbit \
burst 6k quantum 1500 prio 1
tc filter add dev $DEV parent 1: protocol ip prio 5 u32 \
match ip sport 25 0xffff flowid 1:20
TRICKLE:
http://monkey.org/~marius/trickle
But I doubt the above will suit you because you don't tell us anything else
about the traffic on your mail server.
--
gypsy
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LARTC] Simple traffic shaping
2005-07-11 17:41 [LARTC] Simple traffic shaping Barbara M.
` (3 preceding siblings ...)
2005-07-12 3:25 ` gypsy
@ 2005-07-12 11:59 ` Barbara M.
4 siblings, 0 replies; 6+ messages in thread
From: Barbara M. @ 2005-07-12 11:59 UTC (permalink / raw)
To: lartc
On Mon, 11 Jul 2005, gypsy wrote:
>> My needs is limiting the outbound traffic of an smtp mail server.
>> It is connected to a gateway via 100Mbit ethernet. I want limits its
>> outbound traffic to max 3 Mbit.
> HTB:
> tc qdisc add dev $DEV root handle 1: htb default 20
Create the root and set the default for traffic to filter/class "20".
Needed (filter/class "20")?
> tc class add dev $DEV parent 1: classid 1:1 htb rate 3000kbit burst 6k
Create the class 1:1, set maximum rate to 3mbit. Can be useful increase
the 6k burst?
> tc class add dev $DEV parent 1:1 classid 1:20 htb rate 3000kbit \
> burst 6k quantum 1500 prio 1
??? what do the "quantum 1500" part?
> tc filter add dev $DEV parent 1: protocol ip prio 5 u32 \
> match ip sport 25 0xffff flowid 1:20
Create a filter for smtp traffic?
Why "sport 25"?
I am interested in outgoing traffic.
This box receive the outgoing mails from other internal servers and
do the delivery. No other activity/traff.
So can be useful that it receive traffic from local server at full speed,
but delivery it at limited rate (the problem is mailing list users that
sometime distribuite big mail (0.5-2 MB) to 1.000-3.000 subscribers
causing peak that ... :-(
Really I am thinking to use it to shape the total traffic from a server
with no differentiation on services (so I can use it in mail or httpd
server ...).
Regards, B.
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-07-12 11:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-11 17:41 [LARTC] Simple traffic shaping Barbara M.
2005-07-11 17:47 ` ICI Support
2005-07-11 22:45 ` Barbara M.
2005-07-12 0:53 ` nix4me
2005-07-12 3:25 ` gypsy
2005-07-12 11:59 ` Barbara M.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.