Linux - The route classifier

Posted in How To's by Shafkat Shahzad, M.Sc on February 26th, 2010

Welcome to the tutorial guide. The tutorial guide will provide a user with guidance and instructions about the route classifier.

Please note that the route classifier filters based on the results of the routing tables. When a packet that is traversing through the classes reaches one that is marked with the “route” filter, it splits the packets up based on information in the routing table.
# tc filter add dev eth1 parent 1:0 protocol ip prio 100 route
A user can add a route classifier onto the parent node 1:0 with priority 100 as you can see in the mentioned example. When a packet reaches this node, it will consult the routing table. If the packet matches, it will be send to the given class and have a priority of 100. Please note that in order to action this a user needs to add the appropriate routing entry:
A user can define the realm based on either destination or source. It is easy to do it like this:
# ip route add Host/Network via Gateway dev Device realm RealmNumber
If a user wants to define the destination network 192.168.10.0 with a realm number 10, then it an be done as shown below:
# ip route add 192.168.10.0/24 via 192.168.10.1 dev eth1 realm 10
When adding route filters, a user can use realm numbers to represent the networks or hosts and specify how the routes match the filters.
# tc filter add dev eth1 parent 1:0 protocol ip prio 100 \
route to 10 classid 1:10
This rule matches the packets going to the network 192.168.10.0.
Please note that a route filter can be used to match source routes. For example, there is a subnetwork attached to the Linux router on eth2.
# ip route add 192.168.2.0/24 dev eth2 realm 2
# tc filter add dev eth1 parent 1:0 protocol ip prio 100 \
route from 2 classid 1:2
In this case the filter specifies that packets from the subnetwork 192.168.2.0 (realm 2) will match class id 1:2.
If you followed advise and guidance as provided in this tutorial guide then you would have learnt about the route classifier.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

Leave a Comment