Networking Forums

Networking Forums > Computer Networking > Linux Networking > Problem with PRIO qdisc on Linux router

Reply
Thread Tools Display Modes

Problem with PRIO qdisc on Linux router

 
 
Tim G
Guest
Posts: n/a

 
      12-15-2004, 07:23 PM
Hi Everyone

I'm running Fedora Core 2 as a router and am having problems getting the
PRIO qdisc to work.

I'm using the Iperf utility to generate traffic flows between computers on
either side of the Fedora box. I want traffic destined to port 6001 to be
in band 0, traffic for port 6002 in band 1 and traffic for port 6003 in band
2.

I'm using HTB to restrict the overall bandwidth to 5000 kbit.

So far I've developed the following scripts, based on info I've picked up
from the LARTC mailing list archives, man pages and Google searches.

SCRIPT ONE...

tc qdisc del dev eth1 root
tc qdisc add dev eth1 root handle 1: htb default 1
tc class add dev eth1 parent 1: classid 1:1 htb rate 5000kbit
tc qdisc add dev eth1 parent 1:1 handle 10: prio
tc filter add dev eth1 parent 1:0 protocol ip handle 1 fw flowid 10:1
tc filter add dev eth1 parent 1:0 protocol ip handle 2 fw flowid 10:2
tc filter add dev eth1 parent 1:0 protocol ip handle 3 fw flowid 10:3
iptables -F --table mangle
iptables -t mangle -A POSTROUTING -o eth1 -p tcp --dport 6001 -j
MARK --set-mark 1
iptables -t mangle -A POSTROUTING -o eth1 -p tcp --dport 6002 -j
MARK --set-mark 2
iptables -t mangle -A POSTROUTING -o eth1 -p tcp --dport 6003 -j
MARK --set-mark 3

SCRIPT TWO...

tc qdisc del dev eth1 root
tc qdisc add dev eth1 root handle 1: htb default 1
tc class add dev eth1 parent 1: classid 1:1 htb rate 5000kbit
tc qdisc add dev eth1 parent 1:1 handle 10: prio
tc filter add dev eth1 parent 1: protocol ip prio 1 u32 match ip dport 6001
0xffff flowid 10:1
tc filter add dev eth1 parent 1: protocol ip prio 2 u32 match ip dport 6002
0xffff flowid 10:2
tc filter add dev eth1 parent 1: protocol ip prio 3 u32 match ip dport 6003
0xffff flowid 10:3

Neither of these seem to work as expected. I was hoping to starve the flows
in the lower bands (I'm interested to see the behaviour of TCP in this
situation) but the flows receive a roughly equal share of the available
bandwidth.

I'm obviously doing something wrong and would any help would be appreciated.

Tim.

--
email tpgoddard (at) hotmail.com


 
Reply With Quote
 
 
 
 
Andy Furniss
Guest
Posts: n/a

 
      12-16-2004, 02:02 PM
Tim G wrote:

> Hi Everyone
>
> I'm running Fedora Core 2 as a router and am having problems getting the
> PRIO qdisc to work.
>
> I'm using the Iperf utility to generate traffic flows between computers on
> either side of the Fedora box. I want traffic destined to port 6001 to be
> in band 0, traffic for port 6002 in band 1 and traffic for port 6003 in
> band 2.
>
> I'm using HTB to restrict the overall bandwidth to 5000 kbit.
>
> So far I've developed the following scripts, based on info I've picked up
> from the LARTC mailing list archives, man pages and Google searches.
>
> SCRIPT ONE...
>
> tc qdisc del dev eth1 root
> tc qdisc add dev eth1 root handle 1: htb default 1
> tc class add dev eth1 parent 1: classid 1:1 htb rate 5000kbit
> tc qdisc add dev eth1 parent 1:1 handle 10: prio
> tc filter add dev eth1 parent 1:0 protocol ip handle 1 fw flowid 10:1
> tc filter add dev eth1 parent 1:0 protocol ip handle 2 fw flowid 10:2
> tc filter add dev eth1 parent 1:0 protocol ip handle 3 fw flowid 10:3


This is the bit that doesn't work as I expected.

Seems HTB doesn't forward direct to prio bands from root so you have to
repeat the filters.

Below is what just seemed to work for me - It works without the bfifos
aswell but you don't get per band stats with tc -s qdisc ls dev eth0 if you
don't have them.

Andy.

IPTABLES=/usr/local/sbin/iptables
MODPROBE=/sbin/modprobe
IP=/usr/sbin/ip
TC=/usr/sbin/tc

$IPTABLES -t mangle -D POSTROUTING --dst 192.168.0.1 -j MARK --set-mark 2
&>/dev/null
$IPTABLES -t mangle -D POSTROUTING --dst 192.168.0.2 -j MARK --set-mark 3
&>/dev/null
$IPTABLES -t mangle -D POSTROUTING -m length --length 0:64 -j MARK
--set-mark 1 &>/dev/null

$TC qdisc del dev eth0 root &>/dev/null

if [ "$1" = "stop" ]
then
echo "stopped"
exit
fi

$IPTABLES -t mangle -A POSTROUTING --dst 192.168.0.1 -j MARK --set-mark 2
$IPTABLES -t mangle -A POSTROUTING --dst 192.168.0.2 -j MARK --set-mark 3
$IPTABLES -t mangle -A POSTROUTING -m length --length 0:64 -j MARK
--set-mark 1


$TC qdisc add dev eth0 root handle 1:0 htb default 0
$TC class add dev eth0 parent 1:0 classid 1:1 htb rate 5mbit
$TC qdisc add dev eth0 parent 1:1 handle 2: prio

$TC qdisc add dev eth0 parent 2:1 handle 10:0 bfifo limit 64k
$TC qdisc add dev eth0 parent 2:2 handle 20:0 bfifo limit 64k
$TC qdisc add dev eth0 parent 2:3 handle 30:0 bfifo limit 64k

$TC filter add dev eth0 parent 1:0 prio 0 protocol ip handle 1 fw flowid 1:1
$TC filter add dev eth0 parent 1:0 prio 1 protocol ip handle 2 fw flowid 1:1
$TC filter add dev eth0 parent 1:0 prio 2 protocol ip handle 3 fw flowid 1:1

$TC filter add dev eth0 parent 2:0 prio 0 protocol ip handle 1 fw flowid 2:1
$TC filter add dev eth0 parent 2:0 prio 1 protocol ip handle 2 fw flowid 2:2
$TC filter add dev eth0 parent 2:0 prio 2 protocol ip handle 3 fw flowid 2:3


 
Reply With Quote
 
Tim G
Guest
Posts: n/a

 
      12-16-2004, 06:11 PM
"Andy Furniss" <(E-Mail Removed)> wrote...

> This is the bit that doesn't work as I expected.
>
> Seems HTB doesn't forward direct to prio bands from root so you have to
> repeat the filters.
>
> Below is what just seemed to work for me - It works without the bfifos
> aswell but you don't get per band stats with tc -s qdisc ls dev eth0 if
> you
> don't have them.
>
> Andy.


Hi Andy

You're an absolute star, it works perfectly now.

Thanks for your help

Tim.

--
email tpgoddard (at) hotmail.com



 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in traffic control with HTB + PRIO banyeer Linux Networking 11 11-12-2008 08:45 AM
tc, netem: Emulating multiple connections, problem with limit on the number of PRIO bands Patrick Reinhardt Linux Networking 1 08-28-2007 06:37 PM
sfq or prio qdisc? klops Linux Networking 0 10-07-2004 01:20 PM
I can see qdisc/prio/bfifo filled by datas but can't see any traffic prioritization Eric Bart Linux Networking 1 11-12-2003 04:02 AM
Linux Router/Firewall - Linux Client problem Fry Linux Networking 6 09-06-2003 02:25 AM



1 2 3 4 5 6 7 8 9 10 11