RP: ADDRESS RESOLUTION PROTOCOL
In this first exercise, we will use the Address Resolution Protocol (ARP) to determine the Media Access Control (MAC) address of machines on our local network. The example code provides a Python function for broadcasting an ARP request message and printing any replies that are received. You must determine what to pass as the argument to the function. The argument is an IP address and subnet in CIDR format. (We discussed this format in class, but it’s a shorthand for designating the IP address and subnet — an IP address of 1.2.3.4 with a subnet mask of 255.255.255.0 is designated as 1.2.3.4/24, meaning the IP address with the leftmost 24 bits as a subnet mask.) As an example, if we have an IP address of 192.168.1.45 with a subnet mask of 255.255.252.0 then our CIDR is 182.168.1.45/30.
Call the function with the correct CIDR designation to cause the function to send exactly eight ARP requests and capture the reply.
MORE FUN WITH ICMP
Now we will look at ICMP. Note that we looked at this in a previous lab but didn’t really understand its use. ICMP is useful for routing statistics and routers use it extensively for providing error and status results when trying to send IP packets. The following code uses a Python library called “icmplib”. (Install it if you need to.)
Use this function (“findRoute”) to display statistics that convey how IP packets must be routed to get to a specified target. First, call the function with your local machine’s IP address. Then, call the function with a destination or target of a remote machine. Call the function at least three times for each target. In this markdown section, answer the following questions:
- Are the results for Average time the same for each execution to the same target? Why or why not?
- Are the number of hops the same for each execution to the same target? Why or why not?
UDP: USER DATAGRAM PROTOCOL
UDP is a connectionless protocol built on IP. It has less overhead than TCP but only because it doesn’t try to fix any transmission errors. Here is sample Python code that creates a server for UDP packets and a client. Based on this code:
Do these steps:
- Modify the client to send a message of your choice three different times. Please make the message unique each time. Capture the output for each execution of the client.
- Modify the client and change the PORT. Execute the client and capture the output. Explain the result.