Diff-Serv capability in Zebra

                                  Saravanan Radhakrishnan, Deepak Sreenivasamurthy

This project makes  zebra,  a distributed routing software, diffserv capable. This means that zebra will now be capable of configuring an interface for differentiated services. We have implemented the assured forwarding and expedited forwarding per hop behaviors (PHBs).

The assured forwarding PHB that we have implemented can be configured to have any number of classes and any number of drop precedences within each class. This is different from the standard, which recommends that there be four AF Classes and three drop precedences within each class. This feature is provided so that the local networks can provide more AF classes and drop precedences, should the need arise.

Assured Forwarding Configuration

The configuration of a network device  in a linux box to do assured forwarding would result in the creation of certain queues, classes and filters for the specified device. The steps involved in the configuration of assured forwarding PHB is explained below, along with the corresponding queues/classes/filters that are created in the process.

Since the PHB is set for packets going out on a particular interface, the diffserv functions are added to the interface mode of the configuration.

comet# configure terminal
comet(config)# interface eth0
comet(config-if)# ?
  description       Set interface description
  diffserv             Configure the interface for differentiated Services
  end                    End current mode and change to enable mode.
  exit                     Exit current mode and down to previous mode
  help                   Description of the interactive help system
  ip                        Interface Internet Protocol config commands
  multicast         Set multicast flag to interface
  no                      Negate a command or set its defaults
  shutdown        Shutdown the selected interface

The 'diffserv' command above is used to initiate the diffserv configuration.

comet(config-if)# diffserv
comet(config-if-diffserv)#?
assured-forwarding  Set up assured forwarding parameters
end                                End diffserv mode and change to enable mode.
exit                                Exit current mode and down to previous mode
max-bandwidth       Set the maximum available bandwidth at the output link

In the diff-serv mode, we first set the maximum available bandwidth for the output link. This is done in the following manner

comet(config-if-diffserv)# max-bandwidth 10Mbit

To configure AF parameters, we need to go into the assured-forwarding mode, which we do so by typing the command 'assured-forwarding' in the diff-serv mode.

comet(config-if-diffserv)# assured-forwarding
comet(config-if-diffserv-af)#

This above command will result in the creation of a dsmark queuing discipline that will be used to set and store the DSCP of the outgoing and incoming packets respectively. This will also result in the creation of a filter that will be used to mask out the first six bits  in the TOS byte of IP header and shift the result obtained right by two positions to obtain the codepoint.

The asssured forwarding configuration mode offers a set of functions that can be used to set up the AF classes and the corresponding drop precedences within each class. As already specified, the number of AF classes as well as the number of drop precedences within each class can be configured. The list of commands that are supported for the configuration of AF are shown below.

comet(config-if-diffserv-af)# ?
  end                               End af mode and change to enable mode
  exit                               Exit af mode and change to diffserv mode
  max-bandwidth      Maximum available bandwidth for Assured Forwarding
  number-of-classes Number of AF classes
  setafparams              Set the priority and bandwidth for an AF class
  setdp                           The number of drop precedences
  setdpparam               Set the parameters for the drop precedences

The first AF configuration command that needs to be set is the max-bandwidth command. This is used to specify the maximum bandwidth that needs to be allocated for AF PHB. The command number-of-classes is used to specify the number of AF classes that need to be set up.

comet(config-if-diffserv-af)# max-bandwidth 10Mbit
comet(config-if-diffserv-af)# number-of-classes 2

This will result in the creation of a Class Based Queue (CBQ) queuing discipline which is attached to the root dsmark queuing discipline with the specified parameters. The max-bandwidth specifies the maximum bandwidth that needs to be allocated for the CBQ.  This will also result in the creation of a filter that will be used to classify the packets into the approriate AF class.

The next step would be the configuration of the individual AF classes. This would involve the usage of two commands, setafparams and setdp. The setafparams command is issued to specify the bandwidth and the priority that is allocated to a specific AF class, while the setdp command is used to specify the number of drop precedenced within a specific AF class.

comet(config-if-diffserv-af)# setafparams afnum 2 prio 2 max-bandwidth 3Mbit

The above command results in the creation of a class that will be attached to the CBQ queuing discipline that was created. This class is created with the priority and the bandwidth that is specified in the command.  It also results in the creation of a filter that will be used to select packets belonging to this AF class.

comet(config-if-diffserv-af)# setdp afnum 2 numdps 2

The above command results in the creation of a GRED queuing discipline with the specified number of drop precedences, for a particular AF class.

The last step in the configuration of AF is the specification of RED parameters and the drop probabilties for the various drop precedences within an AF class. This includes the specification of the following parameters for every drop precedence:
 

An example configuration is shown below.

comet(config-if-diffserv-af)# setdpparam afnum 2 dpnum 2 drop-prob 0.02 max-thresh 45KB min-thresh 15KB lim 60KB burst 20

The assured forwarding PHB is configured in this manner. The configuration that has been setup on the router can be seen in the following manner.

comet# show running-config

Currrent Configuration:
!
hostname comet
!
interface lo
!
interface eth0
  diffserv
   max-bandwidth 10Mbit
   af
     max-bandwidth 10Mbit
     number-of-classes 2
         setafparams afnum 1 prio 1 max-bandwidth 1Mbit
         setdp afnum 1 numdps 2
         setdpparam afnum 1 dpnum 1 drop-prob 0.020000 max-thresh 45KB min-thresh 15KB lim 60KB burst 20
         setdpparam afnum 1 dpnum 2 drop-prob 0.030000 max-thresh 45KB min-thresh 15KB lim 60KB burst 20
         setafparams afnum 2 prio 2 max-bandwidth 3Mbit
         setdp afnum 2 numdps 2
         setdpparam afnum 2 dpnum 1 drop-prob 0.010000 max-thresh 45KB min-thresh 15KB lim 60KB burst 20
         setdpparam afnum 2 dpnum 2 drop-prob 0.020000 max-thresh 45KB min-thresh 15KB lim 60KB burst 20
!
interface tunl0
!
interface gre0
!
interface teql0
!
!
!
 
       

The configuration can be written to a file in the following manner:
comet# write file
Configuration saved to /usr/local/etc/zebra.conf

This way, the configuration can be saved, and when zebra is started, it will read the configuration from the file and set up the AF PHB.



This page is maintained by Saravanan Radhakrishnan.