MAC Address (Media Access Control Address)

A MAC address, also known as a physical address, is a unique identifier assigned to a Network Interface Card (NIC). It cannot be changed and is present in all internet-capable devices like computers, phones, printers, Wi-Fi routers, USB ports, and Bluetooth modules.

Each device may have multiple NICs (e.g., Wi-Fi, USB, Bluetooth), meaning it can have multiple MAC addresses.

Structure of a MAC Address

A MAC address has a fixed format of 48 bits (6 bytes), divided into six portions of 8 bits each. It is represented in hexadecimal (base 16):

00:00:00:00:00:00  →  FF:FF:FF:FF:FF:FF

There are 2^48 possible MAC addresses.

MAC Address Distribution

MAC addresses are systematically assigned:

  • First 24 bits → Assigned to organizations (e.g., Google, Facebook).
  • Last 24 bits → Assigned by the organization to its products.

For example, Google receives a block of 2^24 MAC addresses and assigns them to its devices.


Data Link Layer (DLL)

The Data Link Layer (DLL) ensures hop-to-hop delivery using MAC addresses.

How Devices Identify Each Other in a LAN

  1. A router assigns private IP addresses to each device in a Local Area Network (LAN).
  2. All devices share the same public IP for external communication.
  3. When Device A wants to send data to Device B, it first needs B’s MAC address.
  4. The Address Resolution Protocol (ARP) is used:
    • Device A broadcasts: "Who has this IP address? Send me your MAC address."
    • Device B responds with its MAC address.
    • Device A sends the data to B.

Why Use MAC Addresses When We Have IP Addresses?

IP addresses can change, but MAC addresses remain fixed.

✔ MAC addresses work at Layer 2 (Data Link Layer), while IP addresses work at Layer 3 (Network Layer).

Within a LAN, data must be delivered to the exact device, requiring MAC addresses.

✔ When sending data outside the LAN, the IP stays the same, but the MAC address changes at each router.

💡 Think of it like parcel delivery:

  • IP address = Destination city
  • MAC address = Delivery truck (changes at each stop)

MAC Addresses in Crime Investigation

Since IP addresses can change, but MAC addresses remain fixed, law enforcement can trace devices involved in cybercrimes—even if the IP is altered.


Functions of the Data Link Layer (DLL)

1. Framing

📌 The Network Layer sends data with source & destination IPs.

📌 The DLL adds source & destination MAC addresses, creating a frame.

📌 The receiver detects the data using a specific bit pattern:

  • It starts with 7-bit synchronization bits (101010...1010).
  • When it sees 11, it knows real data is coming.

2. Error Detection & Handling

✔ The DLL detects errors (e.g., signal corruption) and prevents faulty data from being forwarded.

3. Flow Control

Problem: A sender may send more data than a router can handle, leading to packet loss.

  • If a router can handle only 100 packets at a time, sending 1,000 packets at once will result in data loss. 🚨

Solution? ✅ Break it into 10 chunks of 100 packets to ensure smooth delivery! 📦📦📦.

  • The router then signals: "Send more data, I’m ready."

💡 Real-world example: If you have 100MB storage, but send 500MB, it won’t fit. Instead, send it in chunks.

4. Access Control

Problem: In a bus topology, multiple devices share a network wire. If two devices send data at the same time, collisions occur.

Solution: The DLL ensures only one device sends data at a time, preventing corruption & congestion.


Network Layer (NL)

1. Packet Routing

✔ The Network Layer decides the best path for data.

Routers guide packets from one router to another until they reach their destination.

2. Fragmentation & Reassembly

Problem: Some routers cannot handle large packets.

Example: A 5MB packet arrives at a router that can only handle 2.5MB.

Solution:

  • The Network Layer splits data into smaller fragments before sending it.
  • At the destination, fragments are reassembled into the original data.

3. Congestion Control

Problem: Too many devices send data at once, slowing down the network.

Solution: The Network Layer:

Limits the number of packets sent to avoid congestion.

Manages bandwidth (controls data transfer speed).


Conclusion

MAC addresses are fixed, while IP addresses can change.

The Data Link Layer ensures error handling, access control, & framing.

The Network Layer handles routing, fragmentation, & congestion control.