LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   problem configuring htb (https://www.linuxquestions.org/questions/linux-networking-3/problem-configuring-htb-308862/)

abhishekg 04-02-2005 01:42 AM

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

pave 04-02-2005 10:59 AM

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

abhishekg 04-02-2005 12:15 PM

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


All times are GMT -5. The time now is 11:57 PM.