Linux Advanced Routing and Traffic Control list
 help / color / mirror / Atom feed
From: "Nigel Jones" <jonesn@hursley.ibm.com>
To: lartc@vger.kernel.org
Subject: [LARTC] shaping from  ethernets to adsl
Date: Sat, 09 Feb 2002 16:49:09 +0000	[thread overview]
Message-ID: <marc-lartc-101327339318927@msgid-missing> (raw)

I have 2 ethernet subnets -- one wireless (eth0 192.168.0), one 10Mbs wired
(eth1 192.168.1) connected to a 512 up / 256 down adsl connection (ppp0). I
have a single ip address on the ppp0 connection, and use nat to the devices
on the ethernet networks (there's only 1 on each!)

I'd like to priotize small packets (<500 bytes). May also look at other
packet markings as time goes on (ie audio stream> icmp/small> http > ftp).
I'd also like local traffic to be unaffected.

To help in testing, I've bounded the classes for now, but will likely remove
this when I know it's working.

I've just realised something though.... How do I allow the total download
bandwidth hitting eth0+eth1 from the net connection (ppp0) to be limited at
512, but "pooled" it I don't want to divide 256/256 per ethernet segment.
All these restrictions are device specific?

Here's what I've done so far - I know it's rather long. I think it works in
part, but the multiple ethernet issue I'm really confused by!. Also I don't
know what to set the other cbq parms to

Help!?

I think I need to throttle
#!/bin/sh

tc qdisc del root dev eth0 2>/dev/null

tc qdisc del root dev eth1 2>/dev/null

tc qdisc del root dev ppp0 2>/dev/null

tc class del root dev eth0 2>/dev/null

tc class del root dev eth1 2>/dev/null

tc class del root dev ppp0 2>/dev/null

# small packets - mark with 3

iptables -t mangle -A OUTPUT -m length --length 0:500 -j MARK --set-mark 3

iptables -t mangle -A OUTPUT -p icmp -j MARK --set-mark 3

# large packets - mark with 4

iptables -t mangle -A OUTPUT -m length --length 500:15000 -j MARK --set-mark
4

iptables -t mangle -A OUTPUT -p icmp -j MARK --set-mark 3

# Mark local traffic between ethernet segments

iptables -t mangle -A OUTPUT -s 192.168.0.1/16 -d eth1 -j MARK --set-mark 9

iptables -t mangle -A OUTPUT -s 192.168.0.1/16 -d eth0 -j MARK --set-mark 9

#

# root queueing discipline - adsl is 256 upstream

tc qdisc add dev ppp0 root handle 10: cbq bandwidth 256kbit avpkt 1000

tc qdisc add dev eth0 root handle 11: cbq bandwidth 10Mbit avpkt 1000

tc qdisc add dev eth1 root handle 12: cbq bandwidth 10Mbit avpkt 1000

# see http://www.prout.be/qos/QoS-connection-tuning-HOWTO.txt

# here's the total 256 for upstream adsl

tc class add dev ppp0 parent 10:0 classid 10:1 cbq bandwidth 256kbit rate
256kbit prio 4 bounded isolated allot 1514

# 10:2 for interactive

tc class add dev ppp0 parent 10:1 classid 10:2 cbq bandwidth 256kbit rate
85Kbit prio 1 bounded isolated allot 1514

# 10:3 for large traffic

tc class add dev ppp0 parent 10:1 classid 10:3 cbq bandwidth 256kbit rate
171kbit prio 8 bounded isolated allot 1514

# base 10 Mbs ethernet

tc class add dev eth0 parent 11:0 classid 11:1 cbq bandwidth 10Mbit rate
512kbit prio 4 bounded isolated allot 1514

# local traffic on 11:9

tc class add dev eth0 parent 11:0 classid 11:9 cbq bandwidth 10Mbit rate
10Mbit prio 4 bounded allot 1514

# interactive traffic

tc class add dev eth0 parent 11:1 classid 11:2 cbq bandwidth 512kbit rate
171Kbit prio 1 bounded isolated allot 1514

# batch

tc class add dev eth0 parent 11:1 classid 11:3 cbq bandwidth 512kbit rate
442Kbit prio 8 bounded isolated allot 1514

tc class add dev eth1 parent 12:0 classid 12:1 cbq bandwidth 10Mbit rate
512Kbit prio 4 bounded isolated allot 1514

tc class add dev eth1 parent 12:1 classid 12:2 cbq bandwidth 512kbit rate
171Kbit prio 1 bounded isolated allot 1514

tc class add dev eth1 parent 12:1 classid 12:3 cbq bandwidth 512kbit rate
442Kbit prio 8 bounded isolated allot 1514

tc class add dev eth1 parent 12:0 classid 12:9 cbq bandwidth 10Mbit rate
10Mbit prio 4 bounded allot 1514

# Add sfq for fairness

tc qdisc add dev ppp0 parent 10:2 sfq quantum 1514b perturb 15

tc qdisc add dev ppp0 parent 10:3 sfq quantum 1514b perturb 15

tc qdisc add dev eth0 parent 11:2 sfq quantum 1514b perturb 15

tc qdisc add dev eth0 parent 11:3 sfq quantum 1514b perturb 15

tc qdisc add dev eth0 parent 11:9 sfq quantum 1514b perturb 15

tc qdisc add dev eth1 parent 12:2 sfq quantum 1514b perturb 15

tc qdisc add dev eth1 parent 12:3 sfq quantum 1514b perturb 15

tc qdisc add dev eth1 parent 12:9 sfq quantum 1514b perturb 15

#Use marks to allocate to queues

tc filter add dev ppp0 parent 10:0 protocol ip handle 3 fw flowid 10:2

tc filter add dev ppp0 parent 10:0 protocol ip handle 4 fw flowid 10:3

tc filter add dev eth0 parent 11:0 protocol ip handle 3 fw flowid 11:2

tc filter add dev eth0 parent 11:0 protocol ip handle 4 fw flowid 11:3

tc filter add dev eth0 parent 11:0 protocol ip handle 9 fw flowid 11:9

tc filter add dev eth1 parent 12:0 protocol ip handle 3 fw flowid 12:2

tc filter add dev eth1 parent 12:0 protocol ip handle 4 fw flowid 12:3

tc filter add dev eth1 parent 12:0 protocol ip handle 9 fw flowid 12:9

for dev in eth0 eth1 ppp0

Nigel Jones



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

             reply	other threads:[~2002-02-09 16:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-09 16:49 Nigel Jones [this message]
2002-02-09 22:45 ` [LARTC] shaping from ethernets to adsl Martin Devera
2002-02-10  2:25 ` Ross Skaliotis
2002-02-10 10:40 ` Martin Devera
2002-02-11 22:22 ` Nigel Jones
2002-02-12 10:40 ` Martin Devera

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-101327339318927@msgid-missing \
    --to=jonesn@hursley.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox