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@xxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc