IP Address vs MAC Address: Layer 3 and Layer 2 Explained

IP addresses and MAC addresses both identify communication points, but they work at different layers. This guide explains how Layer 2 and Layer 3 addressing work together.

Layer 2 Layer 3 ARP CCNA
IP Address vs MAC Address: Layer 3 and Layer 2 cheat sheet: use this quick map before reading the detailed sections.
Lesson overview

In This Lesson

Follow a packet to see where Layer 3 IP addresses and Layer 2 MAC addresses each matter. ARP, DHCP, NAT, and troubleshooting examples connect the two identities.

  1. Quick Difference
  2. How They Work Together
  3. ARP
  4. DHCP and NAT
  5. Troubleshooting
  6. Follow a Packet from One Host to Another
From concept to practice

Quick Learning Map

Keep this three-step view in mind as you work through the detailed lesson.

1

Choose the destination IP

Hosts use network-layer addresses to identify local or remote endpoints.

2

Resolve the next-hop MAC

ARP maps the local next hop to a link-layer destination.

3

Verify both layers

Inspect addressing, ARP tables, switch learning, routes, and packet captures.

Fast orientation

IP Address vs MAC Address: Layer 3 and Layer 2 Explained at a Glance

Use this summary before moving into the detailed explanations, examples, commands, and checks.

Core focus

Follow a packet to see where Layer 3 IP addresses and Layer 2 MAC addresses each matter.

Key connection

Choose the destination IP → Resolve the next-hop MAC → Verify both layers

Practical outcome

ARP, DHCP, NAT, and troubleshooting examples connect the two identities.

1. Quick Difference

IP addresses are logical Layer 3 addresses used for routing. MAC addresses are Layer 2 addresses used for local frame delivery.

IP example: 192.168.1.10.MAC example: 00:1A:2B:3C:4D:5E.IP can change by network.MAC is local-link focused.

2. How They Work Together

A packet keeps IP addressing end to end, while each local Ethernet hop uses MAC addresses for next-hop delivery.

  • Remote traffic uses the gateway MAC.
  • Routers rebuild Layer 2 frames.
  • Switches learn source MAC addresses.

3. ARP

ARP maps an IPv4 address to a MAC address on the local network.

  • arp -a
  • ip neigh
  • show arp
  • show mac address-table

4. DHCP and NAT

DHCP assigns IP settings and may identify clients by MAC. NAT changes IP addresses at a boundary but does not carry your internal MAC across the internet.

  • DHCP assigns address, mask, gateway, DNS.
  • NAT translates private IP to public IP.
  • MAC changes at routed hops.

5. Troubleshooting

Check both Layer 2 and Layer 3. Correct IP settings do not help if VLAN, ARP, or switch port state is wrong.

  • ipconfig /all
  • ping default gateway
  • arp -a
  • show interfaces status

IP Address vs MAC Address: Layer 3 and Layer 2: Frequently Asked Questions

Is MAC the same as IP?

No. MAC is Layer 2 and IP is Layer 3.

Does my MAC reach the internet?

No. Routers rewrite Layer 2 frames at each hop.

What command shows IP-to-MAC mappings?

Use show arp on Cisco, arp -a on Windows, or ip neigh on Linux.

Follow a Packet from One Host to Another

When a host sends traffic, it first compares the destination IP address with its own address and subnet mask. If the destination is local, the host uses ARP to learn the destination MAC address. If the destination is remote, the host keeps the remote IP address in the packet but resolves the MAC address of its default gateway. The Ethernet frame therefore changes at every routed hop, while the original source and destination IP addresses normally remain end to end.

A switch learns source MAC addresses and records the port where each address was seen. It forwards a known unicast frame toward the matching port, floods an unknown unicast inside the VLAN, and does not make an IP routing decision. A router removes the incoming Layer 2 frame, checks the IP routing table, reduces TTL, selects a next hop, and builds a new frame for the outgoing link.

Use ARP and Neighbor Tables as Evidence

If a local IPv4 destination cannot be reached, verify that both hosts use the correct mask and VLAN, then inspect the ARP cache. An incomplete ARP entry means the sender asked for a MAC address but did not receive a usable reply. Possible causes include a VLAN mismatch, offline destination, duplicate IP, port security, wireless isolation or a Layer 2 path failure. On a router, compare show ip arp, the interface state and the MAC address table on the connected switch.

For IPv6, Neighbor Discovery performs related address-resolution and reachability functions using ICMPv6 rather than ARP. Filtering all ICMPv6 can therefore break essential IPv6 behavior.

Addresses Can Change for Different Reasons

A DHCP lease can change a host’s IP address without changing its network-interface MAC address. Replacing a network adapter can change the MAC while the device receives a similar IP configuration. NAT can translate the source or destination IP at a network boundary, but it does not carry the original Ethernet MAC address across routers. This distinction is important when interpreting firewall, DHCP, switch and application logs.

Use the IP Location Finder for public address, ASN and provider context, the DHCP guide for dynamic addressing, the NAT guide for translation, and the switching practice test to reinforce Layer 2 behavior.

IP Address vs MAC Address: Layer 3 and Layer 2: Tags and Keywords

IP address vs MAC address, ARP, Layer 2, Layer 3, switching, routing, DHCP, NAT, show arp, network troubleshooting