Skip to main content
Ethernet, MAC Addressing, ARP & Switching
Lesson 2 of 11

Ethernet, MAC Addressing, ARP & Switching

Learn how Ethernet frames and MAC addresses move data across a local network, how switches build forwarding tables, and how to analyze ARP traffic and spot ARP spoofing in packet captures.

Beginner 24 min Networking
Authorised environments only — The techniques described here are used only in training labs and on systems you own or have written permission to test.

Learning objectives

  • Explain the structure of an Ethernet II frame and the role of 48-bit MAC addresses in local delivery
  • Trace how a Layer 2 switch learns source addresses and forwards or floods incoming frames
  • Describe how ARP resolves an IPv4 address to a MAC address using broadcast requests and unicast replies
  • Inspect local ARP tables and Wireshark packet captures to detect suspicious or spoofed IP-to-MAC mappings

Recommended first: OSI and TCP/IP Reference Models

#Why this matters

In the OSI and TCP/IP models, IP addresses identify hosts across networks at Layer 3. However, a network interface card (NIC) cannot transmit a packet across a physical link using an IP address alone; it needs a Layer 2 frame addressed to a hardware MAC address.

For digital forensics (raqamli-izquarlik) and blue-team analysts, Ethernet headers and Address Resolution Protocol (ARP) traffic in a packet capture (PCAP) show which hardware interfaces communicated locally and whether an attacker redirected traffic.

#Ethernet frames and MAC addresses

A MAC (Media Access Control) address is a 48-bit (6-byte) hardware identifier written as six hexadecimal pairs, such as 02:11:22:33:44:55. The first three bytes form the Organizationally Unique Identifier (OUI), and the last three bytes identify the interface. The special address ff:ff:ff:ff:ff:ff is the Layer 2 broadcast address, accepted by every NIC on the subnet.

Wired LANs use the Ethernet II frame format:

Field Size Purpose
Destination MAC 6 bytes Target NIC, or ff:ff:ff:ff:ff:ff for broadcast
Source MAC 6 bytes Sending NIC hardware address
EtherType 2 bytes Encapsulated protocol (0x0800 IPv4, 0x0806 ARP, 0x86DD IPv6)
Payload 46-1500 bytes Layer 3 packet
FCS 4 bytes Frame Check Sequence (CRC-32) for error detection

Wireshark usually shows Destination MAC, Source MAC, EtherType, and Payload because the NIC strips the preamble and FCS before passing frames to the OS.

#How a switch forwards frames

Unlike legacy hubs that repeated signals to every port, a Layer 2 switch reads Ethernet headers and maintains a MAC address table:

  1. Learn: Record the Source MAC and incoming port in the table.
  2. Forward or flood: Look up the Destination MAC. If found, forward only to that port. If unknown or ff:ff:ff:ff:ff:ff, flood the frame out all other ports in the same LAN.
  1. Frame arrives on Port 1Record Source MAC on Port 1
  2. Lookup Destination MACSearch MAC address table
  3. Known unicastForward only to matching port
  4. Broadcast or unknownFlood to all other ports

Because unicast frames go only to the target port, a host on Port 3 does not normally see unicast traffic between Ports 1 and 2. Attackers on a LAN abuse ARP to bypass that isolation.

#Address Resolution Protocol (ARP)

Suppose 10.10.10.15 wants to send an IPv4 packet to its default gateway 10.10.10.1 but lacks the gateway's MAC address. ARP resolves that IPv4-to-MAC mapping on the local subnet.

ARP request (broadcast) and ARP reply (unicast)ARP request (broadcast) and ARP reply (unicast)Host A (10.10.10.15)SwitchAll PortsGateway (10.10.10.1)Broadcast ff:ff:ff:ff:ff:ff | Who has 10.10.10.1?Floods ARP Request (EtherType 0x0806, Opcode 1)Unicast | 10.10.10.1 is at 02:00:00:00:00:01 (Opcode 2)Host A caches the mapping for 10.10.10.1

An ARP Request (opcode 1) is sent as a broadcast frame. Only 10.10.10.1 replies with a unicast ARP Reply (opcode 2), and Host A caches the mapping. Remember that ARP works only on the local subnet: when contacting a remote server like 198.51.100.20, a host resolves its default gateway (10.10.10.1), not the remote IP.

On Linux, arp -n shows the ARP cache without DNS lookups:

Inspecting the ARP cache on a lab host
$ arp -n
Address                  HWtype  HWaddress           Flags Mask            Iface
10.10.10.1               ether   02:00:00:00:00:01   C                     eth0
10.10.10.25              ether   02:00:00:00:00:25   C                     eth0

In Wireshark, useful display filters include arp, arp.opcode == 1, arp.opcode == 2, and eth.addr == 02:00:00:00:00:01.

#Defending and common mistakes

ARP has no authentication: hosts usually accept unsolicited ARP replies and overwrite cached entries. Attackers exploit this via ARP spoofing (cache poisoning) to intercept local traffic.

Core defences:

  • Dynamic ARP Inspection (DAI): Switches verify ARP frames against a trusted DHCP snooping table and drop forged replies.
  • Port security: Limiting MAC addresses per port blocks MAC flooding.
  • Static ARP entries: Fixed IP-to-MAC bindings protect critical gateways and servers on sensitive segments.
  • Monitoring: Alert when one MAC claims multiple IPs or when the gateway MAC changes.

Common mistakes:

  • Running arp without -n: Hostname resolution slows triage and creates DNS noise.
  • Looking for a remote server's MAC in a local PCAP: Frames only carry the next Layer 2 hop (the gateway).
  • Assuming TLS stops ARP spoofing: TLS hides payloads, but an attacker can still drop packets, log metadata, and sniff plain DNS or HTTP.

#Summary

  • Ethernet II frames carry 48-bit MAC addresses and an EtherType (0x0800 IPv4, 0x0806 ARP) for local delivery.
  • Switches learn source MACs dynamically, forward known unicast frames to one port, and flood broadcasts (ff:ff:ff:ff:ff:ff) and unknown destinations.
  • ARP resolves local IPv4 addresses (or the default gateway) using broadcast requests and unicast replies.
  • Defenders detect and prevent ARP spoofing with arp -n, Wireshark (arp.opcode == 2), DAI, and port security.

Knowledge check

Sign in to take the test, complete lessons and save your progress. Log in

Practice: test your knowledge