LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 04-02-2005, 02:42 AM   #1
abhishekg
LQ Newbie
 
Registered: Apr 2005
Location: Bhopal, India
Distribution: Redhat
Posts: 3

Rep: Reputation: 0
problem configuring htb


hello everybody

I am working on a project related to QoS. I am using Linux's tc to configure
my PC based router.
My setup is as follows:-
-------------------- eth0 ----eth1------------------eth0----eth0----------------------
PC-based server|----------|PC-based Router|---------|PC-Based Client
--------------------------------------(using tc)-------------------------------------------

* All my ethernet cards are on 100Mbps lan
* Traffic generators being used:
#UDP: gen_send at about 1Mbps
* Kernel versions being used:-
# At Router: linux-2.4.20
# At Client and Server: Linux-2.4.7-10
* iproute2 versions:-
# At Router: iproute2-ss020116
# At Client and Server: iproute2-ss010824
* Packets before leaving sever and client are being marked with DSCP bits using
Linux's tc option; Marking is done based on two-tuples: destination ip address
and port number
* At the Router, I have the following configuration(only htb portion) for eth0 and similar
configuration exits for eth1 too:

---------------Router Configuration Starts Here-------------------------------------
DEV0='eth0'

tc qdisc add dev $DEV0 parent 1: handle 2: htb default 30
tc class add dev $DEV0 parent 2: classid 2:1 htb rate 100kbit burst 100 ceil 100kbit

tc class add dev $DEV0 parent 2:1 classid 2:10 htb rate 60kbit burst 100 ceil 100kbit
tc class add dev $DEV0 parent 2:1 classid 2:20 htb rate 30kbit burst 60 ceil 100kbit
tc class add dev $DEV0 parent 2:1 classid 2:30 htb rate 10kbit burst 80 ceil 100kbit

tc qdisc add dev $DEV0 parent 2:10 gred setup DPs 3 default 3 grio
tc qdisc change dev $DEV0 parent 2:10 gred limit 185000 min 11394 max 11395 \
burst 100 avpkt 128 bandwidth 100kbit DP 1 probability 1 prio 1
tc qdisc change dev $DEV0 parent 2:10 gred limit 17972 min 4748 max 9493 burst 50 \
avpkt 1000 bandwidth 100kbit DP 2 probability 0.01 prio 2
tc qdisc change dev $DEV0 parent 2:10 gred limit 4368 min 1796 max 3582 burst 25 \
avpkt 1000 bandwidth 100kbit DP 3 probability 0.01 prio 2

tc qdisc add dev $DEV0 parent 2:20 gred setup DPs 2 default 2 grio
tc qdisc change dev $DEV0 parent 2:20 gred limit 52480 min 11311 max 11312 burst 60 \
avpkt 256 bandwidth 100kbit DP 1 probability 1 prio 1
tc qdisc change dev $DEV0 parent 2:20 gred limit 47184 min 5898 max 11796 burst 60 \
avpkt 1000 bandwidth 100kbit DP 2 probability 0.01 prio 2

tc qdisc add dev $DEV0 parent 2:30 gred setup DPs 1 default 1 grio
tc qdisc change dev $DEV0 parent 2:30 gred limit 15728 min 1966 max 3932 burst 80 \
avpkt 200 bandwidth 100kbit DP 1 probability 0.04 prio 1

-----------------------------Router Configuration Ends Here-------------------------------


Now, the problem is that when I am sending packets from just one UDP source
(at server), I am getting outbound bit rate at eth0(of Router) as 12kbps even
though I have ceiled the corresponding HTB class to 100kbps; when I am sending
UDP packets from two UDP sources(both at server), then also I am getting bit
rate at eth0 as 12kbps. So, even though I have configured for 100kbps, I am
getting only 12kbps as the link speed.

Please help me out.

Abhishek
 
Old 04-02-2005, 11:59 AM   #2
pave
Member
 
Registered: Oct 2004
Posts: 42

Rep: Reputation: 15
I don't know much about gred, instead I use tc filter. Besides - where is your root class?

Try this:

The default class is 30 so all packets will go through it, apart from those who match tc filter rules. I assume that you want UPD packets to run smoothly. In addition i suggest ICMP packets and all packets with low TOS.

tc qdisc add dev $DEV0 root handle 2:0 htb default 30
tc class add dev $DEV0 parent 2:0 classid 2:1 htb rate 100kbit burst 100 ceil 100kbit

tc class add dev $DEV0 parent 2:1 classid 2:10 htb rate 60kbit burst 100 ceil 100kbit
tc class add dev $DEV0 parent 2:1 classid 2:20 htb rate 30kbit burst 60 ceil 100kbit
tc class add dev $DEV0 parent 2:1 classid 2:30 htb rate 10kbit burst 80 ceil 100kbit

#udp
tc filter add dev $DEV0 protocol ip parent 2:0 u32 match ip protocol 17 0xff flowid 2:10
#icmp
tc filter add dev $DEV0 protocol ip parent 2:0 u32 match ip protocol 1 0xff flowid 2:10
#with low tos (used by ssh for example)
tc filter add dev $DEV0 protocol ip parent 2:0 u32 match ip tos 0x10 0xff flowid 2:10
 
Old 04-02-2005, 01:15 PM   #3
abhishekg
LQ Newbie
 
Registered: Apr 2005
Location: Bhopal, India
Distribution: Redhat
Posts: 3

Original Poster
Rep: Reputation: 0
hello everybody
Thanks pave for helping me out. I will try with your configuration. Meanwhile have a look
on my complete configuration script where packets with appropriate DCSP bit(marking is being done just before packets leave the server side) are classified to approriate queue. Here is the complete configuration script:

---------------Router Configuration Starts Here-------------------------------------
DEV0='eth0'
tc qdisc del dev $DEV0 root

# Device 1: eth0

tc qdisc add dev $DEV0 handle 1:0 root dsmark indices 64 set_tc_index
tc filter add dev $DEV0 parent 1:0 protocol ip prio 1 tcindex \
mask 0xff shift 2 pass_on

tc filter add dev $DEV0 parent 1:0 protocol ip prio 1 \
handle 46 tcindex classid 1:111
tc filter add dev $DEV0 parent 1:0 protocol ip prio 1 \
handle 10 tcindex classid 1:112
tc filter add dev $DEV0 parent 1:0 protocol ip prio 1 \
handle 12 tcindex classid 1:113

tc filter add dev $DEV0 parent 1:0 protocol ip prio 1 \
handle 63 tcindex classid 1:121
tc filter add dev $DEV0 parent 1:0 protocol ip prio 1 \
handle 0 tcindex classid 1:122

tc filter add dev $DEV0 parent 1:0 protocol ip prio 1 \
handle 18 tcindex classid 1:131

tc qdisc add dev $DEV0 parent 1: handle 2: htb default 30
tc class add dev $DEV0 parent 2: classid 2:1 htb rate 100kbit burst 100 ceil 100kbit
tc class add dev $DEV0 parent 2:1 classid 2:10 htb rate 60kbit burst 100 ceil 100kbit
tc class add dev $DEV0 parent 2:1 classid 2:20 htb rate 30kbit burst 60 ceil 100kbit
tc class add dev $DEV0 parent 2:1 classid 2:30 htb rate 10kbit burst 80 ceil 100kbit

tc filter add dev $DEV0 parent 2:0 protocol ip prio 1 \
tcindex mask 0xf0 shift 4 pass_on
tc filter add dev $DEV0 parent 2:0 protocol ip prio 1 \
handle 1 tcindex classid 2:10
tc filter add dev $DEV0 parent 2:0 protocol ip prio 1 \
handle 2 tcindex classid 2:20
tc filter add dev $DEV0 parent 2:0 protocol ip prio 1 \
handle 3 tcindex classid 2:30

tc qdisc add dev $DEV0 parent 2:10 gred setup DPs 3 default 3 grio
tc qdisc change dev $DEV0 parent 2:10 gred limit 185000 min 11394 max 11395 burst 100 \
avpkt 128 bandwidth 100kbit DP 1 probability 1 prio 1
tc qdisc change dev $DEV0 parent 2:10 gred limit 17972 min 4748 max 9493 burst 50 \
avpkt 1000 bandwidth 100kbit DP 2 probability 0.01 prio 2
tc qdisc change dev $DEV0 parent 2:10 gred limit 4368 min 1796 max 3582 burst 25 \
avpkt 1000 bandwidth 100kbit DP 3 probability 0.01 prio 2

tc qdisc add dev $DEV0 parent 2:20 gred setup DPs 2 default 2 grio
tc qdisc change dev $DEV0 parent 2:20 gred limit 52480 min 11311 max 11312 burst 60 \
avpkt 256 bandwidth 100kbit DP 1 probability 1 prio 1
tc qdisc change dev $DEV0 parent 2:20 gred limit 47184 min 5898 max 11796 burst 60 \
avpkt 1000 bandwidth 100kbit DP 2 probability 0.01 prio 2

tc qdisc add dev $DEV0 parent 2:30 gred setup DPs 1 default 1 grio
tc qdisc change dev $DEV0 parent 2:30 gred limit 15728 min 1966 max 3932 burst 80 \
avpkt 200 bandwidth 100kbit DP 1 probability 0.04 prio 1

-----------------------------Router Configuration Ends Here-------------------------------

Please do let me know whether there is any flaw in this configuration setup at the router.
abhishek
 
  


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
htb.init divide trafic in groups ? Problem .. sys7em Linux - Networking 0 08-18-2005 06:35 AM
QoS with HTB: Multi-session problem diaskimo Linux - Networking 0 08-01-2005 09:21 PM
HTB as a child of another HTB - doesn't work ddaas Linux - Networking 5 07-25-2005 04:21 AM
HTB configuration problem laotalax Linux - Networking 3 04-21-2005 05:42 AM
How To HTB linuxcolor Fedora 1 02-15-2005 08:46 AM


All times are GMT -5. The time now is 01:07 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration