Description
write a simple 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.
4 attachmentsSlide 1 of 4attachment_1attachment_1attachment_2attachment_2attachment_3attachment_3attachment_4attachment_4
Unformatted Attachment Preview
192.168.1.0/24
–
E0
192.168.2.0/24
192.168.4.2
S0
192.168.3.0/24
192.168.5.2
S1
192.168.4.0/24
–
S0
192.168.5.0/24
–
S1
192.168.6.0/24
192.168.4.2
S0
192.168.2.2/32
192.168.5.2
S1
192.168.3.3/32
192.168.4.2
S0
0.0.0.0/0
192.168.4.2
S0
192.168.1.0/24
–
E0
192.168.2.0/24
192.168.4.2
S0
192.168.3.0/24
192.168.5.2
S1
192.168.4.0/24
–
S0
192.168.5.0/24
–
S1
192.168.6.0/24
192.168.4.2
S0
192.168.2.2/32
192.168.5.2
S1
192.168.3.3/32
192.168.4.2
S0
0.0.0.0/0
192.168.4.2
S0
CSCI 4171/CSCI 6704
NETWORKS
ASSIGNMENT NO.4
Date Given: Sunday, November 7th, 2021
Date Due: Sunday, November 21st, 2021, 11.59 PM
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 files (given next to the Assignment link).
Exercise: You will write a simple 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
E0
192.168.2.0/24
192.168.4.2
S0
Etc.
→
→
→
→
→
→
Destination address/Number of ones in the mask
– means no next hop
Outgoing interface
Destination address/Number of ones in the mask
Next hop
Outgoing interface
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
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
on
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
192.168.1.1
192.168.3.2
200.56.45.89
255.0.0.0
127.0.0.1
192.168.2.2
192.168.3.2
192.168.10.45
192.168.6.34
192.168.0.15
192.168.4.3
192.168.5.79
10.5.6.7
172.3.4.5
192.168.0.192
Purchase answer to see full
attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool’s honor code & terms of service.