|
QualNet Exercises:
Chapter 4. Network Layer
Objective
The objectives of this exercise are to both help understand the Distance-Vector
routing algorithm and learn how to implement a custom protocol
in the QualNet simulator.
Overview
First, you will study and implement a simple Distance-Vector
routing protocol, based on the provided protocol framework. Next,
you will integrate the implemented routing protocol into QualNet.
There is a tutorial on
how to add a new custom routing protocol into QualNet which describes the
entire process in a step-by-step manner.
Procedure
Part 1. A simple Distance-Vector (DV) routing protocol
In Part 1, you will implement a simple
routing protocol based on the Distance-Vector algorithm.
The protocol is named as Simple Routing Information Protocol (SRIP),
which has two major functionalities:
- Maintaining the routing table according to the DV alogorithm.
- Forwarding data packets as they arrive by consulting the routing table.
Your job is to implement the SRIP algorithm. The necessary framework
(including two files: routing_srip.h and routing_srip.cpp) is
provided as a compressed tar file downloadable from here . The only file
that you need to modify is routing_srip.cpp, where you will modify
three out of four functions described below. Please go through both files
as you read the following.
- SripInit() -- This function is called upon starting the
simulation initially. For SRIP, you should initialize the routing table in
this function (i.e., set all distances to INFINITY and all next hops to
INVALID_ADDRESS). Please do not forget to initialize the entry for the host
node itself so that the distance is 0 and the next hop is its own address.
Please examine the provided routing_srip.h and
routing_srip.cpp code
for details on the data structure of the routing table.
- SripHandleProtocolEvent() -- This function is
called whenever a "Route Update Broadcast" message (a.k.a., route
update packet) needs to be sent to the
neighbors. It is already provided and you do not need to make any
change. This function responds to the "Route Broadcast Timer"
message. When the timer expires, this function is called.
The function constructs a "Route Update" packet, which includes all the
valid entries of the routing table, and broadcasts it.
- SripHandleProtocolPacket() -- This function is
called whenever a protocol packet (which is a "Route Update" packet
in SRIP) arrives. You need to modify this
function to update the routing table according to the DV algorithm
and the information received in the Route Update packet.
- SripRouterFunction() -- This function is called
whenever the IP layer receives a data packet from either its own
transport layer or
another node, and tries to determine the next hop to which the
IP packet should be
forwarded. The function consults the routing table to identify the entry for
the destination of the received packet. If a valid next hop and
distance value are found for the destination node, the packet is
sent to the MAC layer using the function
NetworkIpSendPacketToMacLayer().
Part 2. Adding a custom routing protocol into QualNet
In Part 1, you've learned to implement the major functions for SRIP.
In Part 2, you will integrate the implemented protocol into QualNet.
Please download from here
a compressed tar file, which includes the complete SRIP source,
configuration files and a tutorial & README
explaining in details the entire process of
adding a routing protocol to QualNet.
Integrate SRIP protocol into QualNet accordingly. Then re-compile and run
QualNet with the provided SRIP configuration files srip.config and
srip.app.
Questions
- In which layer is SRIP implemented? How about Internet's RIP?
- What five major functions are needed in order to implement a network layer
routing protocol in QualNet?
- List all types of protocol event(s)/timer(s) and packet(s) in SRIP?
- Submit in the generated statistics file (srip.stat) after
running QualNet with the provided SRIP configuration files
(srip.config and srip.app), and answer the following:
- What is the SRIP "Route Update" interval used in above run?
- How many "Route Update" broadcasts are sent out at each node?
References and Further Readings
- Sections 4.5 and 4.6 of the textbook.
- Section 4.4.5 of the QualNet 5.0 Programmer's Guide.
DEGAS networking group |
CIS
(302) 831-1951/1131, Newark, DE.
© 2005, DEGAS networking group. All rights reserved.
|