Starting from:
$35

$29

Assignment 3: ARP, ICMP, and RIP Solution

Overview
For this assignment, you will modify your virtual router to: (1) generate Internet Control Messaging Protocol (ICMP) messages when error conditions occur; (2) populate the ARP cache by generating and consuming Address Resolution Protocol (ARP) messages; and (3) build a routing table using distance vector routing. With these changes, your virtual router will no longer depend on a static ARP cache or static route table, and it will be pingable and traceable.
Part 1: Getting Started
Part 2: Implement ICMP
Part 3: Implement ARP
Part 4: Implement RIP
Submission Instructions
Learning Outcomes
After completing this assignment, students should be able to:
    • Write code that constructs and deconstructs packets containing multiple layers of protocols
    • Explain how the Address Resolution Protocol (ARP) and distance vector (DV) routing work
Note
    • Include the “-n” argument when you run traceroute, otherwise traceroute will try to convert IPs to hostnames using DNS which will generate spurious traffic and make traceroute slow.
    • Please find the FAQs of this assignment in the link

Part 1: Getting Started
You will use the same environment and code base as Assignment 2. You should create a copy of your entire assign2 and name it assign3:
cp -r ~/assign2 ~/assign3
You can use the version of Router.java , RouteTable.java and Switch.java you wrote for Assignment 2, or you can download our solutions for these files:
        cd ~/assign3/src/edu/wisc/cs/sdn/vnet/rt/
        wget http://pages.cs.wisc.edu/~akella/CS640/F19/assignment3/Router.java
        wget http://pages.cs.wisc.edu/~akella/CS640/F19/assignment3/RouteTable.java
        cd ~/assign3/src/edu/wisc/cs/sdn/vnet/sw/
        wget http://pages.cs.wisc.edu/~akella/CS640/F19/assignment3/Switch.java
        wget http://pages.cs.wisc.edu/~akella/CS640/F19/assignment3/MACTable.java
        wget http://pages.cs.wisc.edu/~akella/CS640/F19/assignment3/MACTableEntry.java
If you’ve forgotten the commands to start Mininet, POX, or your virtual router, you should refer back to Assignment 2.
As you complete this assignment, you may want to use tcpdump to examine the headers of packets sent/received by hosts. To run tcpdump on a specific host, open an xterm window:
mininet> xterm h1
Then start tcpdump in that xterm:
sudo tcpdump -n -vv -e -i h1-eth0
You’ll need to change the host number included in the interface (-i) argument to match the host on which you’re running tcpdump.

Part 2: Implement ICMP
For this part of the assignment, you will add support for generating and responding to Internet Control Message Protocol (ICMP) messages. Details on the ICMP protocol are available from Network Sorcery's RFC Sourcebook (if the Network Sorcery website is unavailable, you can access our mirror of the relevant pages). There are five different ICMP messages you need to generate.
Time exceeded
A time exceeded message must be sent whenever your virtual router discards a packet because the TTL field is 0. Your router should already have code that  decrements the TTL field by 1 and checks if the field (after decrement) equals 0. You should update this portion of the code to generate an ICMP time exceeded message prior to dropping the packet whose TTL field is 0.
When the router generates ICMP messages for time exceeded (type 11, code 0), the packet must contain an an Ethernet header, IP header, ICMP header, and ICMP payload. You can construct these headers, by creating  Ethernet, IPv4, ICMP, and Data objects using the classes in the net.floodlightcontroller.packet package. To link the headers together, you should call the setPayload(..) method defined in the BasePacket class, which is the superclass for all of the header classes. Below is a snippet of code to get you started:
Ethernet ether = new Ethernet();
IPv4 ip = new IPv4();
ICMP icmp = new ICMP();
Data data = new Data();
ether.setPayload(ip);
ip.setPayload(icmp);
icmp.setPayload(data);
In the Ethernet header, you must populate the following fields:
    • EtherType — set to Ethernet.TYPE_IPv4
    • Source MAC — set to the MAC address of the out interface obtained by performing a lookup in the route table (invariably this will be the interface on which the original packet arrived)
    • Destination MAC  — set to the MAC address of the next hop, determined by performing a lookup in the route table followed by a lookup in the ARP cache
In the IP header, you must populate the following fields:
    • TTL — set to 64
    • Protocol — set to IPv4.PROTOCOL_ICMP
    • Source IP — set to the IP address of the interface on which the original packet arrived
    • Destination IP — set to the source IP of the original packet
In the ICMP header you must populate the following fields:
    • Type — set to 11
    • Code — set to 0
The payload that follows the ICMP header must contain: (1) 4 bytes of padding, (2) the original IP header from the packet that triggered the error message, and (3) the 8 bytes following the IP header in the original packet. This is illustrated in the figure below:
 
Once the ICMP packet is fully constructed, you should send it on the interface that is obtained from the longest prefix match in the route table for the source IP of original packet (invariably this will be the interface on which the original packet arrived). You should drop the original packet after sending the time exceeded message.

More products