Sunday, May 4, 2008

traffic control ... learning tc

Well, what do i want to do today, i want to try to distribute traffic in a fair way between clients on my network, so it seemed as a starting point i should start playing with tc.

So i started reading tc man page thoroughly, after a while of playing around with it i tried creating a qdisc using
tc qdisc add dev eth1 root pfifo
notice that anything less didnt work with me ! that went fine, now i want to view what i did, and the command tc qdisc show dev eth1 did it fine, now i tried to delete the qdisc i created using tc qdisc del dev eth1 root and it went well too.

Now i tried tc qdisc show dev eth1 and apparently there is a qdisc there!! i try to delete that but i get RTNETLINK answers: No such file or directory !!! later i realized this is probably a mandatory qdisk for every interface ... although found nothing about it in the man page, but a quick google search for "default qdisc" yielded this very informative link.

Now, what i understand so far that we have 3 elements working together, qdisc, class and rule ... and to put it in simple words, i think that qdisc ( a general framework for what we are talking about ) classifies packets into classes using some rules, and decides later according to the classification which packets should go out to the network interface.

As Expected, a year and a half later (sep 2009), i get back to reading on the topic, and i have no clue where i got the word rule! the word is "filter"!

this time i have used tc actually, i used iptables to "mark" certain packets, which then a tc "filter" captured them and sent them to a "class" that limits the bandwidth !!

No comments: