What is Switching in Computer Networks?
Switching is the process of receiving data from one device and forwarding
it to the appropriate destination through the best available path.
In simple terms:
Switching is the technique used to transfer data between devices
connected to a network.
The primary objective of switching is to ensure that data reaches the
intended destination quickly, efficiently, and accurately.
Real-World Example
Imagine a postal service.
When you send a letter:
- The letter is collected from your location.
- It passes through multiple sorting centers.
- Each center determines the next destination.
- Eventually, the letter reaches the recipient.
Switching works similarly. Network devices analyze destination
information and determine where data should be forwarded.
Why is Switching Important?
Without switching mechanisms, network communication would become
inefficient and chaotic.
Switching provides several benefits:
- Efficient use of network bandwidth
- Faster data transmission
- Reduced network congestion
- Simultaneous communication between multiple devices
- Improved network scalability
- Reduced packet collisions
Highway Analogy
Think of a network as a highway system.
Without traffic management, vehicles would collide and create traffic
jams. Switching acts like an intelligent traffic controller, directing
data packets through the best route and preventing congestion.
What is a Network Switch?
A network switch is a networking device that connects multiple devices
within a Local Area Network (LAN).
Unlike a hub, which broadcasts data to every connected device, a switch
intelligently forwards data only to the intended recipient.
Functions of a Switch
Connects devices within a LAN
Learns device MAC addresses
Reduces network traffic
Supports simultaneous communication
Improves network performance
OSI Layer
Switches primarily operate at:
Layer 2 – Data Link Layer
At this layer, switches use MAC (Media Access Control) addresses to
identify and forward frames.
How Does the Switching Process Work?
The switching process follows several steps.
Step 1: Frame Reception
A switch receives a frame from a connected device.
Example:
A computer sends data to a printer.
Step 2: MAC Address Learning
The switch reads the source MAC address and stores it in its MAC address
table.
This table helps the switch remember which device is connected to which
port.
Step 3: Destination Lookup
The switch checks whether the destination MAC address exists in its
table.
If Found
The frame is forwarded only to the appropriate port.
If Not Found
The switch temporarily broadcasts the frame to all ports except the
incoming port.
When the destination device responds, the switch learns its MAC
address.
Step 4: Frame Forwarding
The switch forwards the frame according to its switching mode.
Types of Switching Techniques
There are three major switching techniques:
- Circuit Switching
- Message Switching
- Packet Switching
1. Circuit Switching
Circuit switching establishes a dedicated communication path between the
sender and receiver before data transmission begins.
Once the connection is established, the path remains reserved until
communication ends.
How Circuit Switching Works
The communication process consists of three phases:
1. Circuit Establishment
A dedicated route is created.
2. Data Transfer
Data flows through the reserved path.
3. Circuit Disconnect
The path is released.
Real-World Example
Traditional telephone systems use circuit switching.
When you make a phone call:
- A dedicated connection is established.
- The connection remains active throughout the conversation.
- Resources remain reserved even during silence.
Advantages of Circuit Switching
Dedicated Connection
Provides uninterrupted communication.
Fixed Bandwidth
Bandwidth remains constant throughout communication.
Predictable Performance
Suitable for applications requiring guaranteed service.
Disadvantages of Circuit Switching
Resource Wastage
Bandwidth remains reserved even when no data is transmitted.
Long Setup Time
Connection establishment introduces delay.
High Cost
Dedicated paths require more resources.
Poor Scalability
Not suitable for modern internet traffic.
Circuit Switching Technologies
Space Division Switching
Creates physical paths using crosspoints.
Crossbar Switch
A grid structure containing input and output lines.
Limitation
The number of crosspoints grows rapidly as the network expands.
Multistage Switch
Built by combining multiple smaller switches.
Benefits
- Fewer crosspoints
- Lower cost
- Alternative routing paths
2. Message Switching
Message switching was widely used before packet switching became
popular.
In this method, the entire message is treated as one unit.
Each intermediate device stores the complete message before forwarding
it.
This approach is called:
Store-and-Forward Switching
How Message Switching Works
- Complete message is received.
- Message is stored temporarily.
- Message is forwarded to the next node.
- Process repeats until delivery.
Example
Traditional telegraph systems followed a similar approach.
Advantages of Message Switching
Efficient Channel Utilization
Communication channels can be shared.
Traffic Management
Messages can be prioritized.
Flexible Message Size
Supports large messages.
Disadvantages of Message Switching
High Storage Requirements
Intermediate devices must store entire messages.
Large Delays
Waiting for complete messages increases latency.
Unsuitable for Real-Time Applications
Voice and video communication suffer significant delays.
3. Packet Switching
Packet switching is the foundation of modern computer networks and the
Internet.
Instead of sending an entire message as one unit, the message is divided
into smaller units called packets.
How Packet Switching Works
- Data is divided into packets.
- Each packet contains destination information.
- Packets travel independently.
- Destination reassembles packets into the original message.
Real-World Example
Sending a large file through the Internet.
The file is divided into thousands of packets that travel through
different routes before being reassembled at the destination.
Why Packet Switching is Popular
Unlike circuit switching:
- No dedicated path is required.
- Multiple users share the network.
- Bandwidth is utilized efficiently.
- Network resources are optimized.
Approaches to Packet Switching
Packet switching can be implemented in two ways:
1. Datagram Packet Switching
Datagram switching is a connectionless approach.
Each packet is treated independently.
Characteristics
- No fixed route
- Packets may take different paths
- Routing decisions made dynamically
Example
The Internet Protocol (IP)
Advantages
- Flexible routing
- Highly scalable
- Fault tolerant
Disadvantages
- Packets may arrive out of order
- Variable delays
2. Virtual Circuit Switching
Virtual circuit switching is a connection-oriented approach.
A logical path is established before transmission begins.
All packets follow the same route.
Characteristics
- Fixed path
- Ordered packet delivery
- Predictable performance
Examples
- X.25
- Frame Relay
- ATM (Asynchronous Transfer Mode)
Advantages
- Reliable communication
- Ordered delivery
- Consistent performance
Disadvantages
- Setup overhead
- Resource reservation required
Advantages of Packet Switching
Cost Effective
No dedicated communication path is required.
Efficient Bandwidth Utilization
Multiple users share the same network resources.
Reliable
Packets can be rerouted if a link fails.
Highly Scalable
Suitable for large global networks.
Supports Modern Applications
Used in:
- Web browsing
- Cloud computing
- Video streaming
- Online gaming
Disadvantages of Packet Switching
Variable Delay
Packets may follow different routes.
Complex Protocols
Requires sophisticated routing mechanisms.
Packet Loss
Congested networks may drop packets.
Retransmission Overhead
Lost packets need retransmission.