Networks and Network Security (CS 560)

Project #2 (100 points)


Part 1: Finish implementing the route_sim program (65 points)

Finish implementing the program named route_sim that simulates the routing of datagrams in an internet comprised of hosts and routers. For this assignment, I am providing you with some code and it can be found in the file proj2.tar.uu in my home directory on stu. You can copy this file from my home directory to yours using the command:

stu% cp ~tjadenbc/proj2.tar.uu ~

Once you have a copy of the file, uudecode it with the command "uudecode proj2.tar.uu". A file named proj2.tar will be created. Untar that file with the command "tar -xvf proj2.tar". A directory named proj2 will be created. Cd into the directory proj2 and follow the instructions in the README to compile and run the program.

The route_sim program reads a configuration file (e.g. route_sim.1.conf, also included in the proj2.tar.uu distribution). The format of the configuration is as follows. Any line that begins with the '#' character is a comment and will be ignored by the program. The configuration file has three main sections: a subnet list (which declares one or more subnets and the hosts and routers that attach to it), a routing table list (which specifies the routing table entries for each host/router), and a test route list (which specifies one or more reachability tests to be run for the given configuration).

The route_sim.1.conf file specifies the following network topology:

There are two subnets (both with subnet masks of 255.255.255.0): 192.168.1.0 and 192.168.2.0. There are two hosts on each subnet: host1 with IP address 192.168.1.1, host2 with IP address 192.168.1.2, host3 with IP address 192.168.2.1, and host4 with IP address 192.168.2.2. There is also a router, router1, which attaches to both subnets. Router1 has two network interfaces that attach to subnet one and subnet two, and their IP addresses are 192.168.1.3 and 192.168.2.3, respectively.

Now consider a few sample routing table entries from route_sim.1.conf. The table for host1 contains two entries:

ROUTE 192.168.1.0 255.255.255.0 192.168.1.1 # direct delivery

ROUTE 0.0.0.0         0.0.0.0             192.168.1.3 # default route

The first entry is a direct delivery route. The next hop (third field) is an interface on the current host. This specifies that messages destined for the 192.168.1.0 subnet should be directly delivered to the destination host through host1's 192.168.1.1 interface. The second entry in host1's routing table is a default route. This specifies that the message should be directly delivered to the next hop (interface 192.168.1.3 on router1).

Right now, the route_sim program reads in the configuration file, fills in some data structures with the configuration information, runs the specified tests on the configuration, and reports any tests that fail. However, the routine that actually runs the tests (see the test_path function at the end of route_sim.c++) is currently just a stub which simply returns a value indicating that the specified test has failed.

Your mission, should you choose to accept it, is to finish the implementation of the test_path routine (and probably several supporting routines) so that the program runs on stu and tests the reachability of various hosts based on the configuration information and routing tables. See the comments in the test_path function in route_sim.c++ for pseudocode to get you started. The file route_sim.c++ is the only one you should have to modify to complete this assignment. Unless you are familiar with the lex and yacc utilities (or have some time to kill) you probably shouldn't even look at the other files (like route_sim.l and route_sim.y++) in proj2.tar.uu. I will use several configuration files (with both good and bad routes) to test the correctness of your implementation.

Part 2: Create routing tables (30 points)

Once your program is working I would like for you gain some experience creating routing tables for some hypothetical interent setups. Below are three configuration files with the routing table entries erased. You must fill in the routing table for each host and router so that all tests given in the configuration file succeed. I expect you to use direct delivery, network routes, host-specific routes, and default routes as appropriate. I will use my route_sim program to check whether or not the routes you create work.

Part 3: Create a Makefile and README for your program (5 points)

Create a  Makefile for your program that checks dependencies and builds the executable. Also, create a text file named README that describes what your program does, how to compile and run it, what options it supports, and any known bugs that it contains. You may use and modify the files given in proj2.tar.uu.

What is due:

Good luck!