LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 11-27-2008, 03:51 PM   #1
redvivi
LQ Newbie
 
Registered: Aug 2008
Posts: 24

Rep: Reputation: 15
Problem with Traffic Shaping and HTTP Traffic.


Hi !

I have a problem with traffic control on a Debian gateway server using a symmetric line 4kbps shared by 300 computers. Please have a look at the 1:22 class (default htb one). If I put its rate near zero, the HTTP traffic is stopped. However, I designed a filter to lead the http packets to the 1:21 class (colored in red) and if I set a "-j DROP" on this filter, the HTTP traffic is also stopped.

Here comes that question: It seems that my http traffic (egress) is divided between the 1:22 (default class) and 1:21 classes despite of my filter which should redirect ALL the http traffic on the 1:21 class.

Did I miss something ?

Here is my code:

Code:
tc qdisc add dev $DEV root handle 1: htb default 22

tc class add dev $DEV parent 1: classid 1:1 htb rate ${RATEUP}kbit

tc class add dev $DEV parent 1:1 classid 1:20 htb rate $[40*$RATEUP/100]kbit \
	ceil ${RATEUP}kbit prio 0
tc class add dev $DEV parent 1:1 classid 1:21 htb rate $[40*$RATEUP/100]kbit \
	ceil ${RATEUP}kbit prio 1
tc class add dev $DEV parent 1:1 classid 1:22 htb rate $[19*$RATEUP/100]kbit \
	ceil $[20*RATEUP/100]kbit prio 2
tc class add dev $DEV parent 1:1 classid 1:23 htb rate $[1*$RATEUP/100]kbit \
	ceil $[5*RATEUP/100]kbit prio 3

tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
tc qdisc add dev $DEV parent 1:21 handle 21: sfq perturb 10
tc qdisc add dev $DEV parent 1:22 handle 22: sfq perturb 10
tc qdisc add dev $DEV parent 1:23 handle 23: sfq perturb 10

tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 20 fw flowid 1:20
tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 21 fw flowid 1:21
tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 22 fw flowid 1:22
tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 23 fw flowid 1:23


# Table TOSFIX
iptables -t mangle -N tosfix
iptables -t mangle -A tosfix -p tcp -m length --length 0:512 -j RETURN
iptables -t mangle -A tosfix -m limit --limit 2/s --limit-burst 10 -j RETURN
iptables -t mangle -A tosfix -j TOS --set-tos Maximize-Throughput
iptables -t mangle -A tosfix -j RETURN

# Table ACK
iptables -t mangle -N ack
iptables -t mangle -A ack -m tos ! --tos Normal-Service -j RETURN
iptables -t mangle -A ack -p tcp -m length --length 0:128 -j TOS --set-tos Minimize-Delay
iptables -t mangle -A ack -p tcp -m length --length 128: -j TOS --set-tos Maximize-Throughput
iptables -t mangle -A ack -j RETURN

# Is our TOS broken? Fix it for TCP ACK and OpenSSH.

iptables -t mangle -A POSTROUTING -p tcp -m tcp --tcp-flags SYN,RST,ACK ACK -j ack
iptables -t mangle -A POSTROUTING -p tcp -m tos --tos Minimize-Delay -j tosfix


# Match DNS Packets
#iptables -t mangle -I POSTROUTING -o $DEV -p udp --dport 53 -j MARK --set-mark 20
iptables -t mangle -I POSTROUTING -o $DEV -p udp --dport 53 -j DROP
iptables -t mangle -I POSTROUTING -o $DEV -p udp --dport 53 -j RETURN


# Match UDP Packets
iptables -t mangle -A POSTROUTING -o $DEV -p udp -j MARK --set-mark 21

# Here we deal with ACK, SYN, and RST packets

# Match SYN and RST packets
iptables -t mangle -A POSTROUTING -o $DEV -p tcp -m tcp --tcp-flags ! SYN,RST,ACK ACK -j MARK --set-mark 20
iptables -t mangle -A POSTROUTING -o $DEV -p tcp -m tcp --tcp-flags ! SYN,RST,ACK ACK -j RETURN


# Match ACK packets
iptables -t mangle -A POSTROUTING -o $DEV -p tcp -m tcp --tcp-flags SYN,RST,ACK ACK -m length --length :128 -m tos --tos Minimize-Delay -j MARK --set-mark 20
iptables -t mangle -A POSTROUTING -o $DEV -p tcp -m tcp --tcp-flags SYN,RST,ACK ACK -m length --length :128 -m tos --tos Minimize-Delay -j MARK --set-mark 20


# Match packets with TOS Minimize-Delay
iptables -t mangle -A POSTROUTING -o $DEV -p tcp -m tos --tos Minimize-Delay -j MARK --set-mark 20
iptables -t mangle -A POSTROUTING -o $DEV -p tcp -m tos --tos Minimize-Delay -j RETURN

# Flow Selection
iptables -t mangle -A POSTROUTING -o $DEV -p tcp --dport 80 -j MARK --set-mark 21
iptables -t mangle -A POSTROUTING -o $DEV -p tcp --dport 80 -j RETURN
iptables -t mangle -A POSTROUTING -o $DEV -p tcp --dport 443 -j MARK --set-mark 21
iptables -t mangle -A POSTROUTING -o $DEV -p tcp --dport 443 -j RETURN


iptables -t mangle -A POSTROUTING -o $DEV -p tcp -m layer7 --l7proto edonkey -j MARK --set-mark 23
iptables -t mangle -A POSTROUTING -o $DEV -p tcp -m layer7 --l7proto edonkey -j RETURN

iptables -t mangle -A POSTROUTING -o $DEV -p tcp -m layer7 --l7proto bittorrent -j MARK --set-mark 23
iptables -t mangle -A POSTROUTING -o $DEV -p tcp -m layer7 --l7proto bittorrent -j RETURN

iptables -t mangle -A POSTROUTING -o $DEV -p tcp -m layer7 --l7proto imesh -j MARK --set-mark 23
iptables -t mangle -A POSTROUTING -o $DEV -p tcp -m layer7 --l7proto imesh -j RETURN

iptables -t mangle -A POSTROUTING -o $DEV -p tcp -m layer7 --l7proto gnutella -j MARK --set-mark 23
iptables -t mangle -A POSTROUTING -o $DEV -p tcp -m layer7 --l7proto gnutella -j RETURN

iptables -t mangle -A POSTROUTING -o $DEV -p tcp -m layer7 --l7proto fasttrack -j MARK --set-mark 23
iptables -t mangle -A POSTROUTING -o $DEV -p tcp -m layer7 --l7proto fasttrack -j RETURN

exit
Thanks,
RedVivi
 
Old 11-29-2008, 12:23 PM   #2
redvivi
LQ Newbie
 
Registered: Aug 2008
Posts: 24

Original Poster
Rep: Reputation: 15
I made a mistake, it's a 4mbits symmetric line, not a 4k one ;-)

Thanks !
RedVivi
 
  


Reply


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
Traffic Shaping netguy2000 Linux - Networking 1 05-13-2009 07:48 AM
traffic shaping help monohouse Linux - Networking 22 11-06-2008 08:38 AM
Traffic shaping (limiting outgoing bandwidth of all TCP-traffic except FTP/HTTP) ffkodd Linux - Networking 3 10-25-2008 12:09 AM
how to find http traffic and mail traffic alone? basbosco Linux - General 1 06-07-2005 10:29 PM
Problem mldonkey traffic shaping SchwipSchwap Linux - Newbie 0 08-26-2003 03:50 PM


All times are GMT -5. The time now is 05:51 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