Skip to contentSkip to conversation

iproute question

LARTC Pascal Girard 2 participants 2 messages Apr 4, 2003

lore
Share & tools
lore
#0 lore raw

Hello all,

My company is sharing it's internet access with a neighbor and the neighbor in question was eating our bandwidth (both in upload and download) most of the time. I finally set up a linux router to limit the incoming/outgoing bandwidth to his network by adding a tbf on eth0 interface and eth1 interface of the router (neighbor is behind eth1 and we are in-between him and the rest of the world on eth0):
tc qdisc add dev eth0 root tbf limit 40K rate 1Mbit burst 16K
tc qdisc add dev eth1 root tbf limit 40K rate 1Mbit burst 16K

The only problem is that I can't specify a total bandwidth for our neighbor. What I want to do exactly is specify that all traffic bound for eth1 is limited to 1Mbit instead of having 2 separate 1Mbit qdiscs...

I tried looking at adding an ingress filter with classes on eth1 and removing the tbf on eth0 but the notions are a bit confusing to me.

Can anybody give me examples on how I could do this?

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

#1 lore raw
Quoted 11 lines · Pascal Girard

Hello all,

My company is sharing it's internet access with a neighbor and the neighbor in question was eating our bandwidth (both in upload and download) most of the time. I finally set up a linux router to limit the incoming/outgoing bandwidth to his network by adding a tbf on eth0 interface and eth1 interface of the router (neighbor is behind eth1 and we are in-between him and the rest of the world on eth0):
tc qdisc add dev eth0 root tbf limit 40K rate 1Mbit burst 16K tc qdisc add dev eth1 root tbf limit 40K rate 1Mbit burst 16K

Quoted 8 lines

The only problem is that I can't specify a total bandwidth for our neighbor. What I want to do exactly is specify that all traffic bound for eth1 is limited to 1Mbit instead of having 2 separate 1Mbit qdiscs...

I tried looking at adding an ingress filter with classes on eth1 and removing the tbf on eth0 but the notions are a bit confusing to me.

Can anybody give me examples on how I could do this?

So you want incoming + outgoing traffic to/from eth1 together bounded to 1mbit? Then you need the imq device. It's a patch for the kernel so you can create a virtual device and a patch for iptables so you can redirect traffic to that device. If you redirect incoming and outgoing traffic to the imq device and limit the speed of the imq device to 1mbit, you have contol on both in and out.

Stef

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

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