rogerdv |
03-20-2009 07:03 AM |
traffic shaping with htb.init
Im trying to setup some basic bandwidth control for my connection to avoid mostly upload saturation due to outgoing mail. I have a 128Kbps line, shared among several users, behind a firewall. Web browsing is done via proxy. I have the following line to redirect http requests to port 3128:
Code:
iptables -t nat -A PREROUTING -s $INT_NET -d ! $INT_NET -i $INT_IF -p tcp --dport 80 -j REDIRECT --to-port 3128
Also I have the following lines:
Code:
# In the NAT table (-t nat), Append a rule (-A) after routing
# (POSTROUTING) for all packets going out eth1 (-o eth1) which says to
# SNAT the connection.
$IPTABLES -t nat -A POSTROUTING -o $EXT_IF -s $INT_NET -j SNAT --to $EXT_IP
#Mangle OUTPUT
# 16 Minimize delay
# 8 Maximize throughput
$IPTABLES -t mangle -A OUTPUT -o $EXT_IF -p tcp --dport 21 -j TOS --set-tos 16
$IPTABLES -t mangle -A OUTPUT -o $EXT_IF -p tcp --dport 80 -j TOS --set-tos 8
$IPTABLES -t mangle -A OUTPUT -o $EXT_IF -p tcp --dport 53 -j TOS --set-tos 16
$IPTABLES -t mangle -A OUTPUT -o $EXT_IF -p udp --dport 53 -j TOS --set-tos 16
#Mangle PREROUTING
# 16 Minimize delay
# 8 Maximize throughput
$IPTABLES -t mangle -A PREROUTING -i $EXT_IF -p tcp --dport 21 -j TOS --set-tos 16
$IPTABLES -t mangle -A PREROUTING -i $EXT_IF -p tcp --dport 80 -j TOS --set-tos 8
$IPTABLES -t mangle -A PREROUTING -i $EXT_IF -p tcp --dport 53 -j TOS --set-tos 16
$IPTABLES -t mangle -A PREROUTING -i $EXT_IF -p udp --dport 53 -j TOS --set-tos 16
My htb.init ocnfig is the following:
Code:
file eth2
DEFAULT=100
R2Q=100
file eth2-2.root
DEFAULT=100
R2Q=100
file eth2-2:10.www
# www
RATE=100Kbits
CEIL=128Kbits
LEAF=sfq
RULE=*:80
RULE=*:8000
PRIO=1
file eth2-2:20.torrent
# www
RATE=64Kbits
CEIL=108Kbits
LEAF=sfq
RULE=*:6889
RULE=*:6888
PRIO=2
eth2-2:40.smtp
# outgoing mail
RATE=24Kbits
CEIL=33Kbits
LEAF=sfq
RULE=*:25
PRIO=4
file eth2-2:100.default
# default
RATE=16Kbits
CEIL=24Kbits
LEAF=sfq
PRIO=30
But basically this doesnt helps in the main problem: web browsing is terribly slow, loading some pages takes 1-2 minutes and downloading a couple of megabytes takes up to 6 hours. The torrent download is working fine, but even if I close it when rate reach 7-8Kb, http traffic does not improves at all, so where did that 7-8Kb went?
an somebody see some error in my configuration?
Im using Gentoo Linux 2007.0 with kernel 2.6.26.
|