100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Python

MAC Addressing and Switching

How 48-bit MAC addresses identify devices and how switches learn and use them to forward frames.

Physical & Data Link LayerIntermediate10 min readJul 8, 2026
Analogies

Introduction

A MAC (Media Access Control) address is a hardware identifier assigned to a network interface, used at the data link layer to identify devices on a local network segment. Switches use MAC addresses to decide where to forward frames within a LAN, which is fundamentally different from how routers use IP addresses to forward packets between networks.

🏏

Cricket analogy: A player's fixed shirt number stitched onto their kit (their identity within the team) is like a MAC address used by the team's internal roster, fundamentally different from the ICC's country codes used to route a player between international squads, like IP addresses between networks.

Explanation

A MAC address is 48 bits long, typically written as six pairs of hexadecimal digits separated by colons or hyphens, e.g. 00:1A:2B:3C:4D:5E. The first 24 bits (three octets) form the Organizationally Unique Identifier (OUI), assigned by the IEEE to the manufacturer of the network interface; the remaining 24 bits are assigned by the manufacturer to uniquely identify that specific interface. MAC addresses are intended to be globally unique and are burned into the network interface hardware (though they can be overridden in software).

🏏

Cricket analogy: A player's shirt number is really two parts — the first three digits show which academy trained them (like the IEEE-assigned OUI for the manufacturer) and the last three uniquely identify the individual player, permanently sewn on but technically replaceable, just like a MAC address's manufacturer prefix and unique suffix.

A switch is a Layer 2 device that connects multiple devices on a LAN and forwards Ethernet frames based on destination MAC addresses. It maintains a forwarding table, often called a MAC address table or CAM (Content Addressable Memory) table, that maps MAC addresses to the physical switch ports on which those addresses were last seen.

🏏

Cricket analogy: A team's dressing-room attendant keeps a running list of which peg each player's kit hangs on, so when a message arrives for a specific player, it goes straight to their peg instead of being shouted at the whole room, just like a switch's CAM table mapping MAC addresses to ports.

The switch learns MAC addresses dynamically: whenever a frame arrives on a port, the switch reads the frame's source MAC address and records (or updates) an entry mapping that source MAC to the incoming port, along with a timestamp/aging timer. This is called MAC address learning, and it happens continuously and automatically as traffic flows through the switch.

🏏

Cricket analogy: Every time a player checks into the dressing room through a specific door, the attendant notes which door they used and updates the peg list, refreshing the note each time so it doesn't go stale, just like a switch learning source MAC addresses and updating its table with an aging timer.

The forward-vs-flood decision works like this: when a frame arrives, the switch looks up the frame's destination MAC address in its CAM table. If a matching entry exists, the switch forwards the frame only out the specific port associated with that MAC address (unicast forwarding) — it does not send it out other ports. If no matching entry exists (the destination MAC is unknown to the switch), or if the destination is the broadcast address (FF:FF:FF:FF:FF:FF), the switch floods the frame out every port except the one it arrived on, so it reaches every device on the segment; whichever device owns that MAC will respond, letting the switch subsequently learn its location from the reply's source address.

🏏

Cricket analogy: If the dressing-room attendant knows exactly which peg a message is for, they deliver it straight there; but if the recipient's peg is unknown, they announce it to the whole room until the right player responds, after which the attendant notes their peg for next time, just like a switch's forward-versus-flood decision and subsequent learning.

Example

python
# Simplified simulation of switch MAC learning and forward/flood logic
cam_table = {}   # mac_address -> port

def receive_frame(src_mac, dst_mac, in_port, all_ports):
    # Step 1: learn the source MAC on the incoming port
    cam_table[src_mac] = in_port

    # Step 2: decide forward vs flood based on destination MAC
    if dst_mac in cam_table:
        out_port = cam_table[dst_mac]
        print(f"Forward: frame from {src_mac} to {dst_mac} sent only out port {out_port}")
    else:
        flood_ports = [p for p in all_ports if p != in_port]
        print(f"Flood: {dst_mac} unknown, frame sent out ports {flood_ports}")

ports = [1, 2, 3, 4]
# Frame 1: host on port 1 sends to an unknown MAC -> flood
receive_frame("AA:AA:AA:00:00:01", "BB:BB:BB:00:00:02", in_port=1, all_ports=ports)

# Frame 2: the host with BB:BB:BB:00:00:02 replies from port 3 -> switch learns it
receive_frame("BB:BB:BB:00:00:02", "AA:AA:AA:00:00:01", in_port=3, all_ports=ports)

# Frame 3: port 1 sends to BB:BB:BB:00:00:02 again -> now a known entry, forward only
receive_frame("AA:AA:AA:00:00:01", "BB:BB:BB:00:00:02", in_port=1, all_ports=ports)

Analysis

Running the simulation above shows the classic learn-then-forward pattern: the first frame to an unknown destination is flooded to all ports (except the source), which lets the destination device see it and reply; that reply lets the switch learn the destination's real MAC-to-port mapping; from then on, matching traffic is forwarded efficiently to only the correct port instead of flooding. This is strictly a Layer 2 process based on MAC addresses within a single broadcast domain — it should never be confused with routing, which is a Layer 3 process using IP addresses to move packets between different networks/subnets. A switch has no concept of IP addresses in its core forwarding decision; a router has no concept of MAC-address-based flooding across a whole segment.

🏏

Cricket analogy: The first time a new substitute's name is called, the whole dressing room has to be told who they are before someone points them to their peg; after that, messages go straight there — but this internal dressing-room system is nothing like the ICC's international transfer paperwork that moves players between entirely different countries, which is a completely separate process, like Layer 3 routing versus Layer 2 switching.

Key Takeaways

  • A MAC address is 48 bits, written as six hex octets; the first 24 bits (OUI) identify the manufacturer.
  • Switches learn MAC addresses by recording the source MAC and incoming port of every frame they see.
  • If the destination MAC is known in the CAM table, the switch forwards the frame out only that port; if unknown (or broadcast), it floods out all other ports.
  • Switching (Layer 2, MAC-based, single segment) is fundamentally different from routing (Layer 3, IP-based, across networks).

Practice what you learned

Was this page helpful?

Topics covered

#Python#ComputerNetworksStudyNotes#ComputerNetworks#MACAddressingAndSwitching#MAC#Addressing#Switching#Explanation#StudyNotes#SkillVeris

Frequently Asked Questions

21 categories · pick one to explore

Where can I get free study notes for programming and tech subjects?
SkillVeris offers completely free study notes covering programming and tech subjects, with no signup fees or paywalls. The notes are structured by course and topic, written for quick understanding, and enriched with the Learn Through Hobbies analogy method, so you can revise concepts through cricket, music, gaming, cooking and more.
Are SkillVeris study notes good for exam revision?
Yes, the study notes are designed for efficient revision: each topic answers its heading immediately, keeps explanations concise, and links to related glossary terms and cheat sheets. Students preparing for university exams or certification tests use them as quick revision notes because they distil concepts without the padding of full textbooks.
What subjects do the free study notes cover?
The study notes span the platform's main domains, including AI and machine learning, Python and programming, web development, DevOps, cloud, security and databases. Coverage mirrors the 37 live courses, so notes exist for the topics you are actually studying, and new note sets are added as courses launch.
How are SkillVeris study notes different from regular textbooks?
The notes are answer-first, concise and free, whereas textbooks are long and often expensive. Each section explains one concept directly, then reinforces it through selectable hobby analogies like cricket or cooking. Notes also cross-link to the glossary, blog and cheat sheets, letting you jump to related material instantly instead of flipping pages.
Can I use the developer study material without creating an account?
The study notes are free to access, and SkillVeris does not charge anything for its developer study material at any point. Browsing notes is straightforward from the Study Notes section, and if you want progress tracking, certificates and AI Mentor conversations tied to your learning, a free account unlocks those extras.
Do the study notes explain concepts with analogies?
Yes, this is a signature SkillVeris feature. Study notes use the Learn Through Hobbies method, explaining technical concepts through analogies from twelve domains including cricket, music, gaming, photography, travel, movies, fitness, chess, cooking, finance, business and sports. You can switch the analogy domain instantly to whichever hobby makes the concept click.
Are the revision notes suitable for last-minute exam preparation?
Yes, revision notes on SkillVeris work well for last-minute preparation because every section states the answer in its first sentences, so skimming is genuinely effective. Pair them with the relevant cheat sheet for formulas and syntax, and use the glossary for any unfamiliar term you meet while cramming.
Is there free study material for AI and machine learning?
Yes, SkillVeris provides free study notes across its AI and ML catalogue, covering Python for AI, deep learning frameworks like PyTorch and TensorFlow, Hugging Face Transformers, Large Language Models, RAG, AI agents and MLOps. All of it is free, making it a strong resource for Indian students and global learners alike.
Can beginners understand the study notes, or are they for experts?
Beginners can absolutely use them. The notes are written in plain language, define terms as they appear, and lean on hobby analogies to make abstract ideas concrete. Difficulty scales with the underlying course level, so beginner-course notes stay gentle while advanced-course notes go deeper, and the glossary supports you throughout.
How do study notes connect with SkillVeris courses?
Study notes are organised by course and topic, so they map directly to the structured courses and their 24–40-lesson curriculum. Many learners study a lesson first, then use the matching notes for revision before module assessments and the final exam, where 80 percent is required to pass and earn the certificate.
Are there study notes for Python specifically?
Yes, Python is well covered through notes tied to the Python-focused courses, including Python for AI and ML. Topics span fundamentals through applied machine learning usage. You can reinforce the notes with Python practice in Code Lab, which runs code in your browser with no installation required.
Do the study notes include code examples?
Yes, study notes include code examples wherever a concept is best shown in code, alongside explanations, key points and analogies. Reading a snippet in the notes and then reproducing it yourself in Code Lab is an effective loop, since Code Lab lets you run code in the browser across six languages.
How often is new study material added to SkillVeris?
Study material grows alongside the course catalogue. Whenever new courses join the platform's 37 live courses, matching study notes, glossary entries and cheat sheets are added so the resources stay in sync. Existing notes are also refined over time, so it is worth revisiting topics you studied earlier.
Can I use SkillVeris notes to prepare for technical interviews?
Yes, the notes make excellent interview revision because they compress each concept into direct, answer-first explanations, which mirrors how you should answer interview questions. Combine them with the SkillVeris interview questions feature, which includes readiness scoring, to test whether your revision has actually made you interview-ready.
Are the study notes mobile-friendly for studying on the go?
Yes, the study notes are built to load fast and read comfortably on mobile devices, so you can revise during a commute or between classes. Sections are short and answer-first, which suits small screens, and analogy switching works on mobile too, letting you study anywhere without carrying books.
What is the difference between study notes and cheat sheets?
Study notes explain concepts in depth with context, examples and analogies, making them ideal for learning and revision. Cheat sheets are compact quick-reference summaries of syntax, commands and key facts, ideal once you already understand a topic. Most learners study the notes first, then keep the cheat sheet handy while coding.
Do study notes help if I am stuck on a course lesson?
Yes, reading the matching study notes often clarifies a lesson because the same concept is explained from a different angle, frequently with a different analogy. If you are still stuck, ask the AI Mentor, which answers 24/7 at Quick, Detailed or Deep-dive depth until the idea genuinely makes sense.
Is there free study material for DevOps and cloud topics?
Yes, SkillVeris carries free study notes for DevOps and cloud topics as part of its coverage across 37 live courses. The material suits learners following the DevOps Engineer or Cloud Engineer paths, and it links to related glossary terms and cheat sheets so you can revise the whole toolchain in one place.
Can school or college students in India use these notes for projects?
Yes, students across India and worldwide use SkillVeris notes for coursework, projects and exam preparation, and everything is free, which matters for student budgets. The notes explain concepts clearly enough to cite in project reports, and Code Lab lets you prototype the project code directly in your browser.
How should I combine study notes with other SkillVeris resources?
A proven loop: learn from a course lesson, revise with the matching study notes, look up unfamiliar terms in the glossary, keep the cheat sheet open while practising in Code Lab, and quiz yourself with interview questions. The AI Mentor fills any remaining gaps 24/7, at whatever depth you need.

What Learners Say

Real journeys from the SkillVeris community — swipe for more.

SkillVeris taught me Python through Cricket. Now I’m building real projects and feeling confident!
Arjun S. · B.Tech Student
The best platform for hobby-based learning. Concepts finally stick.
Priya R. · Data Analyst
I went from zero coding to a portfolio of projects — all by learning through my love for gaming. Landed my first internship!
Kabir M. · CS Undergraduate
Trending Topics50 popular tags — tap to explore
Trending CoursesAll 37 free courses — tap to browse