LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 03-20-2009, 07:03 AM   #1
rogerdv
Member
 
Registered: Jul 2005
Location: Cuba
Distribution: redhat
Posts: 52

Rep: Reputation: 15
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.

Last edited by rogerdv; 03-20-2009 at 07:06 AM. Reason: typing mistake
 
  


Reply

Tags
htb, iptables, shaping, traffic


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems, Traffic shaping with HTB scuba0 Linux - Networking 4 07-31-2008 11:21 AM
Traffic shaping with HTB, several questions exscape Linux - Networking 1 05-28-2008 12:10 PM
traffic shaping with htb zsoltrenyi Linux - Software 2 11-12-2004 09:17 AM
shaping scripts - htb.init ... confusion ? :( mikero Linux - Networking 0 02-17-2004 05:05 AM
traffic shaping htb SchwipSchwap Linux - Networking 1 08-28-2003 03:17 PM


All times are GMT -5. The time now is 03:49 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration