Introduction to Routing and Switching
What is Routing?
Routing is the process of selecting the best path for data to travel
from a source network to a destination network.
A device called a router performs this task.
When data travels across the internet, it passes through many routers
before reaching its destination.
Example
If a computer in Kolkata sends data to a server in USA, the packet
travels through multiple routers across networks.
Each router decides which next path the packet should take.
Router
A router is a networking device that:
Connects multiple networks
Determines the best path for data packets
Uses IP addresses to forward packets
Functions of a Router
1. Path determination
2. Packet forwarding
3. Traffic management
4. Network segmentation
Routing Table
A routing table is a database inside a router that stores routes to
different networks.
It contains:
Destination network
Subnet mask
Next hop
Interface
Metric (cost of route)
Example Routing Table
Destination Subnet Mask Next Hop Interface
[Link] [Link] [Link] Eth0
[Link] [Link] [Link] Eth1
The router checks this table to decide where to send the packet next.
Types of Routing
1. Static Routing
Routes are manually configured by a network administrator.
Characteristics:
Simple
Secure
No automatic updates
Disadvantages:
Not suitable for large networks
Requires manual maintenance
Example:
ip route => [Link] [Link] [Link]
2. Dynamic Routing
Routes are automatically updated using routing protocols.
Common protocols:
RIP (Routing Information Protocol)
OSPF (Open Shortest Path First)
BGP (Border Gateway Protocol)
Advantages:
Automatically adjusts routes
Suitable for large networks
Disadvantages:
More complex
Uses more resources
Routing Information Protocol (RIP)
Definition:
RIP is a distance-vector routing protocol used to determine the best
path between networks.
Metric Used:
Hop Count (number of routers between source and destination)
Important Points
Maximum 15 hops allowed
Routers update routing tables every 30 seconds
Simple and easy to configure
Suitable for small networks
Limitation
Not good for large networks because hop limit is small.
Open Shortest Path First (OSPF)
Definition:
OSPF is a link-state routing protocol that finds the shortest path
between networks.
Metric Used:
Cost (based on link bandwidth)
Important Points
Uses Shortest Path First (SPF) algorithm
Faster and more efficient than RIP
Suitable for large enterprise networks
Supports hierarchical network structure
Border Gateway Protocol (BGP)
Definition:
BGP is a path-vector routing protocol used to exchange routing
information between different networks on the Internet.
Important Points
Used by Internet Service Providers (ISPs)
Connects different Autonomous Systems (AS)
Very scalable and stable
Main protocol used for global internet routing
Switching
What is Switching?
Switching is the process of forwarding data within a local network
(LAN) from one device to another.
This is done using a network switch.
A switch uses MAC addresses to deliver data to the correct device.
Switch
A switch is a device that connects multiple devices in a Local Area
Network (LAN).
It operates mainly at Layer 2 (Data Link Layer) of the OSI model.
Functions of a Switch
Forward frames
Learn MAC addresses
Reduce network collisions
Improve network performance
MAC Address Table
A switch maintains a MAC address table.
This table stores:
MAC address
Port number
Example:
MAC Address Port
AA:BB:CC:DD:11 Port 1
MAC Address Port
AA:BB:CC:DD:22 Port 2
When a frame arrives, the switch checks the MAC table and sends the
frame to the correct port.
Difference Between Router and Switch
Feature Router Switch
Works on Network Layer Data Link Layer
Uses IP Address MAC Address
Connects Different Networks Devices in same network
Main purpose Path selection Data forwarding
Packet Transmission
What is Packet Transmission?
Packet transmission is the process of sending data across a network
in small units called packets.
Instead of sending a large file at once, the data is divided into packets.
Each packet contains:
Source address
Destination address
Sequence number
Data
Packet Structure
A packet contains three main parts:
HEADER | PAYLOAD | TRAILER
Header
Contains:
Source IP address
Destination IP address
Protocol information
Payload = Actual data being transmitted.
Trailer = Used for error detection.
Steps of Packet Transmission
1. Data is divided into packets.
2. Each packet receives an IP address.
3. Packets travel through routers.
4. Packets may take different routes.
5. At the destination, packets are reassembled.
Switching Techniques
Switching techniques are methods used to transfer data between
devices in a network.
There are three main types:
1. Circuit Switching
2. Packet Switching
3. Message Switching
Circuit Switching
Circuit
switching establishes a dedicated communication path between
sender and receiver before data transmission begins.
Example: Traditional telephone network
Steps
1. Connection establishment
2. Data transfer
3. Connection termination
Characteristics
Dedicated path
Constant bandwidth
No packet loss
Advantages
Reliable
Continuous transmission
Disadvantages
Inefficient use of bandwidth
Setup time required
4.2 Packet Switching
Packet switching divides data into small packets and sends them
independently across the network.
This is the method used in the Internet.
Characteristics
No dedicated path
Packets travel independently
Efficient bandwidth usage
Advantages
Efficient network utilization
Flexible routing
Reliable (packets can be retransmitted)
Disadvantages
Possible delay
Packet loss or disorder
Message Switching
Message switching sends the entire message as a single unit.
Each node stores the message temporarily before forwarding it.
This technique is also called store-and-forward switching.
Characteristics
No dedicated path
Entire message sent at once
Stored at intermediate nodes
Advantages
Efficient routing
No need for connection setup
Disadvantages
Large storage requirement
High delay
Comparison of Switching Techniques
Feature Circuit Switching Packet Switching Message Switching
Path Dedicated No dedicated path No dedicated path
Data Unit Continuous signal Packets Whole message
Delay Low after setup Variable High
Efficiency Low High Moderate
Example Telephone network Internet Old telegraph systems