On 3 Oct 2000, Josip Gracin wrote: > Hello! > > I'm trying to figure out how to use traffic control in Linux. I've read > several documents and READMEs but I can't make the following work: > How do I reduce the capacity of my ethernet card/link? > > Basically, what I need is to create a class that would cover all (outgoing > IP) packets, and rate-limit it to some bandwidth. So, it's a simple > traffic shaper. > > I expect it should be something like a three-liner that looked like this: > > tc qdisc add dev eth0 .... > tc class add dev eth0 .... > tc filter add dev eth0 ... I don't know for sure if this is required or not, but here's a full example. I know it works, I don't know why. setup the Bandwidth Management tc qdisc add dev eth0 root handle 10: cbq bandwidth 10Mbit avpkt 1000 # Setup the root Class at 10Mbit tc class add dev eth0 parent 10:0 classid 10:1 cbq bandwidth 10Mbit rate\ 10Mbit allot 1514 weight 1Mbit prio 8 maxburst 100 avpkt 1000 # Setup Rachel class with a rate of 500Kbit ( sucks to be her ) tc class add dev eth0 parent 10:1 classid 10:200 cbq bandwidth 10Mbit\ rate 500Kbit allot 1514 weight 50Kbit prio 7 maxburst 20 avpkt 1000\ bounded # Setup the class for Dad's computer tc class add dev eth0 parent 10:1 classid 10:300 cbq bandwidth 10Mbit\ rate 500Kbit allot 1514 weight 50Kbit prio 5 maxburst 20 avpkt 1000\ bounded # Limit to 2.5k/sec with a 70Kb buffer #tc qdisc add dev eth0 parent 10:200 tbf rate 20000 buffer 70Kb limit 80Kb #tc qdisc add dev eth0 parent 10:300 tbf rate 20000 buffer 70Kb limit 80Kb # Bind the Flows to ip addresses tc filter add dev eth0 parent 10:0 protocol ip prio 100 u32 match ip dst\ 192.168.0.20 flowid 10:200 tc filter add dev eth0 parent 10:0 protocol ip prio 100 u32 match ip dst\ 192.168.0.21 flowid 10:300 - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org