How MAC Addresses Are Used for Communication Between Devices
MAC addresses enable devices to communicate within a local network (LAN). This guide explains how a device discovers another device's MAC address using ARP and how a Layer 2 switch learns MAC addresses to forward Ethernet frames efficiently.
Example LAN Topology
In this example, three computers are connected to the same Layer 2 switch and share the same subnet: 192.168.1.0/24.
Computer-3
MAC: ac:43:30:00:00:03
IP: 192.168.1.3/24
|
|
Computer-1 ------------------------ L2 Switch ---------------- Computer-2
MAC: ac:43:30:00:00:01 MAC: ac:43:30:00:00:02
IP: 192.168.1.1/24 IP: 192.168.1.2/24Step-by-Step: Computer-1 Communicates With Computer-2
Step 1 — Computer-1 Knows the Destination IP, Not the Destination MAC
Computer-1 wants to send data to 192.168.1.2 (Computer-2). However, to deliver an Ethernet frame on the LAN, it must know Computer-2's MAC address.
Step 2 — ARP Request (Broadcast)
Computer-1 sends an ARP request asking: "Who has IP 192.168.1.2? Tell 192.168.1.1." Because Computer-1 doesn't know the destination MAC yet, it uses the Ethernet broadcast address ff:ff:ff:ff:ff:ff. The switch floods this to all ports.
Ethernet Header: Destination MAC: ff:ff:ff:ff:ff:ff (broadcast) Source MAC: ac:43:30:00:00:01 ARP Payload: Who has 192.168.1.2? Tell 192.168.1.1
Step 3 — ARP Reply (Unicast)
Computer-2 receives the request, sees the IP matches, and replies directly to Computer-1 with its MAC address. This reply is unicast.
IP: 192.168.1.2 MAC: ac:43:30:00:00:02
Step 4 — The L2 Switch Learns MAC Addresses
While forwarding frames, the switch learns which MAC addresses live on which ports by reading the source MAC of incoming frames.
ac:43:30:00:00:01Port 1ac:43:30:00:00:02Port 2ac:43:30:00:00:03Port 3Step 5 — Data Frames Sent Using Destination MAC
Computer-1 now sends data using Computer-2's MAC in the Ethernet header. The switch looks up the destination MAC and forwards the frame only to the correct port — no longer a broadcast.
Ethernet Header: Destination MAC: ac:43:30:00:00:02 Source MAC: ac:43:30:00:00:01 IP Header: Destination IP: 192.168.1.2 Source IP: 192.168.1.1
This is why switches are efficient: once MAC-to-port mappings are learned, traffic becomes unicast instead of broadcast.
What If the Destination Is Not on the Same Subnet?
If Computer-1 needs to reach a remote IP (e.g. 192.168.2.10), it cannot reach it directly at Layer 2. Instead:
- Computer-1 sends the packet to its default gateway (router)
- The destination MAC in the Ethernet frame becomes the router's MAC address
- The router forwards the packet toward the remote network
Rule of thumb: On a LAN, Ethernet uses MAC addresses. Across networks, routing uses IP addresses.
Summary
- MAC addresses are used for delivery within a local network (LAN)
- ARP resolves a destination IP address to a destination MAC address
- ARP requests are broadcast; ARP replies are usually unicast
- Layer 2 switches learn MAC addresses and forward frames based on a MAC table
- For remote networks, devices send traffic to the default gateway (router)
Try it on your own network:
Use our MAC Vendor Lookup tool to identify the vendor/manufacturer from a MAC address prefix.