Phase 1 - ARP&L2switch
ACM Honored Class
In this phase you will need to implement the ARP and L-2 switch that are the basic of the network. Because of complexity of the system, we will
give some frame codes in the package and you can use it as the beginning.
Address Resolution Protocol
Introduction
In this phase you need to implement the basic function of ARP(Address Resolution Protocol).
If you need more details, please refer to the following hyperlinks:
- Address_Resolution_Protocol
- RFC826
Implementation Specification
The all codes should be implemented in a new package tenet.protocol.network.arp. There are some basic frame codes in the package and you can use it as your beginning.
The Goal of ARP protocol: Manage a mapping: physical address <----> IP address.
The basic process:
“A” sends an ARP packet to request the IP B physical address. Any one receives the ARP packet and analysis the packet. If it is the IP B then it will response to the source, otherwise it will update the mapping and ignore the packet.
The points:
- The ARP protocol has 2 different models.
- Flood: You can send your information to all nodes periodically.
- Lazy: You just send message when you get a request.(In RFC826, it is recommended)
- The Robustness
- Decay over time: The information will be removed after the interval time. And you can send a message to confirm it before you delete the information.
- Lazy: Don’t worry.
- The initialization
- Broadcast first.
-
If you have some special settings then do it (e.g. the Decay).
- The ARP package
- Source IP &destination IP
- A sign to express the request or response.
Layer-2 Switch
Introduction
In this phase you need to implement the basic function of layer-2 switch. Operates at the data link layer, Layer-2 switch interconnects a small number of devices and transmit frames among them. It learns the MAC address of each connected device and records them in the MAC table. While transmitting frames layer-2 switch looks up the MAC table according to the destination MAC address and get the right port to transmit the frame. There are four forwarding methods a layer-2 switch can use. Here the “Store & Forward” is required, that is to say, the switch buffers and verifies each frame before forwarding it. However, how to deal with a crashed frame is up to your own design.
If you need more details, please refer to the following hyperlinks:
- Network switch-layer 2
- Flooding algorithm
Generally, in order to achieve this task, you need to:
- Design and construct various packets to exchange routing information, such as HELLO packet and ACK packets.
- Process incoming packets, calculate and schedule packet generation and sending.
- Be careful of some tricky parts, especially when you distribute packets.
Carefully read the text, and implement sequence numbering, aging and acknowledgments in your implementation.
Implementation Specification
- Forwarding a frame
When the layer-2 switch is to forward a frame, it looks up the MAC table with the destination MAC address and forward the frame using the corresponding SimpleEthernetDataLink . Once the MAC address is not in the table, just use the flooding scheme. Flooding means to layer-2 switch tries to forward the message to every one of its neighbors except the source node.
- Updating MAC table
The MAC table records the mapping between MAC address and SimpleEthernetDataLink. When a layer-2 switch receives a frame from a SimpleEthernetDataLink, the switch gets the source MAC address in the frame and updates the table by mapping the address to the corresponding SimpleEthernetDataLink.
- Components
Most of the methods you need to implement are given in L2Switch.java and StoreForwardingDataLink.java
L2Switch.java:
This class records the data of a single Layer-2 switch, such as the attached SimpleEthernetDataLink and the MAC table.
StoreForwardingDataLink.java:
This class extends SimpleEthernetDataLink and you need to add in the “Store & forward” function。In StoreForwardingDataLink there is a queue buffering all the frames to forward。You need to override the methods of dealing with different signals to makes it support the function of layer-2 switch. The method onSendOK has been implemented as an example for you.
Testing and Grading
We will test the correctness of your ARP & L2 switch and MAC collision detection in this phase.
Efficiency of you design is not required here. However, an inefficient design might have a bad effect on other phases.