Generate Broadcast Traffic via ARP and Identify the Broadcast MAC Address
In this step, you will contrast unicast traffic with broadcast traffic. While unicast is a one-to-one message, a broadcast is a one-to-all message sent to every device on the local network segment. A primary example of this is the Address Resolution Protocol (ARP), which is used to discover the MAC address associated with a specific IP address. To do this, a device sends out a broadcast frame asking, "Who has this IP address?"
First, let's start a new tcpdump capture. This time, we will add a filter to only show us ARP packets. We'll also use the -n flag to prevent tcpdump from resolving IP addresses to hostnames, and -q to make the output cleaner.
In a terminal, run the following command, remembering to replace eth0 with your interface name from Step 1.
## Replace eth0 with your actual interface name
sudo tcpdump -i eth0 -e -n -q 'arp'
tcpdump is now listening, but only for ARP traffic.
Next, we need to trigger an ARP request. A reliable way to do this is to clear your system's ARP cache and then try to contact another device on the local network, like your gateway router. Clearing the cache forces your system to re-discover the gateway's MAC address using ARP.
Open a new terminal. First, find your gateway's IP address with the ip route command.
ip route | grep default
The output will show your default route, and the IP address listed after "via" is your gateway.
default via 172.16.50.1 dev eth0
Note: Your gateway IP address will likely be different. It is critical to use the IP address from this command in the steps below. A common mistake is to use a different IP like 172.17.0.1, which is often the gateway for a local Docker network and will not produce the correct result for this exercise.
In this example, the gateway is 172.16.50.1. Now, clear your ARP cache using the ip neigh flush command. This will remove known MAC address mappings, forcing your system to use ARP to find them again.
sudo ip -s -s neigh flush dev eth0
You may see output confirming that entries were deleted. Finally, ping the gateway just once to trigger the ARP lookup.
## Replace 172.16.50.1 with your actual gateway IP
ping -c 1 172.16.50.1
Now, switch back to your first terminal where tcpdump is running. You will see the ARP traffic that was generated. Look for the "Request" line:
10:30:01.123456 00:16:3e:01:be:b3 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: ARP, Request who-has 172.16.50.1 tell 172.16.50.8, length 28
Let's analyze this broadcast frame:
00:16:3e:01:be:b3: The source MAC address (your VM).
ff:ff:ff:ff:ff:ff: This is the special broadcast MAC address. When a switch sees a frame with this destination address, it forwards it out of all its ports to every connected device.
ethertype ARP: This indicates the frame's payload is an ARP packet.
ARP, Request who-has 172.16.50.1 tell 172.16.50.8: This is the ARP message itself, a broadcast question to the entire network asking for the MAC address of 172.16.50.1.
You will also see the "Reply" packet, which is a unicast frame sent directly back from the gateway to your VM's MAC address.
You can now stop the tcpdump capture by pressing Ctrl+C in its terminal.