I'm writing this article after drinking a couple of beers. It will not be formal and concise, but it is my spontaneous moment.
Although we have heard about MAC and IP many times, have you ever wondered why both exist, or how they each play their part in networking?
In this article, we're going to find answers to the following questions:
- What are the current use cases of MAC and IP addresses?
- Do we have a non-tech example to understand better?
- Why do we need IP addresses when we already have MAC addresses?
- Why don't we use dynamic MAC addresses?
What are the current use cases of MAC and IP Addresses?
In real networking, the IP address is what routers use to send data to the destination network. Then, at the final hop, the MAC address is used by switches to determine the destination device (the one with that MAC).
- Definition: A hardware identifier assigned to a network interface card (NIC). It’s usually written in a format like AA:BB:CC:DD:EE:FF.
- Feature: Assigned (often randomly) by the manufacturer, making it globally unique.
- Main Use: Local network communication. Switches use MAC addresses to determine which device should receive data within a Local Area Network (LAN).
- Definition: A logical address assigned to a device. Typically written in dotted decimal format like 192.168.1.10 (IPv4) or something longer like 2001:db8::abcd (IPv6).
- Feature: Allocated in a hierarchical manner (network portion vs. host portion).
- Main Use: Routing data between different networks. Routers look at IP addresses and forward packets along the best path to reach their destinations across the internet.
How They Fit in the OSI Model
- Layer 3 (Network Layer): During the initializing flow, transport-layer segments encapsulated with an IP header (including source and destination IP addresses), forming an IP packet. In the forwarding phase, routers parse headers to route packets to the destination network.
- Layer 2 (Data Link Layer): At this layer, IP packets are encapsulated with a data link header containing source and destination MAC addresses, creating a frame. Switches parse these headers to forward frames to destination devices.
A Non-Tech Analogy: Identity Card vs. Home Address
In the delivery system for personal documents, we can think of it as your identity card number (MAC) and your home address (IP).
- Street Address / IP: Let's the post office know which neighborhood or city to send your document, even if you move across the country.
- Identity number / MAC: Unique to you (you just get a new street address, but your identity is still the same person). When the carrier hands off your document, they confirm it’s actually for you.
Why do we need IP Addresses when we already have MAC Addresses?
If every device already has a unique hardware address (MAC), why bother assigning IP addresses for routing?
- Scalability: MAC addresses are flat—no hierarchy—so if we relied on MAC-based routing across the entire internet, routers would need to keep track of every device on Earth. IP addresses, on the other hand, are structured: we use things like CIDR (Classless Inter-Domain Routing) to group ranges of IPs so routers only need to store broad network routes. This hierarchical approach keeps router tables manageable.
- Layer Separation: Dividing tasks between Layer 2 (MAC) and Layer 3 (IP) keeps the system modular and flexible. If we upgrade from IPv4 to IPv6, we don’t have to change every underlying link-layer technology. Likewise, we can develop new link-layer standards (like Wi-Fi 6 or beyond) without overhauling the entire internet’s IP-based routing.
Why don't we use dynamic MAC Addresses?
MAC addresses are only used to identify the destination node in a network. Why don't we assign MAC addresses dynamically when a device joins a network?
- Added Complexity: Assigning MAC addresses dynamically would require a new protocol or system to manage them—something like DHCP but for Layer 2. This adds overhead to network setup and maintenance without a clear, widespread benefit over the current system.
- Security Challenges: Some security features, like MAC address filtering or port security on switches, rely on knowing a device’s specific, unchanging MAC address. Dynamic MACs would make these harder to implement.
- Tracing MACs are assigned at the factory, which ensures that each physical device is globally unique from day one. It helps trace network events history more effectively and reliably.
References:
Full Digitalized Chief Operation Officer (FDO COO) | First cohort within "Coca-Cola Founders" - the 1st Corporate Venture funds in the world operated at global scale.
1 周New perspective???