Mac Address | Cyber Security Tutorial - Learn with VOKS
Back Next

Mac Address


What Is a MAC Address?

A MAC Address (Media Access Control Address) is a unique identifier assigned to a device’s network interface. This includes devices like:

  • Laptop network cards
  • Desktop Ethernet cards
  • Wi-Fi adapters
  • Smartphones
  • Routers

It is used for communication within a local network (like your home or office network).

Think of a MAC address like a physical serial number for your network card. While an IP address can change, a MAC address is usually fixed to the hardware.

Where Does a MAC Address Work?

A MAC address works at Layer 2 (Data Link Layer) of the OSI model.

It is used when devices communicate inside the same local network (LAN). For example:

  • Your computer sends data to your router.
  • Your router sends data to another device inside your home network.

Before sending data, the device must know the MAC address of the destination device.

MAC Address vs IP Address (Simple Comparison)

+----------------------------+----------------------------------+
| MAC Address                | IP Address                       |
+----------------------------+----------------------------------+
| Permanent (usually)        | Can change                       |
| Hardware-based             | Software/network-based           |
| Works inside local network | Works across networks (internet) |
| 48-bit value               | 32-bit (IPv4) or 128-bit (IPv6)  |
+----------------------------+----------------------------------+


In simple words:

  • MAC address = Who exactly are you? (physical identity)
  • IP address = Where are you located in the network?

MAC Address Format

A MAC address is:

  • 48 bits long
  • Written as 6 pairs of hexadecimal numbers
  • Each pair is separated by a colon or dash

Example:

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

Or

00-1A-2B-3C-4D-5E

Each pair represents 8 bits (1 byte).

Hexadecimal uses numbers 0–9 and letters A–F.

Structure of a MAC Address

Example:

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

It is divided into two parts:

  1. First 3 bytes (00:1A:2B)
  • Called OUI (Organizationally Unique Identifier)
  • Identifies the manufacturer
  • Assigned by IEEE
  1. Last 3 bytes (3C:4D:5E)
  • Unique number given by the manufacturer

This ensures no two devices in the world should have the same MAC address.

How MAC Address Is Used (Step-by-Step Example)

Suppose:

  • Your computer wants to send data to your router.
  • It knows the router’s IP address.
  • But it needs the router’s MAC address to send data inside the local network.

It uses ARP (Address Resolution Protocol):

  1. Computer broadcasts:
  2. "Who has IP 192.168.1.1?"
  3. Router replies:
  4. "I am 192.168.1.1, my MAC is 00:1A:2B:3C:4D:5E"
  5. Computer stores this in ARP table.
  6. Data is sent using the MAC address.

How to Find Your MAC Address

On Windows

Open Command Prompt and type:

ipconfig /all

Look for:

Physical Address . . . . . . . . : 00-1A-2B-3C-4D-5E

On Linux

ip addr

or

ifconfig

On macOS

ifconfig

Can a MAC Address Be Changed?

Yes.

Although it is burned into hardware, most operating systems allow MAC spoofing, which means temporarily changing the MAC address in software.

Example (Linux):

sudo ip link set dev eth0 down
sudo ip link set dev eth0 address 00:11:22:33:44:55
sudo ip link set dev eth0 up

This changes the MAC address of interface eth0.

Why MAC Addresses Are Important

  1. Device identification inside a LAN
  2. Network security filtering (MAC filtering in routers)
  3. ARP communication
  4. Switch forwarding decisions

Network switches use MAC addresses to know where to send data.

How Switches Use MAC Addresses

When a switch receives a frame:

  1. It checks the source MAC address.
  2. It stores it in a MAC address table.
  3. When sending data, it checks the destination MAC.
  4. It forwards data only to the correct port.

This prevents unnecessary traffic.

Broadcast MAC Address

There is a special MAC address:

FF:FF:FF:FF:FF:FF

This means:

Send to everyone in the network.

ARP requests use broadcast MAC addresses.

Types of MAC Addresses

  1. Unicast – One device to one device
  2. Broadcast – One device to all devices
  3. Multicast – One device to a group of devices

Important Notes for Beginners

  • MAC address works only inside local network.
  • It does not travel across the internet.
  • Routers remove Layer 2 headers when forwarding traffic.
  • Your ISP does not use your MAC address to route internet traffic globally.


Example Code:
# Windows - View MAC Address
ipconfig /all

# Linux - View MAC Address
ip addr
ifconfig

# macOS - View MAC Address
ifconfig

# Linux - Change MAC Address (MAC Spoofing)
sudo ip link set dev eth0 down
sudo ip link set dev eth0 address 00:11:22:33:44:55
sudo ip link set dev eth0 up
Cyber Security
Introduction Types of Cyber Threats Cyber Security Domains CIA Triad (Confidentiality Integrity Availability) Career paths in Cyber Security Certifications Ethics and Responsible Disclosure Laws and Regulation (e.g. GDPR, NDPR) What is an OS? Types: Window, Linus, macOS Command-line vs GUI OS Internals Overview (filesystems, processes, permissions) Windows command prompt basics Linux Bash Basics File System Navigation Basic Scripting IP Addressing DNS, DHCP Mac Address OSI VS TCP/IP Models Ports and Protocols (TCP, UDP) Common Protocols (HTTPS, FTP, SSH, etc.) Packet structure Firewalls, IDS/IPS, VPNs Common attacks: MITM, Sniffing Secure Network Practices How the Web works HTTP vs HTTPS URLs, Headers, Cookies Client-Server Architecture Introduction To Web Security OWASP Top 10 Overview Common Threats (XSS, SQLi, CSRF) Inpute validation and authentication flow Basic Exploitation demo (e.g. XSS) Burp Suite Introduction Using a Browser For Testing Password security MFA-Antivirus Cyber Hygeine Practice Intro To Tools: Nmap, Wireshark, Netstat
All Courses
Advance AI Bootstrap C C++ Computer Vision Content Writing CSS Cyber Security Data Analysis Deep Learning Email Marketing Excel Figma HTML Java Script Machine Learning MySQLi Node JS PHP Power Bi Python Python for AI Python for Analysis React React Native SEO SMM SQL