Difference between MAC and IP addresses

Computers and mobiles need two types of addresses to communicate:
MAC Address
IP Address

These two work together to ensure data reaches the correct device.


🔹 1. MAC Address (Media Access Control Address)

Definition

A MAC address is a physical/hardware address built into the Network Interface Card (NIC) by the manufacturer.

Format

  • 48-bit (sometimes 64-bit)
  • Written in hexadecimal
  • Example formats:
    • 00:1A:2B:3C:4D:5E
    • 00-1A-2B-3C-4D-5E

Purpose

Identifies a device within the same local network (LAN).

Scope & OSI Layer

  • Works at Layer 2 (Data Link Layer)
  • Used for communication inside a LAN only

Key Features

  • Permanent (assigned by manufacturer)
  • Unique for every device
  • Does not change, even if you move to a new network

Example

Laptop’s MAC address:
3C:52:82:A3:34:FF


🔹 2. IP Address (Internet Protocol Address)

Definition

An IP address is a logical address assigned by a network or a router.

Formats

  • IPv4 (32-bit): 192.168.1.1
  • IPv6 (128-bit):
    2001:0db8:85a3:0000:0000:8a2e:0370:7334

Purpose

Used to identify a device across networks (locally + globally).

Scope & OSI Layer

  • Works at Layer 3 (Network Layer)
  • Used for internet-wide communication

Key Features

  • Dynamic (changes when network changes)
  • Can be static (fixed) or dynamic (assigned by DHCP)
  • Changes when device connects to a new Wi-Fi/network

Example

Device IP on home Wi-Fi:
192.168.0.100


🔹 3. MAC vs IP Address

FeatureMAC AddressIP Address
DefinitionPhysical address stored in NICLogical address assigned by network
PurposeIdentifies device inside a LANIdentifies device across networks
ScopeLocal onlyLocal + Global
FormatHexadecimal (48/64-bit)IPv4 (32-bit) / IPv6 (128-bit)
TypePermanentDynamic or static
OSI LayerLayer 2 (Data Link)Layer 3 (Network)
Changes?NoYes
Example00:1A:2B:3C:4D:5E192.168.1.1

🔹 4. How MAC and IP Work Together

When a device sends data:

IP Address

  • Used to find the location of the destination device
  • Works across networks (LAN → Internet → LAN)

MAC Address

  • Used ONLY inside the local network
  • Ensures the data reaches the correct device on the LAN

🔸 Simple Example

  1. Your device sends a packet to gyandesk.info/ using IP address.
  2. Inside your home network, your router uses MAC addresses to deliver the packet to the next device.
  3. Outside the LAN, only IP addresses are used.

🔹 5. Easy Mnemonics

MAC

  • M = Manufacturer (hardware-based)
  • M = Must stay the same (permanent)
  • Local only

IP

  • I = Internet (global)
  • I = It changes (dynamic)
  • Logical address

🔹 6. Applications

✔ Where MAC is used:

  • Wi-Fi communication
  • Ethernet networks
  • Filtering devices (MAC filtering)
  • Device identification

✔ Where IP is used:

  • Internet browsing
  • Online communication, VoIP
  • Email, apps, servers
  • Routing packets across different networks

MCQ

What does MAC in MAC address stand for?
a) Media Access Control
b) Machine Access Code
c) Memory Access Control
d) Media Authentication Code

Answer: a) Media Access Control

Which OSI layer does the MAC address belong to?
a) Layer 1 – Physical Layer
b) Layer 2 – Data Link Layer
c) Layer 3 – Network Layer
d) Layer 4 – Transport Layer

Answer: b) Layer 2 – Data Link Layer

An IP address operates at which OSI layer?
a) Layer 1 – Physical Layer
b) Layer 2 – Data Link Layer
c) Layer 3 – Network Layer
d) Layer 4 – Transport Layer

Answer: c) Layer 3 – Network Layer

What type of address is a MAC address?
a) Logical address
b) Temporary address
c) Physical address
d) Virtual address

Answer: c) Physical address

What type of address is an IP address?
a) Logical address
b) Physical address
c) Permanent address
d) Ethernet address

Answer: a) Logical address

Which of the following is a correct format of a MAC address?
a) 192.168.1.1
b) 00:1A:2B:3C:4D:5E
c) 255.255.255.0
d) FF00:AB00:CD12:34FE

Answer: b) 00:1A:2B:3C:4D:5E

What is the length of a MAC address?
a) 16 bits
b) 32 bits
c) 48 bits
d) 64 bits

Answer: c) 48 bits

What is the length of an IPv4 address?
a) 16 bits
b) 32 bits
c) 48 bits
d) 128 bits

Answer: b) 32 bits

Which version of IP uses 128-bit addressing?
a) IPv4
b) IPv6
c) Both IPv4 and IPv6
d) None of these

Answer: b) IPv6

Which protocol dynamically assigns an IP address to devices on a network?
a) DNS
b) DHCP
c) ARP
d) ICMP

Answer: b) DHCP

Which address uniquely identifies a device on a local network?
a) IP address
b) MAC address
c) Subnet mask
d) Default gateway

Answer: b) MAC address

Which address can change when a device moves to another network?
a) MAC address
b) IP address
c) Subnet mask
d) Gateway address

Answer: b) IP address

Which address is globally routable on the internet?
a) IP address
b) MAC address
c) Subnet mask
d) Default gateway

Answer: a) IP address

What happens to a MAC address when a device connects to a new network?
a) It changes dynamically.
b) It remains the same.
c) It is assigned by the router.
d) It is replaced by an IP address.

Answer: b) It remains the same.

What is the primary use of an IP address?
a) To identify devices on the same LAN
b) To identify devices across networks
c) To control access to a device
d) To manage device authentication

Answer: b) To identify devices across networks

Which address is used by switches to forward packets within a LAN?
a) IP address
b) MAC address
c) Subnet mask
d) Gateway address

Answer: b) MAC address

Which address is required for devices to communicate over the internet?
a) MAC address
b) IP address
c) Subnet mask
d) ARP address

Answer: b) IP address

What protocol maps an IP address to a MAC address?
a) DNS
b) ARP
c) DHCP
d) ICMP

Answer: b) ARP

What is the primary role of a router in a network?
a) Assign MAC addresses
b) Forward data packets using IP addresses
c) Create physical connections
d) Assign subnet masks

Answer: b) Forward data packets using IP addresses

Which address is required for Ethernet communication within the same network?
a) IP address
b) MAC address
c) Subnet mask
d) Default gateway

Answer: b) MAC address

Which address is susceptible to spoofing in a local network?
a) IP address
b) MAC address
c) Subnet mask
d) Default gateway

Answer: b) MAC address

Which address is used in IP spoofing attacks?
a) MAC address
b) IP address
c) Subnet mask
d) ARP address

Answer: b) IP address

What is a significant limitation of a MAC address?
a) Cannot be spoofed
b) Cannot identify devices globally
c) Changes with network
d) Limited to IPv4 networks

Answer: b) Cannot identify devices globally

How is a static IP address different from a dynamic IP address?
a) It is assigned manually and remains fixed.
b) It is assigned by the MAC address.
c) It changes automatically when needed.
d) It is encrypted for security.

Answer: a) It is assigned manually and remains fixed.

Which address is used in device authentication for network security?
a) MAC address
b) IP address
c) Subnet mask
d) Gateway address

Answer: a) MAC address


Focus Areas:

  1. MAC Address: Physical, fixed, used in local communication, Layer 2.
  2. IP Address: Logical, dynamic or static, used globally, Layer 3.
  3. Understand the roles of ARP (maps IP to MAC) and DHCP (assigns IPs).
  4. Differences between IPv4 (32-bit) and IPv6 (128-bit).
  5. Remember that MAC identifies devices locally, and IP identifies devices across networks.