Skip to contentSkip to conversation

shapping over the same interface

LARTC Fernando Sancho 2 participants 2 messages Dec 19, 2003

lore
Share & tools
lore
#0 lore raw

Hi all
I'm new to the list and new to tc

I'm triying to shape incoming and outgoing traffic for every IP in a LAN. I'm using cbq classes because i need to use cbq.init script (partner's restrictions). Well, according to cbq.init documentation i have to define two classes for every IP

#cbq-0002-incoming-192.168.0.2
DEVICE=eth0,10Mbit,1Mbit
RULE=,192.168.0.2
BOUNDED=yes
PRIO=5
RATE=256Kbit
WEIGHT=25.6Kbit
LEAF=sfq

#cbq-0003-outgoing-192.168.0.2
DEVICE=eth0,10Mbit,1Mbit
RULE=192.168.0.2,
BOUNDED=yes
PRIO=5
RATE=64Kbit
WEIGHT=6.4Kbit
LEAF=sfq

The behavior of this es very extrange because all traffic from and to 192.168.0.2 is shaped by cbq-0002-incoming-192.168.0.2

The code equivalent to that classes is this:
----------------------------
tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1 cbq bandwidth 10Mbit avpkt 1000 cell 8
tc class change dev eth0 root cbq weight 1Mbit allot 1514

tc class add dev eth0 parent 1: classid 1:2 cbq bandwidth 10Mbit rate 256Kbit weight 25.6 prio 5 allot 1514 cell 8 maxburst 20 avpkt 1000 bounded
tc qdisc add dev eth0 parent 1:2 handle 2 sfq perturb 10
tc filter add dev eth0 parent 1:0 protocol ip prio 100 u32 match ip dst 192.168.0.2 classid 1:2

tc class add dev eth0 parent 1: classid 1:3 cbq bandwidth 10Mbit rate 64Kbit weight 6.4Kbit prio 5 allot 1514 cell 8 maxburst 20 avpkt 1000 bounded
tc qdisc add dev eth0 parent 1:3 handle e sfq perturb 10
tc filter add dev eth0 parent 1:0 protocol ip prio 100 u32 match ip src 192.168.0.2 classid 1:3
------------------------------

I don't know why a IP packet with src IP=192.168.0.2 is captured by a filter who says very clear that it will only takes packets where dst IP is 192.168.0.2

I'm using RedHat 7.3 with default kernel (2.4.18-13), another time, partner's restricctions, eth0 is the private side of the gateway.

Thanks in advance.

PD: Sorry about my broken english.

Signature · 6 lines
Fernando Sancho Glez-Calero
E.S. de Informática de Ciudad Real
Universidad de Castilla la Mancha
Profesor Asociado
Dpto. Arquitectura y Redes de Computadores.
Tlf: +34 926295300 ext:6216, 3705, 6217
#1 lore raw
Quoted 7 lines · Fernando Sancho

Hi all
I'm new to the list and new to tc

I'm triying to shape incoming and outgoing traffic for every IP in a LAN. I'm using cbq classes because i need to use cbq.init script (partner's restrictions). Well, according to cbq.init documentation i have to define two classes for every IP

But you have to do this in a router with 2 network cards. You can only shape outgoing traffic, so you need to 2 network cards if you want to shape in both directions.
You can limit incoming traffic with the ingress qdisc. This is not so powerfull as cbq, but you can limit some connections.

Stef

Signature · 8 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.openprojects.net

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/