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-dnsproject you used previously. - Additionally, start a Wireshark capture on the link between the client and the switch – you can add the filter expression
!ipv6to 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 countoption ofping.
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.
- What are the source and destination MAC addresses in the Ethernet header? Find which interfaces they belong to by using
ip link showon different nodes and checking thelink/ethervalues. -
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.
- What are the source and destination MAC addresses in the Ethernet header? Find which interfaces they belong to by using
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 shalso works) command.- Report the output of this command on the client after completing the steps in the previous section.
- How many entries are stored in the client’s ARP cache?
- What is contained in each displayed entry of the ARP cache?
- Report the output of this command on the client after completing the steps in the previous section.
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).
- What are the source and destination addresses in the Ethernet header? Which devices (if any) do these addresses correspond to?
- Which IP addresses are contained within the ARP request? What is their purpose?
- 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.
- Does the ping succeed?
- What packets appear in your Wireshark capture? Is a ping request sent? Why / why not?
- How does the ARP table at the client look like?
- 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.
- 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.
- Discuss how these results compare to question 1 where you pinged the dns node.