[LARTC] shaping from ethernets to adsl

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Martin Devera" <devik@cdi.cz> wrote in message
Pine.LNX.4.10.10202092343330.15162-100000@luxik.cdi.cz">news:Pine.LNX.4.10.10202092343330.15162-100000@luxik.cdi.cz...
> > 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?
>
> Unfortunately yes. If you want to limit sum of two-interface output
> then you can use my IMQ patch. Vanilla kernel can't do it.

Martin,
 Many thanks. I've download the patch (with htb2), and can see that if I run
ifconfig imq up
 then the packets appear to get enqueued/dequeued via this new virtual
device imq

So I could create filters on the imq device

So what rate do I specify to htb? 10Mbs?
Do I create a 10Mbs class & try to use this for eth0-eth1 comms? via
iptables --set-mark?
And a 512Mbs class as a wrapper for all ppp->eth0,1 traffic (adsl download)
And a 256Mbs class for all eth0,1->ppp (adsl upload)

Then within each class subdivide as per my requirements.

Is this the approach to take?

This is my attempt so far - does this make sense?
(It doesn't seem to work....)
PATH=/usr/local/bin:$PATH

ifconfig imq up

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

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

# INBOUND - 1x OUTBOUND - 2x LOCAL - 3x

# small packets - mark with 3

# These rules don't seem to work. I want the -s & -m ANDED

iptables -t mangle -A OUTPUT -s 192.168.0.1/16 -m length --length 0:500 -j
MARK --set-mark 11

iptables -t mangle -A OUTPUT -s 192.168.0.1/16 -m length --length
500:15000 -j MARK --set-mark 14

iptables -t mangle -A OUTPUT -d 192.168.0.1/16 -m length --length 0:500 -j
MARK --set-mark 21

iptables -t mangle -A OUTPUT -d 192.168.0.1/16 -m length --length
500:15000 -j MARK --set-mark 24

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

#

# root queueing discipline

tc qdisc add dev imq root handle 10: htb default 10

# Base classes for ethernet (10Mbs), adsl up (256), adsl down (512). No
borrowing

tc class add dev imq parent 10: classid 10:10 htb rate 10Mbps ceil 10Mbps
burst 2k prio 3

tc class add dev imq parent 10: classid 10:20 htb rate 512kbps ceil 512kbps
burst 2k prio 3

tc class add dev imq parent 10: classid 10:30 htb rate 256kbps ceil 256kbps
burst 2k prio 3

#

tc class add dev imq parent 10:20 classid 10:21 htb rate 400kbps ceil
500kbps burst 2k prio 4

tc class add dev imq parent 10:20 classid 10:22 htb rate 112kbps ceil
512kbps burst 2k prio 1

tc class add dev imq parent 10:30 classid 10:31 htb rate 200kbps ceil
250kbps burst 2k prio 4

tc class add dev imq parent 10:30 classid 10:32 htb rate 50kbps ceil 250kbps
burst 2k prio 1

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

tc qdisc add dev imq parent 10:21 sfq quantum 1514b perturb 15

tc qdisc add dev imq parent 10:22 sfq quantum 1514b perturb 15

tc qdisc add dev imq parent 10:31 sfq quantum 1514b perturb 15

tc qdisc add dev imq parent 10:32 sfq quantum 1514b perturb 15

tc filter add dev imq parent 10: protocol ip handle 31 fw flowid 10:10

tc filter add dev imq parent 10: protocol ip handle 11 fw flowid 10:32

tc filter add dev imq parent 10: protocol ip handle 14 fw flowid 10:31

tc filter add dev imq parent 10: protocol ip handle 21 fw flowid 10:22

tc filter add dev imq parent 10: protocol ip handle 24 fw flowid 10:21



Also a "tc -s class ls dev imq" shows rates that don't match these rules ie:

class htb 10:22 parent 10:20 leaf 803a: prio 1 rate 896Kbit ceil 4Mbit burst
2Kb cburst 6841b

Sent 152 bytes 2 pkts (dropped 0, overlimits 0)

lended: 2 borrowed: 0 giants: 0 injects: 0

tokens: 14115 ctokens: 10578

class htb 10:10 root leaf 8038: prio 3 rate 80Mbit ceil 80Mbit burst 2Kb
cburst 106440b

Sent 56598 bytes 583 pkts (dropped 0, overlimits 0)

rate 719bps 5pps

lended: 583 borrowed: 0 giants: 0 injects: 0

tokens: 153 ctokens: 8310

class htb 10:32 parent 10:30 leaf 803c: prio 1 rate 400Kbit ceil 2000Kbit
burst 2Kb cburst 4159b

Sent 0 bytes 0 pkts (dropped 0, overlimits 0)

lended: 0 borrowed: 0 giants: 0 injects: 0

tokens: 32768 ctokens: 13311

class htb 10:20 root prio 3 rate 4Mbit ceil 4Mbit burst 2Kb cburst 6841b

Sent 152 bytes 2 pkts (dropped 0, overlimits 0)

lended: 0 borrowed: 0 giants: 0 injects: 0

tokens: 3087 ctokens: 10578

class htb 10:31 parent 10:30 leaf 803b: prio 3 rate 1600Kbit ceil 2000Kbit
burst 2Kb cburst 4159b

Sent 0 bytes 0 pkts (dropped 0, overlimits 0)

lended: 0 borrowed: 0 giants: 0 injects: 0

tokens: 8192 ctokens: 13311

class htb 10:30 root prio 3 rate 2Mbit ceil 2Mbit burst 2Kb cburst 4220b

Sent 0 bytes 0 pkts (dropped 0, overlimits 0)

lended: 0 borrowed: 0 giants: 0 injects: 0

tokens: 6399 ctokens: 13189

class htb 10:21 parent 10:20 leaf 8039: prio 3 rate 3200Kbit ceil 4000Kbit
burst 2Kb cburst 6719b

Sent 0 bytes 0 pkts (dropped 0, overlimits 0)

lended: 0 borrowed: 0 giants: 0 injects: 0

tokens: 4096 ctokens: 10752



--
--
jonesn@hursley.ibm.com





[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux