next up previous
Next: Example - 2 : Up: Linux - Advanced Networking Previous: u32 Classifiers

Example - 1 : CBQ with route classifiers

Let us consider a very simple scenario. Lets set up a CBQ for an ethernet device on testbed14 (129.237.125.149). Lets assume that the average packet size is 1000, a cell value of 8 bytes and a maximum burst size of 20 bytes. Lets have two types of classes, one for traffic to the machine 129.237.125.146 (testbed11) and for the traffic to machine 129.237.125.148 (testbed13). The traffic to testbed11 is given a higher priority over the traffic to testbed 13. However, testbed11 requires a bandwidth of only 3 Mbps while testbed13 requires a bandwidth of 7 Mbps.

This example explains classification based on the routing table. The environment set up is shown in Figure 9.

Figure 9: Linux QoS Support - Example 1
\begin{figure}
\centerline{\psfig{file=figures/example1.eps,width=4.0in}}\end{figure}

To set up this environment in testbed14.

# Attaching the Qdisc to the eth0 device.  The maximum available bandwidth is
# 10Mbit. 
tc qdisc add dev eth0 root handle 1: cbq bandwidth 10Mbit cell 8 avpkt 1000 \
mpu 64

# Adding the root class to the queuing discipline. The root has 10 Mbit
# completely. 
tc class add dev eth0 parent 1:0 classid 1:1 cbq bandwidth 10Mbit rate 10Mbit \
allot 1514 cell 8 weight 1Mbit prio 8 maxburst 20 avpkt 1000

# Traffic to testbed11. The priority is 3 and the allocation is 3 Mbit. 
tc class add dev eth0 parent 1:1 classid 1:2 cbq bandwidth 10Mbit rate 3Mbit \
allot 1514 cell 8 weight 100Kbit prio 3 maxburst 20 avpkt 1000 split 1:0 

# Traffic to testbed13. The priority is 7 and the allocation is 7 Mbit. 
tc class add dev eth0 parent 1:1 classid 1:3 cbq bandwidth 10Mbit rate 8Mbit \
allot 1514 cell 8 weight 800Kbit prio 7 maxburst 20 avpkt 1000 split 1:0

# Installing the route classifier on the root of the tree. 
tc filter add dev eth0 parent 1:0 protocol ip prio 100 route

# Assigning the route and the rules for testbed11
ip route add 129.237.125.146 via 129.237.125.149 flow 1:2

# Assigning the route and the rules for testbed13
ip route add 129.237.125.148 via 129.237.125.149 flow 1:3

Note that none of the classes are specified as bounded which means that the classes can borrow bandwidth from the parent.



Saravanan Radhakrishnan
1999-09-30