ARP Lab


Background:
The Address Resolution Protocol is used to determine the Ethernet address of a host given the IP address.  For our experiments, the ARP code is a separate object that sits between the Ethernet layer and the internet layer.  The push method on the ARP object will be passed the IP address of the desired destination.  The ARP code should then look up that IP address in the ARP table to see if there is a corresponding Ethernet address.  If so, that Ethernet address will be used to push the same payload to the Ethernet layer.  If the IP address is not found, then the ARP object will create an ARP packet, send it out on the broadcast Ethernet address and wait for a reply.  The host with the corresponding IP address should reply with an ARP packet.  If there is no response within 10 seconds, then the ARP push routine should print an error message and return.

The ARP packet is contained directly in an Ethernet packet and does not have an IP header.  In order to recognize the ARP packet, you need to look at the type field in the Ethernet packet.  The type field should be 0x806 for ARP packets.  Because Ethernet assigns a single type value to ARP, an Ethernet frame that contains an ARP request message will have the same type as an Ethernet frame that carries and ARP response.  The receiver must examine the OPERATION field in the ARP packet to determine whether an incoming message is a request or a response.

This list of current Ethernet types  may be interesting to you.  The most important numbers are:

We will provide you with physical and ethernet layers that will allow you to talk directly to the real ethernet in the lab.  The ethernet layer will interpret the length parameter as both length and ethernet type.  The top 16 bits of the length field will have the type field for the ethernet packet.  The bottom 16 bits will have the actual length to be pushed.  The same interpretation will be made for packets that are being "popped" up from the ethernet layer to your arp code.  Be careful here, because if you don't strip off the top 16 bits, it will look like a really long pop (you should "and" the length parameter with 0xffff in order to get the real length). You should also use caution in interpreting the meaning of the length parameter. It is the length of the ethernet frame, not the length of the protocol packet inside of the frame. You will need to look at the header of the protocol (ARP or IP) in order to determine the amount of data in the packet.

When sending an ARP packet, the destination address should be the broadcast Ethernet address (0xff ff ff ff ff ff).  The ARP layer should use this address when sending an ARP packet.  When the Ethernet layer sees this address, it will pass the packet up the stack, even though it does not match the hardware Ethernet address.

Specifications:

You should study the material on pages 258-261  in order to complete this lab successfully.  The format for an ARP packet is described on page 260.
 

Here is an example of how an ARP packet should look - http://students.cs.byu.edu/~cs460ta/cs460/labs/arpfigure.html.
 
Hardware type = 1 ProtocolType = 0x800
HLen=6 PLen=4 Operation
SourceHardwareAddr (bytes 0-3)
SourceHardwareAddr(bytes 4-5) SourceProtocolAddr(bytes 0-1)
SourceProtocolAddr(bytes 2-3) TargetHardwareAddr (bytes 0-1)
TargetHardwareAddr (bytes 2-5)
TargetProtocolAddr (bytes 0-3)

The ARP layer object will be very similar to the physical layer object you wrote in a prior lab.  The ARP layer object must support the following methods:

Template

The arp framework can be found at ~cs460ta/labs/arp_template (this path is found when using your account on the cs460 lab machines - just "cd" to this location). It contains the TA version of physical and ethernet layers that talk to the real ethernet. It also contains a template for the arp layer and the test version of internet and main. The framework will provide you with a physical layer that talks to a daemon (ether_service) that runs on each machine in the lab. You will need to use the template versions of the physical layer and ethernet layer in order to talk through the daemon to the ethernet card. The traffic you generate in this lab will be sent to the 2nd ethernet card (eth1) and you will need to select eth1 in the capture window for ethereal. Your main debugging tool will be to use ethereal to monitor traffic on this network link.

Passoff:

The passoff procedure will test the following specific items

Tips:
Run your code, compiled with the versions of main.cc and internet.cc found in the framework.   The lab version of the code can be run directly from ~cs460ta/labs/arp.  The client code should prompt you for a string to send.  This string will be pushed to your arp code and when the arp response is received from the server (lab version of the code) the packet should be sent.  This string should then appear on  the server window.  The client will then send the characters 0xfeedbeef and this should be displayed on the server  (lab version of the code).  The client will then send the characters 0xfeedbeef  to another IP address and you should generate another ARP.  The lab code will respond to this other address and should print out another passoff message indicating that it has received the string.  You should then press the enter key on the server and it will send an arp request packet to your client.  If you respond correctly, the server will send 0xfeedbeef back to you and your code will display a passoff message.

You may want to run additional tests of your own to make sure that things are working.

The following passoff levels will apply to this lab:
 
 
Passoff Level Behavior Points
Minimal Passoff At least one ARP packet is correctly sent and received and the data packet is then sent to the correct Ethernet destination. 2 Points
Perfect behavior Passes all tests 3 Points