Switching in Computer Networks

Ka Kavitha V Updated 08 Oct 2026
7 min read ·Lesson 18 of 45

Switching

Switching is the process of receiving data from one device and forwarding it only to the device it's actually meant for, instead of broadcasting it to everyone on the network. It's the mechanism that lets dozens or thousands of devices share the same Local Area Network (LAN) without drowning each other in unnecessary traffic.

What Is Switching?

Switching is the process of transferring data from one device to another through a computer network by selecting the most appropriate communication path, so that the information reaches the correct destination instead of every connected device.

Real-world example. Imagine a courier company. If you send a parcel to a friend, the courier delivers it only to your friend's address — not to every house in the city. A network switch behaves the same way: it delivers data only to the intended device, rather than broadcasting it to everything connected to the network.

Why Switching Matters

Early networks relied on devices that simply copied every signal to every connected device. As networks grew larger, that approach broke down:

  • Heavy, unnecessary network traffic
  • Frequent data collisions
  • Reduced performance
  • Weaker security, since every device could see every other device's traffic
  • Wasted bandwidth

Switching was introduced specifically to solve these problems, by learning where each device is and forwarding data only along the path that leads there. This has several concrete benefits:

  • Efficient bandwidth usage — data is only sent where it's needed.
  • Fewer collisions — a switch gives each connected device its own dedicated path, largely eliminating the collisions that plagued older shared-media networks.
  • Better performance — less unnecessary traffic means a faster network overall.
  • Improved security — since data isn't broadcast everywhere, other devices on the same network can't casually observe traffic that isn't addressed to them.

From Hubs to Switches

Early LANs used hubs: a hub receives a signal on one port and blindly repeats it out to every other port, regardless of who the intended recipient is. This caused heavy congestion, frequent collisions, poor bandwidth efficiency, and weak security, since every device saw every other device's traffic.

Switches solved these problems with intelligent forwarding: instead of broadcasting everything, a switch identifies the destination device using its hardware address and forwards each frame only to the port that device is connected to. This delivers faster communication, better security, reduced congestion, and far more efficient use of available bandwidth — which is why switches have almost entirely replaced hubs in modern networks.

What Is a Network Switch?

A network switch is a networking device that connects multiple devices within the same Local Area Network (LAN) — computers, laptops, servers, printers, IP phones, wireless access points, and network storage devices, among others. Its core responsibility is to receive incoming data and forward it only to the correct destination device.

Which OSI Layer Does a Switch Operate On?

A traditional switch operates at Layer 2 (the Data Link Layer) of the OSI model, where it uses MAC (Media Access Control) addresses — the hardware addresses burned into network interfaces — to identify connected devices and decide where to forward each frame.

Some advanced switches, called Layer 3 switches, add routing capability on top of this, using IP addresses to make forwarding decisions as well — blurring the line between a switch and a router.

How a Switch Forwards a Frame

A switch performs the same sequence of steps every time it handles an incoming frame:

  1. Frame reception — the switch receives a data frame from a connected device (for example, Computer A sending data to Computer B).
  2. Source MAC learning — it reads the source MAC address of the frame and records it, along with the port it arrived on, in its MAC address table.
  3. Destination lookup — it reads the destination MAC address and checks whether that address already exists in its table.
  4. Forward or flood —
    • If the destination is found: the switch forwards the frame only out the corresponding port.
    • If the destination is unknown: the switch floods the frame out every port except the one it arrived on. When the destination device eventually replies, the switch learns its MAC address too, so future frames to it no longer need to be flooded.
  5. Frame delivery — the frame reaches its destination device.

This combination of learning and selective forwarding — rather than blind broadcasting — is what makes switching efficient, and it gets faster over time as the switch learns more of the network.

The MAC Address Table

Every switch maintains a MAC Address Table, also called a Forwarding Table or CAM Table (Content Addressable Memory Table). Whenever a new device communicates through the switch, the switch automatically records its MAC address and the port it's reachable through — a process known as MAC learning. This table is what lets the switch make fast, precise forwarding decisions instead of flooding every frame.

Types of Network Switching

Beyond simply how a switch forwards frames at Layer 2, "switching" is also used as a general networking term for how data is routed end-to-end across a network. There are three classic switching techniques:

1. Circuit Switching

Circuit switching establishes a dedicated communication path between sender and receiver before any data is transmitted, and that same path is used for the entire session: connection establishment, then data transmission, then connection termination. The channel remains reserved for the full duration, even during idle periods.

Example: traditional telephone systems — when you place a call, a dedicated path is set up and held open until the call ends.

Advantages: reliable communication, constant bandwidth, low delay once the connection is established, ordered delivery.

Disadvantages: expensive, bandwidth stays reserved even when no data is flowing, poor resource utilization overall.

2. Message Switching

In message switching, an entire message is treated as a single unit. Each intermediate node along the path receives and stores the complete message before forwarding it to the next node — an approach known as store-and-forward.

Example: a postal service, where every sorting office holds your parcel before forwarding it to the next stop on its route.

Advantages: no dedicated connection required, flexible route selection, efficient sharing of communication channels.

Disadvantages: high delay, requires significant storage at each node, unsuitable for real-time communication.

3. Packet Switching

Packet switching is the method used by the modern Internet. Instead of sending an entire message as one unit, the message is broken into small pieces called packets, each carrying a source address, destination address, sequence number, payload, and error-checking information. Packets can travel through different routes and are reassembled at the destination.

Example: browsing a website or streaming video — the data moves as a continuous stream of independently routed packets.

Advantages: efficient bandwidth utilization, supports many simultaneous users, highly reliable and fault-tolerant, cost-effective.

Disadvantages: packets may arrive out of order, delay can vary, and packet loss is possible.

Packet switching itself comes in two forms:

  • Datagram (connectionless) packet switching — each packet is routed independently and may follow a different path. Used by the Internet Protocol (IP). Highly flexible and fault-tolerant, but packets may arrive out of order with variable delay.
  • Virtual-circuit packet switching — a logical path is agreed on before transmission, and all packets for that session follow the same route, without permanently reserving a physical circuit the way true circuit switching does. Used by technologies such as Frame Relay, ATM, and MPLS. Delivers packets in sequence with more predictable performance, at the cost of some setup overhead and dependence on that one logical path.

These three techniques — and the switching modes a Layer 2 switch can operate in (store-and-forward, cut-through, and fragment-free) — are covered in depth in the dedicated Switching Techniques and Switching Modes lessons in this series.

Advantages and Disadvantages of Switching

Advantages

  • High-speed, full-duplex communication
  • Efficient bandwidth utilization
  • Reduced collisions compared to shared-media hubs
  • Improved security, since traffic isn't broadcast to uninvolved devices
  • Easy, scalable network expansion for enterprise environments

Disadvantages

  • More expensive than simple hubs
  • Configuration can become complex in large networks
  • Without loop-prevention protocols like Spanning Tree Protocol (STP), redundant Layer 2 links can create forwarding loops
  • Managed switches require skilled administration
  • Large enterprise deployments require careful planning

Common Mistakes

  • Assuming a switch eliminates all broadcast traffic. A switch still floods frames to an unknown destination and forwards genuine broadcasts (like ARP requests) to every port in the same broadcast domain — it only avoids needlessly repeating traffic whose destination it already knows.
  • Ignoring loop prevention. Connecting switches together with redundant links without running STP (or an equivalent) can create broadcast storms that bring a network down.
  • Confusing a switch's MAC table with a router's routing table. A switch's table maps MAC addresses to ports within one Layer 2 network; it has no concept of IP subnets unless it's a Layer 3 switch.

0 Comments

Reviewed before they appear

No comments yet.

Computer-Network
Ask about this post
AI Ask about this post

Ask questions about Switching in Computer Networks and get answers drawn from it.

Signed-in readers only.