packet shaping tc question

Posted on 2011-04-28
Last Modified: 2012-05-11
Hi everyone, I tried following the tutorial here:

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.

Question by:schnibitz

    Author Comment

    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.

    Accepted Solution

    #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


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
    Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now