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 01-23-2015, 12:23 PM   #1
boot0user
LQ Newbie
 
Registered: Jul 2014
Posts: 5

Rep: Reputation: Disabled
Traffic shaper: sfq external classifier not work as expected


Have a Ubuntu 14.04.1 LTS with 3.13.0-44-generic kernel. Also, have a traffic shaper rules:

Code:
    # Add discuiplines for DL device
    tc qdisc add dev $devDL root handle 1:0 htb default 12

    # Add classes for DL device
    tc class add dev $devDL parent 1:0 classid 1:1 htb rate $bwDL ceil $bwDL quantum $quantum
    tc class add dev $devDL parent 1:1 classid 1:11 htb prio 1 rate $bwPrivateDL ceil $bwDL quantum $quantum
    tc class add dev $devDL parent 1:1 classid 1:12 htb prio 2 rate $bwPublicDL ceil $bwPublicDL quantum $quantum

    tc qdisc add dev $devDL parent 1:11 sfq divisor $divisor perturb $perturb
    tc qdisc add dev $devDL parent 1:12 sfq divisor $divisor perturb $perturb

    # Add filters for DL device
    if [ -s $filePrivate ]; then
        for ip in `grep -v "#" $filePrivate`; do
        if [ `expr index $ip :` = 0 ]; then
            tc filter add dev $devDL protocol all prio 1 parent 1:0 u32 match ip dst $ip flowid 1:11
        else
            echo $ip
            tc filter add dev $devDL protocol all prio 1 parent 1:0 u32 match ip6 dst $ip flowid 1:11
        fi
        done
        tc filter add dev $devDL protocol all prio 1 parent 1:11 handle 11 flow hash keys dst divisor $divisor baseclass 1:11
    fi

    tc filter add dev $devDL protocol all prio 2 parent 1:0 u32 match ip dst 0/0 flowid 1:12
    tc filter add dev $devDL protocol all prio 2 parent 1:0 u32 match ip6 dst ::/0 flowid 1:12
    tc filter add dev $devDL protocol all prio 2 parent 1:12 handle 12 flow hash keys dst divisor $divisor baseclass 1:12
HTB discuipline work fine, but sfq external classifier not work as expected. Two hosts of the same class with running torrent cliens not share bandwidth equally. One client can pick up a lot more of shared bandwidth.

Code:
tc filter add dev $devDL protocol all prio 2 parent 1:12 handle 12 flow hash keys dst divisor $divisor baseclass 1:12
Where is my mistake and what I'm doing wrong?

Please, help!
 
Old 01-26-2015, 12:24 AM   #2
boot0user
LQ Newbie
 
Registered: Jul 2014
Posts: 5

Original Poster
Rep: Reputation: Disabled
I maked some errors in config, so, there is right script part:

Code:
# Add discuiplines for DL device
tc qdisc add dev $devDL root handle 1: htb default 12

# Add classes for DL device
tc class add dev $devDL parent 1: classid 1:1 htb rate $bwDL ceil $bwDL quantum $quantum
tc class add dev $devDL parent 1:1 classid 1:11 htb prio 1 rate $bwPrivateDL ceil $bwDL quantum $quantum
tc class add dev $devDL parent 1:1 classid 1:12 htb prio 2 rate $bwPublicDL ceil $bwPublicDL quantum $quantum

tc qdisc add dev $devDL parent 1:11 handle 11: sfq divisor $divisor perturb $perturb
tc qdisc add dev $devDL parent 1:12 handle 12: sfq divisor $divisor perturb $perturb

tc filter add dev $devDL protocol all prio 1 parent 11: handle 11 flow hash keys dst divisor $divisor baseclass 1:11
tc filter add dev $devDL protocol all prio 2 parent 12: handle 12 flow hash keys dst divisor $divisor baseclass 1:12

# Add filters for DL device
if [ -s $filePrivate ]; then
    for ip in `grep -v "#" $filePrivate`; do
    if [ `expr index $ip :` = 0 ]; then
        tc filter add dev $devDL protocol all prio 1 parent 1: u32 match ip dst $ip flowid 1:11
    else
        echo $ip
        tc filter add dev $devDL protocol all prio 1 parent 1: u32 match ip6 dst $ip flowid 1:11
    fi
    done
fi

tc filter add dev $devDL protocol all prio 2 parent 1: u32 match ip dst 0/0 flowid 1:12
tc filter add dev $devDL protocol all prio 2 parent 1: u32 match ip6 dst ::/0 flowid 1:12
SFQ qdisc MUST have handle, and SFQ external classifier MUST use this handle for link at it. Shaper now work as needed.
 
  


Reply

Tags
networking


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
LAPTOP's connected to external displays do not work as expected saytac Ubuntu 3 12-08-2009 07:36 PM
Shaping traffic with SFQ external classifier (flow hash key dst) - no packet forward. Bogdan Linux - Networking 3 05-06-2009 11:08 PM
A question regarding traffic shaping involving tc-tbf and tc-sfq 05020241 Linux - Networking 3 06-27-2008 06:08 AM
Traffic Shaper maximusjr Linux - Networking 1 12-17-2005 07:25 PM
traffic shaper justme Linux - Networking 1 02-22-2002 06:31 AM

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

All times are GMT -5. The time now is 09:25 PM.

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