All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kalin Bogatzevski" <kalin@bogatzevski.com>
To: lartc@vger.kernel.org
Subject: [LARTC] CBQ Classes and Sub-Classes
Date: Sat, 30 Jun 2001 16:05:24 +0000	[thread overview]
Message-ID: <marc-lartc-99391718629428@msgid-missing> (raw)

Hello,

We have a small LAN with 7 PCs. On the Linux server I have created a traffic
shaping script that must do the following:

1) Total BW to be shaped 7MBit
2) Group A (8001) bound BW 3MBit
3) Group B (8002) bound BW 1.5MBit
-for the tests I have inserted all the PCs in Group B. They are with
different rates but always LESS than the Group B BW. As a total they are
over the total BW of the Group.

I want to set the shaper to not allow the groups to use MORE than allowed
setting some contention ratio of 1:2.

Here is my current test script. Please advise! Thanks.

# flush root qdisc
tc qdisc del dev eth0 root

# add root qdisc on eth0
tc qdisc add dev eth0 root handle 10: cbq bandwidth 100MBit avpkt 1000

# add main bandwidth for shaping 7168KBit
tc class add dev eth0 parent 10:0 classid 10:8000 est 1sec 8sec cbq
bandwidth 100MBit rate 7168KBit allot 1514 avpkt 1000 prio 3 bounded
isolated
tc filter add dev eth0 parent 10:0 protocol ip prio 4 handle 1 fw classid
10:8000
tc filter add dev eth0 parent 10:0 protocol ip prio 4 handle 2 fw classid
10:8000
tc filter add dev eth0 parent 10:0 protocol ip prio 4 handle 3 fw classid
10:8000

# add groups in the main stream

# group 1 of 3072KBit
tc class add dev eth0 parent 10:8000 classid 10:8001 est 1sec 8sec cbq
bandwidth 100MBit rate 3072KBit allot 1514 avpkt 1000 prio 3 bounded

# group 2 of 1536KBit
tc class add dev eth0 parent 10:8000 classid 10:8002 est 1sec 8sec cbq
bandwidth 100MBit rate 1536KBit allot 1514 avpkt 1000 prio 3 bounded
tc filter add dev eth0 parent 10:8000 protocol ip prio 4 handle 1 fw classid
10:8002
tc filter add dev eth0 parent 10:8000 protocol ip prio 4 handle 2 fw classid
10:8002
tc filter add dev eth0 parent 10:8000 protocol ip prio 4 handle 3 fw classid
10:8002

# add users in group 2

# user 1 is 512KBit with 1Mbit bound
# bound class
tc class add dev eth0 parent 10:8002 classid 10:4001 est 1sec 8sec cbq
bandwidth 100MBit rate 1024KBit allot 1514 avpkt 1000 prio 3 bounded
tc filter add dev eth0 parent 10:8002 protocol ip prio 4 handle 1 fw classid
10:4001
# rate class not bound
tc class add dev eth0 parent 10:4001 classid 10:1 est 1sec 8sec cbq
bandwidth 100MBit rate 512KBit allot 1514 avpkt 1000 prio 3
tc filter add dev eth0 parent 10:4001 protocol ip prio 4 handle 1 fw classid
10:1

# user 2 is 1Mbit with 1500KBit bound
# bound class
tc class add dev eth0 parent 10:8002 classid 10:4002 est 1sec 8sec cbq
bandwidth 100MBit rate 1500KBit allot 1514 avpkt 1000 prio 3 bounded
tc filter add dev eth0 parent 10:8002 protocol ip prio 4 handle 2 fw classid
10:4002
# rate class not bound
tc class add dev eth0 parent 10:4002 classid 10:2 est 1sec 8sec cbq
bandwidth 100MBit rate 1024KBit allot 1514 avpkt 1000 prio 3
tc filter add dev eth0 parent 10:4002 protocol ip prio 4 handle 2 fw classid
10:2

# user 3 is 1Mbit with 1500KBit bound
# bound class
tc class add dev eth0 parent 10:8002 classid 10:4003 est 1sec 8sec cbq
bandwidth 100MBit rate 1500KBit allot 1514 avpkt 1000 prio 3 bounded
tc filter add dev eth0 parent 10:8002 protocol ip prio 4 handle 3 fw classid
10:4003
# rate class not bound
tc class add dev eth0 parent 10:4003 classid 10:3 est 1sec 8sec cbq
bandwidth 100MBit rate 1024KBit allot 1514 avpkt 1000 prio 3
tc filter add dev eth0 parent 10:4003 protocol ip prio 4 handle 3 fw classid
10:3

# iptables flush table
iptables -t mangle -F PREROUTING
iptables -t mangle -F OUTPUT

# mark packets
iptables -t mangle -A PREROUTING -d 192.168.20.35 -j MARK --set-mark 1
iptables -t mangle -A PREROUTING -d 192.168.20.35 -j RETURN
iptables -t mangle -A OUTPUT -d 192.168.20.35 -j MARK --set-mark 1
iptables -t mangle -A OUTPUT -d 192.168.20.35 -j RETURN

iptables -t mangle -A PREROUTING -d 192.168.20.64 -j MARK --set-mark 2
iptables -t mangle -A PREROUTING -d 192.168.20.64 -j RETURN
iptables -t mangle -A OUTPUT -d 192.168.20.64 -j MARK --set-mark 2
iptables -t mangle -A OUTPUT -d 192.168.20.64 -j RETURN

iptables -t mangle -A PREROUTING -d 192.168.20.50 -j MARK --set-mark 3
iptables -t mangle -A PREROUTING -d 192.168.20.50 -j RETURN
iptables -t mangle -A OUTPUT -d 192.168.20.50 -j MARK --set-mark 3
iptables -t mangle -A OUTPUT -d 192.168.20.50 -j RETURN

Regards,
Kalin.


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

                 reply	other threads:[~2001-06-30 16:05 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-99391718629428@msgid-missing \
    --to=kalin@bogatzevski.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.