E6998-02 Homework 3

Out: 27 October 2003


Submission instructions

The homework is due on 12 November 2003 at 3am EDT. Submit the homework via email to ji+hw3@cs.columbia.edu. Do not send to any other address, or your submission will be ignored. Do not submit executables, just a tar file that should include a makefile.

You have more than two weeks. Start tonight, ask questions if you have problems. As you have no doubt noticed, my homeworks are not doable at the last minute. To encourage you to try to finish early, we will stop answering questions 48 hours before the homework is due.


Description

The purpose of this homework is to convince yourself (and me!) that you understand the essential elements of Link-State routing protocols.

You will be extending the routing daemon simulation from homework 2 to handle a rudimentary link-state protocol. The simulator reads a file describing the network being simulated. Each line of the file represents a (simulated) router; the fields of each line are the name of the router, the prefixes it is advertising starting with its own loopback address (that is, the RouterID), and the list of links given as neighbor,cost. The name of the file containing the description of the network is passed as the first argument to the simulator. The second argument is the maximum LSA age, in seconds, after which LSAs must be reflooded.

For example, the file describing the network in this picture:

is:

A 1.2.3.4,10.0.0.0/8    	       		D,4 E,4 B,2
B 66.0.66.0,128.59.0.0/16,132.20.225.0/24	A,2 C,1 E,10
C 30.3.30.3,192.4.13.0/24			B,5 F,2
D 4.4.4.4,135.207.16.0/20,135.205.0.0/16	G,5 A,4 E,3
E 5.5.5.5					A,5 B,2 G,1 F,2 H,8 D,3
F 6.66.6.66,209.128.64.0/20			C,2 E,2 H,4
G 70.70.70.70,10.0.0.0/8,128.96.0.0/16		D,5 E,1
H 8.8.8.8,8.8.8.9,207.140.168.0/24		E,8 F,6
The names of the nodes can be of arbitrary length, but I didn't feel like typing! If no prefix length is given, /32 is assumed. Since the Router ID is always a host address, it always has a /32 prefix, and therefore there is never a need to specify it.

While the simulation is running, the simulator responds to the following commands:

l node1 [ node2 [ node3 [ ... ]]] prints the current Link State Databases of the listed nodes.

l * prints the Link State Databases of all nodes.

l without an argument does nothing!

p node1 [ node2 [ node3 [ ... ]]] prints the current routing tables of the listed nodes.

p * prints the routing tables of all nodes.

p without an argument does nothing!

t node1 [ node2 [ node3 [ ... ]]] prints the LSAs sent and received by the listed nodes (the moment they are sent or received). If a t command is already active and another one is issued, only the new list of nodes will be printed from then on.

t * is equivalent to a t command listing all nodes .

t without an argument stops the printing of LSAs.

s node1 node2 "severs" the link between the two nodes; that is, node1 will not "hear" messages from node2 and vice versa. Invoking this command on a link that is already severed has no effect.

r node1 node2 "restores" the link between the two nodes. The r command cannot be used to add links that did not exist in the configuration file, only to restore links previously severed with the s command. Invoking this command on a link that has already been restored has no effect.

d nodetakes the node down (the node stops sending hello messages and LSAs). Invoking this command on a node that is already down has no effect.

u brings the node back up after a d. Invoking this command on a node that is already up has no effect. Again, this command cannot be used to insert new nodes into the topology, only to bring back up nodes that were taken down with a d.

q quits the simulation.

The routing table is the list of known routes, each route being a destination prefix, the next hop router, and the cost to the destination. WHen listing LSAs, list all relevant fields. Verify that your simulation works at boundary conditions, such as single-node networks (no routes will be advertised, but please don't dump core!), or two-node networks linked by single link. Don't limit yourself to getting the network shown in the picture.


Protocol Specification

No Hello packets are required, since the configuration file supplies the list of neighbors.

There is only one type of LSA, what OSPF calls a "Router LSA". It has the following format:


        0                   1                   2                   3
        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |    LS type    |    #links     |      age      |     seq#      |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                          Router ID                            |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                          Link ID                              |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |     Type      |  prefixlen    |            metric             |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                          Link ID                              |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |     Type      |  prefixlen    |            metric             |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      ~~~                                                             ~~~
      ~~~                                                             ~~~
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                          Link ID                              |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |     Type      |  prefixlen    |            metric             |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
LS Type is 1 (Router LSA).
#links is the number of links this router has. There are two kinds of links: type 1 (point-to-point links to other routers), and type 3 (links to stub networks).
age is the age of the LSA in seconds. It is an unsigned 8-bit number, so it ranges from 0 to 255. The LSA age starts at zero and is incremented every second. When an LSA is being flooded, the age is incremented by 1 every time it gets through a router.
seq# is the LSA sequence number. The sequence number space is linear, from 0 to 255. When the sequence number is about to wrap around, the router sends out an LSA with MAXAGE (255) to flush it out of all other routers' LSDBs, and then starts again with a seq# of 0.
Router ID is the IP address of the (loopback interface of) the router. it is the first of the addresses given in the configuration file.
Following this fixed part of the LSA is the list of links. For type 1 links, the Link ID is the Router ID of the neighboring router on that link. The prefixlen field has no meaning in this case, and MUST be set to 0. The metric is the cost of the link, also as specified in the configuration file. For type 2 links, the Link ID is the IP address of the attached stub network (not shown in the picture above, of course). The prefixlen is, of course, the prefix length of the stub network, and the metric is 0 (since it costs nothing for the router to send traffic to its own stub network!).

For example, the following LSA could be sent from router A:

        0                   1                   2                   3
        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |       1       |       4       |      13       |       5       |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |       1       :       2       :       3       :       4       |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |       4       :       4       :       4       :       4       |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |       1       |       0       |       0       |       4       |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |       5       :       5       :       5       :       5       |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |       1       |       0       |       0       :       4       |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |      66       :       0       :      66       :       0       |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |       1       |       0       |       0       :       2       |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |      10       :       0       :       0       :       0       |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |       3       |       8       |       0       :       0       |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Needless to say, when a link goes down, a new LSA gets sent out with a lower number of links and no information about the downed link.


$Id: index.html,v 1.2 2003/10/03 05:41:22 ji Exp ji $