Homework 1
Due Date: Thursday, October 22, 1998
                (No late assignments will be accepted.)
 

This homework assignment has two parts:
 
Part I:
In the textbook, please read the following chapter:

        Chapter 8: Internet Protocol: Routing IP datagrams

After reading that chapter, please answer the following questions and hand in your type-written answers:

        8.1
        8.3
        8.4
        8.5
        8.8
 

Part II:

Write a C program that implements IP routing.
The program should take the following arguments:

    1.  The name of a file that contains the routing table.
    2.  A destination IP address
    3.  A series of local IP addresses and subnet masks.
        The special subnet mask "0" will mean take the default subnet mask.

For example, the program can be invoked as follows:

     iproute  table1
                    169.124.21.23  \ 
                    169.124.34.2   255.255.255.0 \
                    169.124.21.19  255.255.255.0 \
                    198.11.109.08  0

In the above case, your code would assume the machine has three IP address:

            169.124.34.2  (with subnet mask 255.255.255.0),
            169.124.21.19 (with subnet mask 255.255.255.0), and
            198.11.109.08 (with the default subnet mask).

The routing table should contain the following columns:

          a.  a network number or a host IP address
          b.  a router address
          c.  an interface number

For example, the you can have a routing table as follows::

          169.124.34.0   169.124.34.2      1
          169.124.21.0   169.124.21.19     2
          198.11.109.0   198.11.109.8      3
          169.124.25.0   169.124.34.19     1
          169.124.30.0   169.124.34.19     1
          169.124.29.0   169.124.34.22     1
          168.34.0.0     169.124.21.22     2
          205.2.4.0      198.11.109.27     3
          0.0.0.0        198.11.109.19     3
 

The program should print out one of the following:

     Deliver directly over interface X
or
     Deliver to IP_address over interface X
or
     Deliver to myself
or
     Network is unreachable
 

Here are some example runs:

     $ iproute table1
                    169.124.21.23  \
                    169.124.34.2   255.255.255.0 \
                    169.124.21.19  255.255.255.0 \
                    198.11.109.08  0
     Deliver directly over interface 2

     $ iproute table1
                    169.124.25.19  \
                    169.124.34.2   255.255.255.0 \
                    169.124.21.19  255.255.255.0 \
                    198.11.109.08  0
     Deliver to 169.124.34.19 over interface 1

     $ iproute table1
                    198.11.109.27  \
                    169.124.34.2   255.255.255.0 \
                    169.124.21.19  255.255.255.0 \
                    198.11.109.08  0
     Deliver directly over interface 3

     $ iproute table1
                    205.2.4.25  \
                    169.124.34.2   255.255.255.0 \
                    169.124.21.19  255.255.255.0 \
                    198.11.109.08  0
     Deliver to 198.11.109.27 over interface 3

     $ iproute table1
                    199.34.12.134  \
                    169.124.34.2   255.255.255.0 \
                    169.124.21.19  255.255.255.0 \
                    198.11.109.08  0
     Deliver to 198.11.109.19 over interface 3
 

For those you you who don't want to write the progrem, please do the following instead:

    1.  Create a flowchart and pseudo-code that describes how you would implement the program described above.
    2.  Answer the following questions from the text:
                10.5
                10.6
                10.16