Hi! I''m trying to shape a traffic to/from a few different subnets using TBF. The way I understand it all I have to do is create a few queueing disciplines and attach a filter to each queueing discipline. So for instance if I want to shape traffic going to 192.168.1.0/24 via eth0 to 64kbit then it should look like this: ------------< snip <------< snip <------< snip <------------ tc qdisc add dev eth0 root handle 1:0 tbf rate 64kbit burst 4kb latency 100ms peakrate 128kbit mtu 1500 tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip dst 192.168.1.0/24 ------------< snip <------< snip <------< snip <------------ I can''t add the filter above and I suspect it is due to a) i can''t add filters to tbf queueing disciplines? if so, why not? b) i''m confused be the parent x:y and flowid a:b terminology in the filter. When do I use what? -- Regards Abraham Anyone can hold the helm when the sea is calm. -- Publius Syrus ___________________________________________________ Abraham vd Merwe [ZR1BBQ] - Frogfoot Networks P.O. Box 3472, Matieland, Stellenbosch, 7602 Cell: +27 82 565 4451 Http: http://www.frogfoot.net Email: abz@frogfoot.net
On Saturday 16 November 2002 19:34, Abraham van der Merwe wrote:> Hi! > > I''m trying to shape a traffic to/from a few different subnets using TBF. > The way I understand it all I have to do is create a few queueing > disciplines and attach a filter to each queueing discipline. > > So for instance if I want to shape traffic going to 192.168.1.0/24 via eth0 > to 64kbit then it should look like this: > > ------------< snip <------< snip <------< snip <------------ > tc qdisc add dev eth0 root handle 1:0 tbf rate 64kbit burst 4kb latency > 100ms peakrate 128kbit mtu 1500 > > tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip dst > 192.168.1.0/24 > ------------< snip <------< snip <------< snip <------------ > > I can''t add the filter above and I suspect it is due to > > a) i can''t add filters to tbf queueing disciplines? if so, why not?Because the tbf qdisc is classless. And filter are used to put packets in a child class. CBQ/HTB are examples of classfull qdiscs. You add a tbf qdisc as the root qdisc. The root qdisc contains ALL packets that are sended. So you don''t need filters.> b) i''m confused be the parent x:y and flowid a:b terminology in the filter. > When do I use what?Parent is the class where you add the filter. If you have class 10:1 and you want to add a filter to class 10:1, you have to use parent 10:1. When the filter matches a packet, it''s placed in the class you specify with flowid. If you have class 10:1 with class 10:10 attached to it and you want to redirect packets to it, you have to specify "parent 10:1 flowid 10:10" in the filter command. Stef -- stef.coene@docum.org "Using Linux as bandwidth manager" http://www.docum.org/ #lartc @ irc.oftc.net _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Hi Stef!> > I''m trying to shape a traffic to/from a few different subnets using TBF. > > The way I understand it all I have to do is create a few queueing > > disciplines and attach a filter to each queueing discipline. > > > > So for instance if I want to shape traffic going to 192.168.1.0/24 via eth0 > > to 64kbit then it should look like this: > > > > ------------< snip <------< snip <------< snip <------------ > > tc qdisc add dev eth0 root handle 1:0 tbf rate 64kbit burst 4kb latency > > 100ms peakrate 128kbit mtu 1500 > > > > tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip dst > > 192.168.1.0/24 > > ------------< snip <------< snip <------< snip <------------ > > > > I can''t add the filter above and I suspect it is due to > > > > a) i can''t add filters to tbf queueing disciplines? if so, why not? > Because the tbf qdisc is classless. And filter are used to put packets in a > child class. CBQ/HTB are examples of classfull qdiscs. > You add a tbf qdisc as the root qdisc. The root qdisc contains ALL packets > that are sended. So you don''t need filters.Ok, so how do you do what I want to do in the example above using the TBF queuing discipline? All the examples I''ve seen so far uses CBQ, but that is not what I want since I don''t want to specify the size of my interface/bandwidth (which is not needed to shape networks). I obviously need a classful queuing displine so that I can make lots of sibling classes with filters attached to each one (with each filter''s flowid pointing to a tbf qdisc in that class), but the question then is which queuing discipline should I use for this "container queueing discipline"?> > b) i''m confused be the parent x:y and flowid a:b terminology in the filter. > > When do I use what? > Parent is the class where you add the filter. If you have class 10:1 and you > want to add a filter to class 10:1, you have to use parent 10:1. > When the filter matches a packet, it''s placed in the class you specify with > flowid. If you have class 10:1 with class 10:10 attached to it and you want > to redirect packets to it, you have to specify "parent 10:1 flowid 10:10" in > the filter command.Thanks. This helps a lot. -- Regards Abraham QOTD: "My shampoo lasts longer than my relationships." ___________________________________________________ Abraham vd Merwe [ZR1BBQ] - Frogfoot Networks P.O. Box 3472, Matieland, Stellenbosch, 7602 Cell: +27 82 565 4451 Http: http://www.frogfoot.net Email: abz@frogfoot.net
> Ok, so how do you do what I want to do in the example above using the TBF > queuing discipline? All the examples I''ve seen so far uses CBQ, but that is > not what I want since I don''t want to specify the size of my > interface/bandwidth (which is not needed to shape networks).Cbq needs to know the NIC bandwidth for the internal calculations. If you have 10Mbit nic, you have to specify 10mbit. This is just for the calculations. Htb does not need this.> I obviously need a classful queuing displine so that I can make lots of > sibling classes with filters attached to each one (with each filter''s > flowid pointing to a tbf qdisc in that class), but the question then is > which queuing discipline should I use for this "container queueing > discipline"?You need to use htb or cbq for it. And you don''t need the tbf to throttle the bandwidth. You can throttle the bandwidth of a class with htb or cbq itself. The classes are not reponsible for sending the packets, it''s the qdisc attached to them that do this job. So all packets in the class, will get sended by the qdisc, so you don''t need a filter to do this. Stef -- stef.coene@docum.org "Using Linux as bandwidth manager" http://www.docum.org/ #lartc @ irc.oftc.net _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/