[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

probs assigning rules



To better understand the software, I was playing with examples 1 and 2
from Linux - Advanced Networking Overview
(http://qos.ittc.ukans.edu/howto/index.html)

All the 'tc' commands work fine, but I have trouble assigning rules to
routes using the 'ip' tool. Here is what happens:

	% ip route add 192.4.20.222 via 192.4.20.232 flow 1:2
	Error: either "to" is duplicate, or "flow" is a garbage.

The following is the output of 'ip route':

192.4.20.0/24 dev eth0  proto kernel  scope link  src 192.4.20.232 
127.0.0.0/8 dev lo  scope link 
default via 192.4.20.1 dev eth0 


Below is the entire script I use to execute example 1:

#! /bin/sh

# Armando L. Caro Jr.
# 6/8/2000.12:45
#
# This script is based on Example 1 found in Linux - Advanced Networking
# Overview (http://qos.ittc.ukans.edu/howto/index.html)
#
# Purpose: To test and understand diffserv installation more thorougly.


TC=/usr/local/sbin/tc
IP=/usr/local/sbin/ip

HOME_IP=192.4.20.232

# Kauchik's machine
HOST_A_IP=192.4.20.222
HOST_A_PORT1=0x177a      # port 6010
HOST_A_PORT2=0x177b      # port 6011

# Kyriakos' machine
HOST_B_IP=192.4.20.236
HOST_B_PORT1=0x177a      # port 6010
HOST_B_PORT2=0x177b      # port 6011

initialize()
{
   # 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 the complete 
   # 100 Mbit bandwidth.
   #
   $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 host A. The priority is 3 and the allocation is 3 Mbit. Note
   # that it is set to bounded because of the strict link sharing rules.
   #
   $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 host B. The priority is 7 and the allocation is 7 Mbit.  Note
   # that it is set to bounded because of the strict link sharing rules. 
   #
   $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 host A
   $IP route add $HOST_A_IP via $HOME_IP flow 1:2

   # Assigning the route and the rules for host B
   $IP route add $HOST_B_IP via $HOME_IP flow 1:3
}

take_down()
{
   # Detaching the Qdisc from the eth0 device.
   #
   $TC qdisc del dev eth0 root handle 1: cbq bandwidth 10Mbit cell 8 \
      avpkt 1000 mpu 64
}

# See how we were called.
case "$1" in
   start)
      printf "Initializing..."
      initialize
      printf "   Done.\n"
      ;;
   stop)
      printf "Deleting all entries..."
      take_down
      printf "   Done.\n"
      ;;
   restart)
      printf "Restarting... \n"
      printf "   Stopping..."
      take_down
      printf "   Done.\n"
      printf "   Starting..."
      initialize
      printf "   Done.\n"
      ;;
   *)
      printf "Usage: $0 {start|stop|restart} \n"
      exit 1
esac