Skip to content

Lab04: The Link Layer Part 2 -- Ethernet and ARP

Learning Goals

Goals for this week's lab

  • Investigate the Ethernet and ARP protocols
  • Learn how to inspect, interpret, and manipulate the ARP table / cache of a Linux host
  • Understand how ARP behaves within a LAN as well as between subnets
  • Understand how ARP behaves in scenarios with unassigned or unreachable nodes

Capturing and Analyzing Ethernet Frames

Let’s begin by capturing a set of Ethernet frames to study.

  • Open GNS3 and load the lab04-routing-and-dns project you used previously.
  • Additionally, start a Wireshark capture on the link between the client and the switch – you can add the filter expression !ipv6 to filter out IPv6 messages that are irrelevant to this task, but happen to be exchanged occasionally.
  • Finally, open a terminal window on the client node and send one ICMP ping request to the node labeled dns. You can control the number of requests with the -c count option of ping.

Note

At this stage, you should see a total of 6 packets in your capture

  • First, locate the ping request packet and inspect its Ethernet information.

    1. What are the source and destination MAC addresses in the Ethernet header? Find which interfaces they belong to by using ip link show on different nodes and checking the link/ether values.
    2. What is the hexadecimal value for the two-byte type field in the Ethernet frame header? What upper layer protocol does this correspond to?

      Next, perform the same steps for the ping reply packet.

Note

Keep Wireshark open since we’ll discuss the other packets next.

The Address Resolution Protocol

Recall that the ARP protocol typically maintains a cache of IP-to-Ethernet address translation pairs on your computer.

  • You can inspect the ARP table by issuing the ip neighbor show (ip nei sh also works) command.
    • Report the output of this command on the client after completing the steps in the previous section.
      1. How many entries are stored in the client’s ARP cache?
      2. What is contained in each displayed entry of the ARP cache?

Tip

You can manually delete all entries in the ARP table via ip nei flush dev eth0.

Observing ARP in Action

  • Navigate back to your Wireshark window and inspect the first ARP packet (this should be an ARP request and the first packet in your capture).
    1. What are the source and destination addresses in the Ethernet header? Which devices (if any) do these addresses correspond to?
    2. Which IP addresses are contained within the ARP request? What is their purpose?
    3. Identify the ARP reply and discuss the Ethernet addresses in use. Is it just that the source / destination of the request is swapped or something else?

Note

You may have noticed two additional ARP packets appearing after your ping. This phenomenon is related to how the ARP state machine is implemented in Linux, probing entries in the ARP table after use to ensure their validity. You can read more about this behavior at Learn ARP

Now, we’ll observe what happens when ARP fails.

  • Open a terminal on the dns node and bring down its eth0 interface by typing ip link set dev eth0 down.
  • Perform another ping from the client to the dns node and describe the resulting behavior.
    1. Does the ping succeed?
    2. What packets appear in your Wireshark capture? Is a ping request sent? Why / why not?
    3. How does the ARP table at the client look like?
    4. Send another ping to the dns node – how did the behavior change compared to question b?

Finally, let’s discuss ARP when communicating across subnets.

  • Ping from the client to the server node with the IP address 10.168.1.2 and locate the corresponding ping request packet in your Wireshark trace.
    1. What are the source and destination MAC addresses in the Ethernet header? Find which interfaces they belong to by using ip link show on different nodes and checking the link/ether values.
    2. Discuss how these results compare to question 1 where you pinged the dns node.