From: "Leigh Sharpe" Date: Mon, 28 Aug 2006 04:09:48 +0000 Subject: [LARTC] Applying the same class to multiple interfaces Message-Id: MIME-Version: 1 Content-Type: multipart/mixed; boundary="===============1973854970==" List-Id: To: lartc@vger.kernel.org --===============1973854970== Content-Type: multipart/alternative; boundary="2_0_1b5_1c9f46MHTML_=_01" --2_0_1b5_1c9f46MHTML_=_01 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi All, I'm trying to do some traffic shaping on an ethernet bridge. Currently, I have the following setup working: =20 ifconfig eth0 down brctl addbr br0 brctl addif br0 eth0 brctl addif br0 eth1 brctl stp br0 off ifconfig eth0 0.0.0.0 up ifconfig eth1 0.0.0.0 up ifconfig br0 up This creates a bridge consisting of eth0 and eth1. So far so good. =20 I now want to use tc to shape traffic through this bridge. By applying the following, I am able to limit the given MAC address to 128K in each direction: =20 tc qdisc add dev eth0 root handle 1:0 cbq bandwidth 100Mbit avpkt 1000 mpu 64 tc qdisc add dev eth1 root handle 1:0 cbq bandwidth 100Mbit avpkt 1000 mpu 64 tc class add dev eth0 parent 1:0 classid 1:1 cbq rate 128Kbit allot 1514 prio 1 avpkt 1000 bounded tc class add dev eth1 parent 1:0 classid 1:1 cbq rate 128Kbit allot 1514 prio 1 avpkt 1000 bounded tc filter add dev eth0 parent 1:0 protocol ip handle 1 fw flowid 1:1 tc filter add dev eth1 parent 1:0 protocol ip handle 1 fw flowid 1:1 ebtables -A FORWARD -s 00:10:A4:EC:65:E8 -j mark --set-mark 1 --mark-target ACCEPT ebtables -A FORWARD -d 00:10:A4:EC:65:E8 -j mark --set-mark 1 --mark-target ACCEPT This works OK, but it isn't quite what I want. I want to limit the traffic to 128K total. ie, 128K in one direction or the other, or 64K in each direction simultaneously, or 100K in one direction and 28K in the other, etc... I can't see anything in the tc docs which indicates that I can apply the same class and filter to multiple interfaces at once. I'd be happy enough with applying the same rate limit to a single interface, but measuring both ingress and egress traffic to come up with the lmit. =20 Ultimately, of course, I'll be using different criteria to mark the packets. =20 =20 Regards, Leigh =20 Leigh Sharpe Network Systems Engineer Pacific Wireless Ph +61 3 9584 8966 Mob 0408 009 502 email lsharpe@pacificwireless.com.au web www.pacificwireless.com.au =20 --2_0_1b5_1c9f46MHTML_=_01 Content-Type: text/html Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Hi=20 All,
I'm try= ing to do=20 some traffic shaping on an ethernet bridge. Currently, I have the followi= ng=20 setup working:
 
ifconfi= g eth0=20 down
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1brctl=20 stp br0 off
ifconfig eth0 0.0.0.0 up
ifconfig eth1 0.0.0.0 up
if= config=20 br0 up
This cr= eates a=20 bridge consisting of eth0 and eth1. So far so good.
 
I now w= ant to use tc=20 to shape traffic through this bridge. By applying the following, I am abl= e to=20 limit the given MAC address to 128K in each direction:
 
tc qdis= c add dev=20 eth0 root handle 1:0 cbq bandwidth 100Mbit avpkt 1000 mpu 64
tc qdisc a= dd dev=20 eth1 root handle 1:0 cbq bandwidth 100Mbit avpkt 1000 mpu 64
tc class a= dd dev=20 eth0 parent 1:0 classid 1:1 cbq rate 128Kbit allot 1514 prio 1 avpkt 1000= =20 bounded
tc class add dev eth1 parent 1:0 classid 1:1 cbq rate 128Kbit a= llot=20 1514 prio 1 avpkt 1000 bounded
tc filter add dev eth0 parent 1:0 proto= col ip=20 handle 1 fw flowid 1:1
tc filter add dev eth1 parent 1:0 protocol ip h= andle 1=20 fw flowid 1:1
ebtable= s -A FORWARD=20 -s 00:10:A4:EC:65:E8 -j mark --set-mark 1 --mark-target ACCEPT
ebtable= s -A=20 FORWARD -d 00:10:A4:EC:65:E8 -j mark --set-mark 1 --mark-target=20 ACCEPT
This wo= rks OK, but=20 it isn't quite what I want. I want to limit the traffic to 128K total. ie= , 128K=20 in one direction or the other, or 64K in each direction simultaneously, o= r 100K=20 in one direction and 28K in the other, etc...
 I= can't see=20 anything in the tc docs which indicates that I can apply the same class a= nd=20 filter to multiple interfaces at once.
I'd be h= appy enough=20 with applying the same rate limit to a single interface, but measuring bo= th=20 ingress and egress traffic to come up with the lmit.
 
Ultimat= ely, of=20 course, I'll be using different criteria to mark the=20 packets.
 
 
Regards,
        &nbs= p;   =20 Leigh
 
Leigh Sharpe
Network Systems Engineer=
Pacific=20 Wireless
Ph +61 3 9584 8966
Mob 0408 009 502
email lsharpe@pacificwi= reless.com.au
web=20 www.pacificwireless.= com.au
 
--2_0_1b5_1c9f46MHTML_=_01-- --===============1973854970== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc --===============1973854970==--