Packet Routing: IP vs MAC
In this interactive module, we will explore how data travels across the internet. You will learn the logical distinction between an IP address and a MAC address, visualize how packet headers change from router to router, and understand the core principles of Encapsulation.
Transmission Simulator
Sender
Computer A (Home)
MAC: 00:1A:2B:3C:4D:5E
Router 1
Home Router
Router 2
ISP Router
Receiver
Game Server
MAC: FF:EE:DD:CC:BB:AA
Click "Start Journey" to track the journey of the packet. Pay close attention to how the MAC address changes on the right!
Live Packet Header
Headers act like the shipping labels on a package. Watch how they change!
Network Layer - IP IP addresses ensure the packet reaches its final destination across different networks. It acts like the recipient's address on a letter.
Source IP
192.168.1.50
Destination IP
Match!210.3.4.88
Data Link Layer - MAC MAC addresses ensure the frame reaches the next direct hop within the same local network. It is discarded and recreated at every router.
Source MAC
--:--:--:--:--:--
Destination MAC
Match!--:--:--:--:--:--
Under the Hood: Structuring a Packet
How do programmers define a network packet in software? Let's look at a simplified logical structure demonstrating the separation of MAC (Layer 2) and IP (Layer 3) headers.
Think & Link: The Real-world Analogy
IP Address = Mailing Address
Just like the destination address written on a letter, the IP Address dictates the ultimate destination. It remains unaltered from the moment it leaves the sender.
MAC Address = Delivery Truck
The MAC address acts like the delivery truck. When a parcel reaches a post office (router), it is unloaded from one truck and loaded onto another. The truck (MAC) changes, but the parcel's address (IP) does not.
Critical Thinking: Why must the router discard the old MAC address instead of keeping it?
Draft your logic below before checking the explanation. Formulating your own answer strengthens logical deduction.
Detailed Explanation
A MAC address is only valid within its own Local Area Network (LAN). A router connects different networks. When a frame arrives at a router, the router performs Decapsulation (stripping the old MAC header because the old delivery truck has reached its limit). It then checks the IP address to determine the next path, and performs Encapsulation, attaching a new MAC header (a new truck) that points to the next router's hardware address.
Common Misconceptions
Myth: IP Addresses change every time they pass through a router.
Fact: Think of the IP address as the ultimate destination on a package. Unless Network Address Translation (NAT) is involved, it stays the exact same from the very beginning to the very end. The router only changes the MAC address (the local delivery truck) to move it to the next stop.
Key Takeaways
- IP Address tells us the final destination across the entire internet.
- MAC Address tells us the next immediate machine on the same physical link or network segment (like from your computer to your home router).
- Routers perform Decapsulation (unpacking the old MAC box) and Encapsulation (packing into a new MAC box) without touching the IP address.
Mini Quiz: Concept Check
Ensure you have fully grasped the concepts of Layer 2 and Layer 3 headers.