Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 398
  • Last Modified:

packet shaping tc question

Hi everyone, I tried following the tutorial here:

http://www.cyberciti.biz/faq/linux-traffic-shaping-using-tc-to-control-http-traffic/

There's actually several tutorials.  It's the second one that starts with "Example: HTTP Outbound Traffic Shaping"

So here's what happens when I run that.  First off, it seems to work at first!  But after a bit more testing I find out that it's working a bit TOO well.  It seems to be shaping all IP traffic regardless of the iptables marking etc.  I know this because even when I stop iptables, my downloads are STILL throttled.  Anyway my downloads shouldn't be throttled at all regardless because from what I can tell only OUTBOUND traffic should be affected.

I'm VERY green with tc, so I'm sure that there is plenty I'm missing.  I've read through the man pages, and can't seem to find out what I'm missing.  Any assistance would be much appreciated.

-S
0
schnibitz
Asked:
schnibitz
  • 2
1 Solution
 
schnibitzAuthor Commented:
I got it working finally.  You need to specify the iptable stuff first, then the rest.  The "default" portion of TC was causing shaping to occur regardless of port 80 traffic being matched.  Will post final working code tomorrow.
0
 
schnibitzAuthor Commented:
#!/bin/sh
#First delete existing rules for eth0
tc qdisc del dev eth0 root
#delete rules in iptables (dangerous)
iptables -t mangle -F
iptables -t mangle -A OUTPUT -p tcp --dport 80 -j MARK --set-mark 10
tc qdisc add dev eth0 root handle 1: htb
tc class add dev eth0 parent 1: classid 1:1 htb rate 256bps ceil 256bps

tc class add dev eth0 parent 1:1 classid 1:10 htb rate 256bps ceil 256bps prio 0
tc filter add dev eth0 parent 1:0 prio 1 protocol ip handle 10 fw flowid 1:10

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now