Networking Forums

Networking Forums > Computer Networking > Linux Networking > QoS using DSCP

Reply
Thread Tools Display Modes

QoS using DSCP

 
 
Maciej Matachowski
Guest
Posts: n/a

 
      02-07-2008, 09:04 AM
The problem consist in following. The script is attached to OpenWRT on
linksys router. Then I stream from one network to another. I use
IPTABLES command to mark the outgoing packets with DSCP field.
Parallely
with that I start to flood with Best Effort packets just to check if
BE
traffic affects DSCP traffic.


#!/bin/sh -x

insmod /lib/modules/2.4.34/sch_dsmark.o
insmod /lib/modules/2.4.34/cls_tcindex.o
insmod /lib/modules/2.4.34/sch_htb.o
insmod /lib/modules/2.4.34/sch_gred.o
insmod /lib/modules/2.4.34/sch_red.o

interface=br-lan
rate=15Mbit
ceil=15Mbit

qrate=1500Kbit

limit=128KB
min=20KB
max=60KB

burst=20
avpkt=1000

bandwidth=15Mbit

# Creating tcindex table
tc qdisc add dev $interface handle 1:0 root dsmark indices 64
set_tc_index
tc filter add dev $interface parent 1:0 protocol ip prio 1 tcindex
mask
0xfc shift 2 pass_on

# Classification's elements / Architecture elements

# Class AF1
tc filter add dev $interface parent 1:0 protocol ip prio 1 handle 10
tcindex classid 1:111
tc filter add dev $interface parent 1:0 protocol ip prio 1 handle 12
tcindex classid 1:112
tc filter add dev $interface parent 1:0 protocol ip prio 1 handle 14
tcindex classid 1:113
# Class AF2
tc filter add dev $interface parent 1:0 protocol ip prio 1 handle 18
tcindex classid 1:121
tc filter add dev $interface parent 1:0 protocol ip prio 1 handle 20
tcindex classid 1:122
tc filter add dev $interface parent 1:0 protocol ip prio 1 handle 22
tcindex classid 1:123
# Class AF3
tc filter add dev $interface parent 1:0 protocol ip prio 1 handle 26
tcindex classid 1:131
tc filter add dev $interface parent 1:0 protocol ip prio 1 handle 28
tcindex classid 1:132
tc filter add dev $interface parent 1:0 protocol ip prio 1 handle 30
tcindex classid 1:133
# Class AF4
tc filter add dev $interface parent 1:0 protocol ip prio 1 handle 34
tcindex classid 1:141
tc filter add dev $interface parent 1:0 protocol ip prio 1 handle 36
tcindex classid 1:142
tc filter add dev $interface parent 1:0 protocol ip prio 1 handle 38
tcindex classid 1:143
# Class BF
tc filter add dev $interface parent 1:0 protocol ip prio 2 handle 0
tcindex mask 0 classid 1:1
# Class EF
tc filter add dev $interface parent 1:0 protocol ip prio 1 handle 46
tcindex classid 1:150


# HTB filter
tc qdisc add dev $interface parent 1:0 handle 2:0 htb

tc class add dev $interface parent 2:0 classid 2:1 htb rate $rate ceil
$ceil

tc filter add dev $interface parent 2:0 protocol ip prio 1 tcindex
mask
0xf0 shift 4 pass_on


# AF class 1
tc class add dev $interface parent 2:1 classid 2:10 htb rate $qrate
ceil
$ceil
tc qdisc add dev $interface parent 2:10 gred setup DPs 3 default 2
grio

tc filter add dev $interface parent 2:0 protocol ip prio 1 handle 1
tcindex classid 2:10

# AF Class 11
tc qdisc change dev $interface parent 2:10 gred limit $limit min $min
max $max burst $burst avpkt $avpkt bandwidth $bandwidth DP 1
probability
0.02 prio 2
# AF Class 12
tc qdisc change dev $interface parent 2:10 gred limit $limit min $min
max $max burst $burst avpkt $avpkt bandwidth $bandwidth DP 2
probability
0.04 prio 3
# AF Class 13
tc qdisc change dev $interface parent 2:10 gred limit $limit min $min
max $max burst $burst avpkt $avpkt bandwidth $bandwidth DP 3
probability
0.06 prio 4


# AF Class 2
tc class add dev $interface parent 2:1 classid 2:20 htb rate $qrate
ceil
$ceil
tc qdisc add dev $interface parent 2:20 gred setup DPs 3 default 2
grio

tc filter add dev $interface parent 2:0 protocol ip prio 1 handle 2
tcindex classid 2:20

# AF Class 21
tc qdisc change dev $interface parent 2:20 gred limit $limit min $min
max $max burst $burst avpkt $avpkt bandwidth $bandwidth DP 1
probability
0.02 prio 2
# AF Class 22
tc qdisc change dev $interface parent 2:20 gred limit $limit min $min
max $max burst $burst avpkt $avpkt bandwidth $bandwidth DP 2
probability
0.04 prio 3
# AF Class 23
tc qdisc change dev $interface parent 2:20 gred limit $limit min $min
max $max burst $burst avpkt $avpkt bandwidth $bandwidth DP 3
probability
0.06 prio 4


# AF Class 3
tc class add dev $interface parent 2:1 classid 2:30 htb rate $qrate
ceil
$ceil
tc qdisc add dev $interface parent 2:30 gred setup DPs 3 default 2
grio

tc filter add dev $interface parent 2:0 protocol ip prio 1 handle 3
tcindex classid 2:30

# AF Class 31
tc qdisc change dev $interface parent 2:30 gred limit $limit min $min
max $max burst $burst avpkt $avpkt bandwidth $bandwidth DP 1
probability
0.02 prio 2
# AF Class 32
tc qdisc change dev $interface parent 2:30 gred limit $limit min $min
max $max burst $burst avpkt $avpkt bandwidth $bandwidth DP 2
probability
0.04 prio 3
# AF Class 33
tc qdisc change dev $interface parent 2:30 gred limit $limit min $min
max $max burst $burst avpkt $avpkt bandwidth $bandwidth DP 3
probability
0.06 prio 4


# AF Class 4
tc class add dev $interface parent 2:1 classid 2:40 htb rate $qrate
ceil
$ceil
tc qdisc add dev $interface parent 2:40 gred setup DPs 3 default 2
grio

tc filter add dev $interface parent 2:0 protocol ip prio 1 handle 4
tcindex classid 2:40

# AF Class 41
tc qdisc change dev $interface parent 2:40 gred limit $limit min $min
max $max burst $burst avpkt $avpkt bandwidth $bandwidth DP 1
probability
0.02 prio 2
# AF Class 42
tc qdisc change dev $interface parent 2:40 gred limit $limit min $min
max $max burst $burst avpkt $avpkt bandwidth $bandwidth DP 2
probability
0.04 prio 3
# AF Class 43
tc qdisc change dev $interface parent 2:40 gred limit $limit min $min
max $max burst $burst avpkt $avpkt bandwidth $bandwidth DP 3
probability
0.06 prio 4


# BE
tc class add dev $interface parent 2:1 classid 2:50 htb rate $qrate
ceil
$ceil
tc qdisc add dev $interface parent 2:50 red limit $limit min $min max
$max burst $burst avpkt $avpkt bandwidth $bandwidth probability 0.4

tc filter add dev $interface parent 2:0 protocol ip prio 1 handle 0
tcindex classid 2:50


# EF
tc class add dev $interface parent 2:1 classid 2:60 htb rate $qrate
ceil
$ceil
tc qdisc add dev $interface parent 2:60 red limit $limit min $min max
$max burst $burst avpkt $avpkt bandwidth $bandwidth probability 0.2

tc filter add dev $interface parent 2:0 protocol ip prio 1 handle 5
tcindex classid 2:60

From script you can see that I have a separate queues allocated for
each traffic but when I start BE traffic I see that it affects DSCP
traffic. Can you explain what is the reason and how I can correct it?

thx

Regards,
Maciek
 
Reply With Quote
 
 
 
 
Andy Furniss
Guest
Posts: n/a

 
      02-09-2008, 08:01 PM
Maciej Matachowski wrote:
> The problem consist in following. The script is attached to OpenWRT on
> linksys router. Then I stream from one network to another. I use
> IPTABLES command to mark the outgoing packets with DSCP field.
> Parallely
> with that I start to flood with Best Effort packets just to check if
> BE
> traffic affects DSCP traffic.


I've never used DSCP or *RED so can't really spot errors in the script
as such.

I can comment generally on a few things.

If you are doing all of this on one device then it seems overcomplicated
to use DHCP - you may as well just mark with iptables and filter on
those (there is a way to get htb to map marks to classes without any
filters at all)

*RED AFAIK was designed and tested as root on a fixed bandwidth link -
you have several attached to htb classes with variable rates. I am not
saying it won't work at all but it's something to consider.

I am not sure of your setup - shaping on br-lan I wonder where the
traffic is coming from - if 15mbit is a WAN say ADSL2 then that's
shaping from the wrong end of a bottleneck which has issues which
shaping from the right end doesn't.

If you keep this setup, the way you are using htb means that all the
classes are equal. It would be better to use htb's prio option to give
the latency sensitive traffic priority - but this also affects how htb
shares bandwidth.

Andy.

 
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 setting DSCP value Washington Ratso Linux Networking 1 05-20-2011 01:15 PM
per packet QoS (DSCP) aapocketz Linux Networking 0 12-08-2008 07:52 PM
Per-packet IP DSCP/TOS Marking srikanta Linux Networking 0 10-16-2008 02:34 AM
iptables : no more TOS but DSCP ? zero°K Linux Networking 0 07-15-2008 01:51 PM
Using DiffServ / DSCP as QoS on 2000?????? =?Utf-8?B?d2Vhbg==?= Windows Networking 0 11-17-2004 09:44 AM



1 2 3 4 5 6 7 8 9 10 11