LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 05-07-2013, 10:06 PM   #1
psycroptic
Member
 
Registered: Aug 2011
Location: USA
Distribution: ArchLinux - 3.0 kernel
Posts: 349

Rep: Reputation: Disabled
something i'm not getting about tc (htb & prio)


I have this startup script running on a linux router, designed to shape traffic that is being downloaded to my LAN from hosts on a 172.16.16.0 subnet. Traffic coming into the LAN is done so through a network adapter called "internal"

Code:
tc qdisc add dev internal root handle 1: htb default 1
tc class add dev internal parent 1: classid 1:1 htb rate 51.03mbit ceil 51.03mbit prio 0
tc class add dev internal parent 1: classid 1:2 htb rate 32.5mbit ceil 32.5mbit prio 1

iptables -t mangle -A POSTROUTING -o internal -d 172.16.16.15 -j CLASSIFY --set-class 1:2
My intention is to first limit all bandwidth to ~50mbps, but then have a single host be limited to ~30mbps total. This works fine.

I now want to set up a prioritization whereby, if traffic is being downloaded to any host OTHER than 172.16.16.15, they will be slowed down less and .15 will take the hit. This is the part that doesn't work. The way i'm testing is to start a download from a random host, and then start one on 172.16.16.15. I would expect that the random host should have little slowdown happen, and .15 would be slowed considerably until traffic has stopped flowing to the random host. But this doesn't seem to happen. Traffic balances out fairly equally, and I can tell no difference between using prio as I am here and not using it at all.

As far as I understand, prio band 0 takes precedence over band 1, and band 1 over band 2, etc. So i would think that, if band 0 has traffic flowing and band 1 starts a transfer, band 0 would maintain its full bandwidth and band 1 would be slowed accordingly.

Or am i missing something?
 
Old 05-08-2013, 06:57 AM   #2
saavik
Member
 
Registered: Nov 2001
Location: NRW, Germany
Distribution: SLES / FC/ OES / CentOS
Posts: 614

Rep: Reputation: 32
I am not to sure, but you can always take a look as the class with:

Code:
watch tc -s class show dev ethWHATEVER
I think you did the mistake to mangle at the wrong point !

Here is what works for me:
Code:
CLASSID11="client1 client2 client3"
CLASSID12=""
tc qdisc add dev eth2 root handle 1: htb default 13

         tc class add dev eth2 parent 1: classid 1:1 htb rate 40MBit ceil 40MBit burst 15k

         tc class add dev eth2 parent 1:1 classid 1:11 htb rate 20MBit ceil 40MBit burst 15k prio 0   
         tc class add dev eth2 parent 1:1 classid 1:12 htb rate 10MBit ceil 40MBit burst 15k prio 1  
         tc class add dev eth2 parent 1:1 classid 1:13 htb rate 10MBit ceil 40MBit burst 15k prio 2 


        tc filter add dev eth2 parent 1: prio 0 protocol ip handle 11 fw flowid 1:11
        tc filter add dev eth2 parent 1: prio 0 protocol ip handle 12 fw flowid 1:12


        for IP in $CLASSID11
        do
                $IPT -t mangle -A INPUT -p tcp -s $IP -j MARK --set-mark 11
                $IPT -t mangle -A OUTPUT -p tcp -d $IP -j MARK --set-mark 11
        done
 
  


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
tc qdisc - a prio problem LinuxMatt Linux - Networking 1 10-11-2009 04:50 PM
prio qdisc - does this really work? GSMD Linux - Networking 1 05-28-2008 05:51 PM
kernel: qdisc with PRIO map ohu Linux - Software 0 10-19-2007 09:06 PM
run multiple algorithm qdisc simultaneously (HTB & HFSC) e1605project Linux - Networking 6 06-26-2006 11:52 PM
HTB as a child of another HTB - doesn't work ddaas Linux - Networking 5 07-25-2005 03:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration