Software-Engineering

MAC Address

What is a MAC Address?

A MAC Address (Media Access Control Address) is a unique hardware identifier assigned to every network interface such as a mobile phone, laptop, Wi-Fi card, or Ethernet card.

A MAC address can be thought of as the fingerprint of a device within a local network.


Why is a MAC Address Used?

MAC addresses are used to identify devices inside a local network (LAN) and to ensure data reaches the correct physical device.

Main uses:

Without MAC addresses, local network communication is not possible


Where Does a MAC Address Work?

A MAC address operates at Layer 2 (Data Link Layer) of the OSI Model.

It is used in:

⚠️ Important:


How Does a MAC Address Work?

Example:

Step-by-step flow:

  1. Laptop A knows the IP address of Laptop B
  2. Laptop A uses ARP to ask:

    “What is the MAC address of this IP?”

  3. Laptop B replies with its MAC address
  4. Laptop A sends data using:
    • Destination MAC = Laptop B’s MAC address
  5. The switch forwards the data based on the MAC address

Why is a MAC Address Important?

MAC addresses are important because:

IP addresses can change, but MAC addresses usually remain the same


MAC Address vs IP Address

Feature MAC Address IP Address
Type Hardware address Logical address
OSI Layer Layer 2 (Data Link) Layer 3 (Network)
Assigned by Manufacturer Router / ISP
Changes? Rarely Frequently
Scope Local network only Local + Internet
Example 00:1A:2B:3C:4D:5E 192.168.1.10

Simple analogy:

Delivery process: