CSCI 4171/CSCI 6704 NETWORKS ASSIGNMENT NO.4
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
CSCI 4171/CSCI 6704
NETWORKS
ASSIGNMENT NO.4
2022
The objective of this assignment is the simulation of the routing process in a router. You may use Java, C, C++ or Python as the language for building your program.
Download the associated text file RoutingTable.txt and RandomPackets.txt (given next to the Assignment link).
Exercise: You will write a program to simulate the routing decision taken at a router that we discussed in the lectures. You are given a text file (RoutingTable.txt) containing a routing table for a router (the five column generic routing table with mask, destination address, next hop, flag and interface). You will notice that this is almost the same routing table as the one that we discussed in the lectures. The first few lines of the text file are shown below:
192.168.1.0/24 à Destination address/Number of ones in the mask
- à - means no next hop E0 à Outgoing interface
192.168.2.0/24 à Destination address/Number of ones in the mask
192.168.4.2 à Next hop
S0 à Outgoing interface
Etc.
Notice that three rows are sufficient to capture the information in the five columns of the routing table. The type of entry (direct, network specific, host specific or default) is not given but you can determine that from the given information.
You are given another text file (RandomPackets.txt) that contains a list of packets with random destination addresses that arrive at this router. The first few lines of the text file are shown below:
192.168.1.1
192.168.3.2
200.56.45.89
255.0.0.0
127.0.0.1
etc.
If you check the above packets with the given routing table, you will notice that packet #2 is a host specific packet, packet #3 should take the default route, packet #4 does not belong to class A, B or C and should be discarded, packet #5 has a loopback address and should be discarded.
Your program should read the two text files and decide what to do with each packet, displayed as follows:
192.168.1.1 will be forwarded on the directly connected network on
interface E0.
192.168.3.2 will be forwarded to 192.168.5.2 out on interface S1
200.56.45.89 will be forwarded to 192.168.4.2 out on interface S0
255.0.0.0 is malformed; discarded
127.0.0.1 is loopback; discarded
Store the answers in a text file (RoutingOutput.txt).
Write your program in a general manner, in the sense, it should work for any routing table and any packet. You may assume that all the masks in the table are the default ones for Class A (255.0.0.0), Class B (255.255.0,0) and Class C (255.255.255.0)..
What to submit: One zip file containing the following:
a) Commented Source code
b) RoutingOutput.txt
2022-11-06