Linux Advanced Routing and Traffic Control list
 help / color / mirror / Atom feed
From: "Czakó Krisztián" <slapic@linux.co.hu>
To: lartc@vger.kernel.org
Subject: [LARTC] equal bandwith using HTB
Date: Thu, 23 Jan 2003 10:54:05 +0000	[thread overview]
Message-ID: <marc-lartc-104331933919718@msgid-missing> (raw)

I'd like to set up HTB to share a bandwith equally between machines.
This is my situation:

.                                  +-- Clients (1.2.3.140-147)
.                                [eth1]
Internet -- [comx0] router [br0] --+
.                                [eth0]
.                                  +-- Servers (currently one:1.2.3.135)

br0 is 1.2.3.130 and the net is 1.2.3.128/26.

Internet speed is 512kbit. Clients are connected via a wireless AP
connected to eth1. Servers are connected via an ethernet switch
connected to eth0. We need br0 only because of the phisical topology
(impossible to connect the AP to the same switch used for the servers).

I would like to give 20% rate to the Servers, and 80% rate to the
Clients. I'd like to be sure to share Clients bandwoith equally between
each client. Communication between Clients and Servers should be limited
to 4mbit.

It works more or less, but when a user starts several tcp downloads, he
gets almost all of the bandwith. Of course rates are always respected,
but the remaining not shared equally.

I've tried the following:
DEV=br0
BANDWITHH0
LOCALBW=4mbit

tc qdisc del dev $DEV root

tc qdisc add dev $DEV root handle 1: htb default 1 r2q 1

tc class add dev $DEV parent 1: classid 1:1 htb rate ${BANDWITH}kbit
prio 2 burst 64k cburst 0k
tc class add dev $DEV parent 1: classid 1:2 htb rate ${LOCALBW} prio 1
burst 128k

USERS=8
USERBW=$[8*${BANDWITH}/10]
SERVERBW=$[2*${BANDWITH}/10]
PERUSERBW=$[$USERBW/$USERS]

tc class add dev $DEV parent 1:1 classid 1:10 htb rate ${USERBW}kbit
ceil ${USERBW}kbit prio 4 burst 4k cburst 0k
tc class add dev $DEV parent 1:1 classid 1:11 htb rate ${SERVERBW}kbit
ceil ${BANDWITH}kbit prio 3 burst 32k cburst 0k

declare -i NUM=${USERS}
while [ $NUM -ge 1 ]; do
   tc class add dev $DEV parent 1:10 classid 1:$[139+$NUM] htb rate
${PERUSERBW}kbit ceil ${USERBW}kbit prio 4 burst 10k cburst 10k
   tc filter add dev $DEV parent 1: protocol ip prio 4 u32 match ip dst
1.2.3.$[139+$NUM] flowid 1:$[139+$NUM]
   NUM=$NUM-1
done

tc filter add dev $DEV parent 1: protocol ip prio 1 u32 \
        match ip src 1.2.3.128/26 \
        match ip dst 1.2.3.128/26 flowid 1:2
tc filter add dev $DEV parent 1: protocol ip prio 3 u32 \
        match ip dst 1.2.3.135 flowid 1:11
tc filter add dev $DEV parent 1: protocol ip prio 5 u32 \
       match ip dst 0.0.0.0/0 flowid 1:10

Best regards,
Slapic
-- 
Pilatus-Comp Ltd. HUNGARY * The Linux Expert * pilatuscomp@linux.co.hu
http://www.linux.co.hu * Phone: +36-1-2481816 * Fax: +36-1-2481817



_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

                 reply	other threads:[~2003-01-23 10:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-lartc-104331933919718@msgid-missing \
    --to=slapic@linux.co.hu \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox