mac and ip addresses
03/30/2026
understanding network identity, routing, and local delivery
MAC and IP Addresses: The Basics of Network Identity
To understand how computer networks function, you have to look at how data finds its way from one device to another. This entire system relies on a layered addressing architecture. At the foundation of this architecture are two essential identifiers: the Media Access Control (MAC) address and the Internet Protocol (IP) address.
While a beginner might confuse the two, they operate at completely different layers of the network. The MAC address is a physical identifier used for local hardware-to-hardware communication. The IP address is a logical identifier used to route data across the global internet. Understanding how these two systems interact is a fundamental requirement for computer science and cybersecurity.
The MAC Address: Physical Identification
The Media Access Control (MAC) address is the permanent physical identity of a device’s Network Interface Controller (NIC). Every piece of hardware that connects to a network, whether it is a laptop, a server, or a smartphone, is assigned a unique MAC address at the factory.
Core Characteristics
- Permanence: A MAC address is burned into the hardware’s read-only memory. Unlike an IP address, your device’s MAC address does not change when you move from your home Wi-Fi to a university network.
- Format: A standard MAC address is 48 bits long. For human readability, it is written as twelve hexadecimal digits, typically separated by colons (e.g., 00:1A:2B:3C:4D:5E).
- Scale: A 48-bit address space provides over 281 trillion unique combinations, ensuring global uniqueness for all manufactured network hardware.
How a MAC Address is Structured
To guarantee that no two devices in the world have the same MAC address, the 48 bits are divided into two equal sections:
- The Organizationally Unique Identifier (OUI): The first 24 bits are assigned to the hardware manufacturer (like Cisco, Apple, or Intel) by a global registry.
- The Device ID: The final 24 bits act as a unique serial number assigned by that manufacturer to the specific network card.
Local Network Delivery
MAC addresses are only used on local networks (Layer 2 of the OSI model). They do not cross routers and do not travel over the internet. Local network switches use MAC addresses to direct traffic. A switch maintains a “CAM table” in its memory, which maps the MAC addresses of connected computers to specific physical ports on the switch. When data arrives, the switch reads the destination MAC address and forwards the electrical signal only to the correct port, keeping the network efficient.
The IP Address: Logical Routing
If the MAC address identifies the physical hardware, the Internet Protocol (IP) address identifies the device’s logical location on the network. Operating at the Network Layer (Layer 3), IP addresses are what allow data packets to be routed across different networks and over the global internet.
Dynamic Allocation (DHCP)
IP addresses are not permanent. They are leased to your device. When you connect to a network, a protocol called DHCP (Dynamic Host Configuration Protocol) assigns your device an available IP address from a local pool. When you disconnect, that IP address is returned to the pool for another device to use.
Public vs. Private IP Addresses and NAT
In modern networks, there is a strict division between public and private IP space:
- Public IPs: These are globally unique and routable on the open internet. Your Internet Service Provider assigns one Public IP to your home router.
- Private IPs: These are reserved for internal use inside a home or office (e.g., 192.168.1.5). They cannot be routed on the internet.
To allow multiple devices with Private IPs to share a single internet connection, routers use Network Address Translation (NAT). NAT modifies outbound data packets, swapping your device’s Private IP for the router’s Public IP. When the internet sends data back, the router translates it back to the correct internal device.
IPv4 vs. IPv6 Standards
The internet relies on two versions of the Internet Protocol:
- IPv4: The older standard, using a 32-bit format (e.g., 192.168.1.1). It supports about 4.3 billion addresses. Because this is not enough for modern needs, the industry is transitioning to the newer standard.
- IPv6: The modern standard, using a 128-bit hexadecimal format (e.g., 2001:0db8::8a2e). It provides a virtually infinite supply of addresses ($3.4 \times 10^38$) and includes mandatory structural improvements for faster routing.
Connecting the Two: The ARP Process
For network communication to work, data needs both addresses. The IP address provides the routing directions, but local hardware, like switches and cables, only understands MAC addresses.
The mechanism that translates a logical IP address into a physical MAC address is the Address Resolution Protocol (ARP).
How ARP Works
When your computer wants to send data to a local server (for example, IP 192.168.1.50), it needs the server’s MAC address to build the data frame. It finds it using these steps:
- The Broadcast Request: Your computer sends an ARP Request to every device on the local network. The message asks: “Who has IP address 192.168.1.50? Please reply with your MAC address.”
- The Unicast Reply: All devices receive the broadcast, but only the server with that exact IP address responds. It sends an ARP Reply directly back to your computer containing its MAC address.
- The Cache: Your computer stores this IP-to-MAC mapping in a temporary memory table called the ARP Cache, so it does not have to ask again for future data transfers.
Following the Data: The Hop-by-Hop Rule
A common challenge for first-year networking students is understanding what happens to these addresses as data travels across the internet through multiple routers.
There is a strict rule governing this process: IP addresses determine the end-to-end global path. MAC addresses handle the physical link between individual nodes.
When you send a request to a website:
- The IP Addresses remain constant: The Source IP (your computer) and Destination IP (the web server) do not change during the entire journey.
- The MAC Addresses change at every hop: A MAC address cannot cross a router. When your data reaches your local router, the router removes the old MAC addresses. It checks the IP address to decide where the data needs to go next, and then adds brand new Source and Destination MAC addresses to send the data across the next physical cable to the next router. This stripping and rewriting of MAC addresses happens at every single router until the data reaches the final server.
Common Security Vulnerabilities
Because these addressing protocols were designed decades ago when networks were small and trusted, they lack built-in security. This makes them common targets for network attacks.
- ARP Spoofing: Because ARP requests do not require authentication, an attacker can send fake ARP replies to a network. They can trick a victim’s computer into associating the attacker’s MAC address with the router’s IP address. This causes the victim’s computer to send all its internet traffic directly to the attacker, allowing them to intercept or modify the data.
- MAC Flooding: A network switch only has a limited amount of memory to store MAC addresses. An attacker can use software to generate thousands of fake MAC addresses instantly, overflowing the switch’s memory. When this happens, the switch defaults to a fail-safe mode where it broadcasts all network traffic to every connected port, allowing the attacker to capture data meant for other users.
- IP Spoofing: Attackers can falsify the source IP address in a data packet to impersonate a legitimate device, often to bypass basic security filters or to execute Denial of Service (DoS) attacks.
Network administrators mitigate these risks by configuring hardware switches with features like Dynamic ARP Inspection (to block fake ARP packets) and Port Security (to limit how many MAC addresses can connect to a single port).
Summary
The architecture of digital addressing is built on a necessary division of labor. The MAC address provides the permanent hardware identity required for devices to exchange electrical signals on a local network. The IP address provides the logical, hierarchical structure required to route data across the global internet.
Without the physical certainty of MAC addresses, local networks would fail. Without the logical flexibility of IP addresses, global routing would be impossible. Mastering how these two protocols interact is the foundation of network engineering and cybersecurity.