CCN module 4
In the Network Layer, the main responsibility is to deliver packets from the source host to the
destination host across multiple networks. It performs logical addressing, routing, packet
forwarding, fragmentation, congestion handling, and internetworking.
While designing this layer, several important issues must be considered so that data can travel
efficiently and reliably across large networks.
Design Issues of Network Layer
The design of the Network Layer involves deciding how packets are routed, how services are
provided to the transport layer, and how congestion and addressing are handled. The major design
issues are explained below.
1. Store-and-Forward Packet Switching
In packet-switched networks, routers use the store-and-forward technique.
Working:
1. A packet arrives at a router.
2. The router stores the entire packet in its buffer memory.
3. It checks the destination address in the packet header.
4. Based on routing tables, the router forwards the packet to the next router.
5. Each router temporarily stores packets before forwarding.
Example Flow
Sender → Router 1 → Router 2 → Router 3 → Receiver
Each router stores and then forwards the packet.
Advantages
Efficient bandwidth usage
Suitable for large networks like the Internet
Allows error checking before forwarding
2. Services Provided to the Transport Layer
The network layer provides services to the Transport Layer.
The service should have:
1. Independence from router technology
Transport layer should not depend on how routers work internally.
2. Independence from number and type of routers
Changes in network hardware should not affect upper layers.
3. Uniform addressing scheme
All hosts must use a standard address format such as Internet Protocol (IP).
[Link]-Oriented vs Connectionless Services
A key design issue is deciding whether the network layer should provide connection-oriented or
connectionless services.
1. Connection-Oriented Service (Virtual Circuit)
Before sending data, a logical connection is established between sender and receiver.
Steps:
1. Connection setup
2. Data transfer
3. Connection termination
All packets follow the same path.
Advantages
Packets arrive in order
Better control over congestion
Reliable transmission
2. Connectionless Service (Datagram)
In this approach:
No connection is established beforehand.
Each packet is treated independently.
Packets may take different paths.
The Internet uses this model through the Internet Protocol (IP).
Advantages
Faster transmission
No setup delay
More flexible routing
4. Routing Algorithms
Routing determines the best path for packets to travel from source to destination.
Routers maintain routing tables containing information about network paths.
Goals of Routing
Shortest path
Minimum delay
Maximum reliability
Efficient bandwidth usage
Examples:
RIP (Routing Information Protocol)
OSPF (Open Shortest Path First)
BGP (Border Gateway Protocol)
5. Congestion Control
Congestion occurs when too many packets are present in the network, causing delays and packet
loss.
This is an important design issue because network performance can degrade significantly.
Causes of Congestion
Excessive traffic
Limited bandwidth
Slow routers
Buffer overflow
6. Quality of Service (QoS)
Different applications require different levels of network performance.
For example:
Video streaming requires high bandwidth
Voice calls require low delay
QoS ensures that network resources are allocated efficiently.
QoS Parameters
1. Bandwidth- Data transfer capacity of the network.
2. Delay- Time taken for a packet to travel from source to destination.
3. Jitter- Variation in packet delay.
4. Packet Loss- Percentage of lost packets during transmission.
7. Internetworking
Internetworking is the process of connecting multiple heterogeneous networks into a single large
network.
Different networks may use:
Different hardware
Different protocols
Different addressing schemes
To allow communication between them, the network layer uses routers and gateways.
Communication primitives
Communication primitives define how data is transmitted from a sender to one or more receivers in
a computer network. They specify the pattern of communication, the number of receivers, and the
method used for packet delivery.
In networking, three fundamental communication primitives are commonly used:
1. Unicast Communication
2. Multicast Communication
3. Broadcast Communication
Each type determines how packets are addressed and delivered in the network.
Communication Primitives: Unicast, Multicast, Broadcast
1. Unicast Communication
Unicast communication is a communication method in which a single sender transmits data
to a single specific receiver using a unique address. It is the most common form of
communication used in modern computer networks
In unicast communication, every device in the network has a unique logical address,
typically an IP address. When a sender wants to transmit data to a particular receiver, it
places the receiver's IP address in the destination field of the packet header.
Routers then forward the packet through the network until it reaches the intended
destination.
Working Process
1. The sender generates a data packet.
2. The packet contains the destination IP address of the receiver.
3. The packet is transmitted to the nearest router.
4. Each router examines the destination address and forwards the packet toward the correct
path using routing tables.
5. The packet eventually reaches the destination host.
Characteristics
Communication occurs between one sender and one receiver.
Uses unique IP addressing.
Packets travel through routers using routing algorithms.
Each communication session requires a separate packet stream.
Advantages
Efficient for individual communication.
Ensures direct delivery of data to a specific device.
Allows reliable protocols like Transmission Control Protocol (TCP) to maintain ordered
delivery.
Disadvantages
Not efficient for transmitting the same data to multiple receivers because separate packets
must be sent to each receiver.
Applications
Unicast communication is used in most everyday Internet services, such as:
Web browsing using HTTP
Email transmission
File transfer
Online messaging
2. Multicast Communication
Multicast communication is a communication method where one sender transmits data to multiple
receivers that belong to a specific group.
Instead of sending separate packets to every receiver, the sender transmits a single packet
addressed to a multicast group, and the network distributes it only to the devices that are members
of that group.
Multicast Groups
Devices that wish to receive multicast data join a multicast group. Each multicast group is identified
by a special multicast IP address.
For example, in Internet Protocol version 4 (IPv4), multicast addresses range from [Link] to
[Link].
Working Process
1. Receivers join a multicast group.
2. The sender sends packets addressed to the multicast group.
3. Routers identify the multicast address.
4. Routers replicate the packet only when necessary.
5. Only devices that are members of the multicast group receive the packet.
Multicast group membership is managed using the Internet Group Management Protocol (IGMP).
Characteristics
Communication occurs between one sender and multiple selected receivers.
Uses multicast group addresses instead of individual addresses.
Routers duplicate packets only when required.
Network bandwidth is used efficiently.
Advantages
Reduces network traffic because the sender sends only one copy of data.
Efficient for applications involving large groups of receivers.
Saves bandwidth compared to multiple unicast transmissions.
Disadvantages
More complex to implement.
Requires multicast-enabled routers and network infrastructure.
Applications
Multicast communication is commonly used in:
Video conferencing systems
Online gaming
3. Broadcast Communication
Broadcast communication is a communication method in which one sender transmits data to all
devices within a network segment.
Every device connected to the network receives the packet, but only the intended devices process it,
while others ignore it.
Broadcast Addressing
Broadcast communication uses a special broadcast address.
For example: In Internet Protocol version 4 (IPv4), the broadcast address [Link] is used to
send packets to all hosts in the network.
Working Process
1. The sender creates a packet with the broadcast address.
2. The packet is transmitted to the network.
3. The network distributes the packet to all devices in the broadcast domain.
4. Each device checks whether the message is relevant.
Characteristics
Communication occurs between one sender and all receivers in the network.
Used mainly in local area networks (LANs).
Generates large network traffic.
Advantages
Simple method for sending messages to all devices.
Useful for network discovery and configuration.
Disadvantages
Can cause network congestion.
Not scalable for large networks.
Many devices may receive unnecessary packets.
Applications
Address Resolution Protocol (ARP) requests
Dynamic Host Configuration Protocol (DHCP) for IP address assignment
Comparison of Unicast, Multicast, and Broadcast
Feature Unicast Multicast Broadcast
Communication
One-to-One One-to-Many (Group) One-to-All
Type
Number of All devices in
Single receiver Selected group of receivers
Receivers network
Address Type Unique IP address Multicast group address Broadcast address
Higher when many receivers Efficient for group
Bandwidth Usage High network traffic
exist communication
Network Scope Entire Internet Multicast-enabled networks Usually limited to
Feature Unicast Multicast Broadcast
LAN
Example Web browsing Live streaming ARP request
Congestion Control Algorithms
Introduction
In computer networks, congestion occurs when the traffic load in the network becomes greater
than the network capacity. When too many packets are transmitted simultaneously, routers and
network links become overloaded. This leads to packet loss, long delays, retransmissions, and
reduced throughput.
To maintain efficient communication, networks use congestion control algorithms. These algorithms
regulate the amount of data entering the network so that congestion can be avoided or controlled.
Congestion control algorithms are broadly classified into two categories:
1. Open Loop Congestion Control
2. Closed Loop Congestion Control
1. Open Loop Congestion Control
Open loop congestion control is a preventive mechanism used to avoid congestion before it occurs
in the network.
In this method, no feedback from the network is used. Instead, the system follows predefined
policies and rules to prevent congestion from happening.
Characteristics
No feedback from the network
Preventive approach
Policies are fixed beforehand
Simpler mechanism compared to closed loop control
Policies Used in Open Loop Congestion Control
Several policies are used to prevent congestion.
1. Retransmission Policy
Sometimes packets are lost due to errors. When packets are retransmitted unnecessarily, it increases
network load and causes congestion.
A good retransmission policy ensures that packets are retransmitted only when necessary.
Example: If acknowledgement is delayed due to network latency, unnecessary retransmission should
be avoided.
Thus, efficient retransmission policies help reduce congestion.
2. Window Policy
The window policy determines how many packets can be transmitted before receiving
acknowledgements.
For example: In Selective Repeat Sliding Window, only the lost packets are retransmitted instead of
retransmitting all packets.
This reduces unnecessary traffic in the network.
Example:
Suppose packets sent are: 1 2 3 4 5
If packet 3 is lost, only packet 3 is retransmitted instead of retransmitting 3, 4, and 5.
Thus, network congestion is reduced.
3. Acknowledgement Policy
Acknowledgements can also increase network traffic.
Some techniques reduce congestion by reducing acknowledgements.
Examples:
Delayed ACK – receiver waits before sending acknowledgement
Piggybacking – acknowledgement is sent along with outgoing data
Example: Instead of sending ACK separately:
ACK + Data together
This reduces network traffic.
4. Discard Policy
When routers become overloaded, some packets may be discarded to reduce congestion.
Routers discard packets based on certain rules.
Example: If router buffer is full, the router may discard low priority packets such as multimedia
packets.
This prevents further congestion.
5. Admission Policy
Admission control determines whether a new traffic flow should be allowed into the network or
not.
If the network is already heavily loaded, the new connection request may be rejected.
Example:
In virtual circuit networks, a new connection is established only if the network has enough
resources.
2. Closed Loop Congestion Control
Closed loop congestion control is a reactive mechanism that detects congestion after it occurs and
then takes corrective action to control it.
In this method, the network monitors congestion and sends feedback to the sender, which then
adjusts its transmission rate.
Thus, closed loop control is based on feedback from the network.
Characteristics
Uses feedback mechanism
Detects congestion after it occurs
Sender adjusts transmission rate
More dynamic and adaptive
Components of Closed Loop Congestion Control
Closed loop congestion control involves three main steps:
1. Monitor the network to detect congestion
2. Send feedback to the sender
3. Adjust transmission rate
Methods of Closed Loop Congestion Control
1. Backpressure
In backpressure, when a router becomes congested, it sends a signal to the previous router to slow
down transmission.
This signal propagates backwards through the network until it reaches the sender.
Example: Sender → Router1 → Router2 → Router3 → Receiver
If Router3 becomes congested, it informs Router2 to slow down. Router2 then informs Router1, and
eventually the sender slows down.
2. Choke Packet
A choke packet is a special control packet sent by a router to inform the sender that congestion has
occurred.
The sender must then reduce its transmission rate.
Example: Router detects congestion → sends Choke Packet → sender reduces data rate.
3. Implicit Signaling
In implicit signaling, the sender detects congestion indirectly by observing network conditions.
Examples:
Packet loss
Increased delay
Timeout
Example: If TCP notices packet loss, it assumes congestion and reduces its transmission rate.
4. Explicit Signaling
In explicit signaling, routers directly inform the sender about congestion.
Two types exist:
a) Forward Explicit Congestion Notification
The router sends congestion information towards the receiver, which then informs the sender.
b) Backward Explicit Congestion Notification
The router sends congestion information directly to the sender.
Example: Router marks packets with congestion indication bits.
Aspect Open Loop Congestion Control Closed Loop Congestion Control
A congestion control technique that tries to A congestion control technique that
Definition prevent congestion before it occurs using detects congestion after it occurs and
predefined policies. then takes corrective action.
Preventive approach – designed to avoid Reactive approach – responds to
Approach
congestion in advance. congestion after detecting it.
Feedback from Feedback is used from the network to
No feedback is taken from the network.
Network control congestion.
Works based on monitoring network
Works based on fixed policies and rules set
Operation conditions and adjusting the sending
during network design.
rate dynamically.
Not adaptive to changing network Adaptive to changing traffic conditions
Adaptability
conditions. in the network.
More complex because it requires
Simpler to implement because it does not
Complexity detection, feedback, and adjustment
require monitoring.
mechanisms.
To reduce or eliminate congestion
Main Goal To avoid congestion from happening.
once it occurs.
Retransmission policy, Window policy,
Techniques Backpressure, Choke packet, Implicit
Acknowledgement policy, Discard policy,
Used signaling, Explicit signaling.
Admission policy.
In TCP, when packet loss occurs, the
Limiting the window size so that too many
Example sender reduces the congestion window
packets are not sent into the network.
and starts slow start.
Quality of Service (QoS) Parameters
In computer networks, different applications have different requirements for data transmission. For
example, video conferencing, voice calls, and online gaming require fast and reliable data delivery,
while applications like email or file transfer can tolerate some delay.
To ensure that network services meet the required performance level, networks use Quality of
Service (QoS) mechanisms.
Quality of Service (QoS) refers to the ability of a network to provide better service to selected
network traffic by controlling parameters such as bandwidth, delay, jitter, and packet loss.
QoS ensures that important applications receive the necessary network resources for smooth and
efficient communication.
Main QoS Parameters
The main parameters used to measure and control QoS are:
1. Bandwidth
Bandwidth is the maximum data transfer rate of a network or communication channel. It
represents the amount of data that can be transmitted over a network in a given amount of
time.
Bandwidth is usually measured in: bits per second (bps), Kbps (Kilobits per second), Mbps
(Megabits per second) etc
Higher bandwidth means that more data can be transmitted simultaneously, resulting in
faster communication.
For example:
Email requires low bandwidth
Video streaming requires high bandwidth
Real-Life Example
During video conferencing, if enough bandwidth is not available, the video may:
Freeze
Become blurry
Stop completely
Therefore QoS allocates sufficient bandwidth for video applications.
2. Delay (Latency)
Delay (Latency) is the time taken for a packet to travel from the sender to the receiver
across the network.
It is usually measured in milliseconds (ms).
Total delay in a network consists of four components:
1. Processing Delay
2. Queuing Delay
3. Transmission Delay
4. Propagation Delay
If delay is high, packets take longer to reach the destination, which affects real-time
applications.
Real-Life Example
In online gaming, high delay causes:
Slow response
Lag in gameplay
In video calls, high delay causes:
People speaking over each other
Unnatural conversation flow
3. Jitter
Jitter is the variation in packet delay during data transmission. In other words, it is the
difference in arrival times of packets.
Packets sent at regular intervals may not arrive at the receiver at the same intervals due to
network congestion.
Example: Packets sent every 20 ms may arrive at:
20 ms, 25 ms
This variation is called jitter.
Real-Life Example
In Voice over IP (VoIP) calls, high jitter causes:
Broken voice
Choppy audio
Missing words
To solve this, networks use jitter buffers to smooth packet arrival.
4. Reliability (Packet Loss Rate)
Reliability refers to the ability of the network to deliver packets correctly without loss or
corruption.
Packet loss occurs when packets are dropped due to congestion, errors, or buffer overflow.
A reliable network ensures that most packets reach the destination successfully.
Packet loss is usually measured as a percentage.
Example: Packet Loss Rate = 1%
This means 1 packet out of 100 packets is lost.
Real-Life Example
In video streaming, packet loss may cause:
Pixelated video
Missing frames
Video freezing
In file transfer, packet loss may require retransmission of lost packets.
Summary of QoS Parameters
QoS Parameter Description Unit Example
Maximum data transmission capacity of
Bandwidth bps, Mbps 100 Mbps internet speed
the network
Time taken for a packet to travel from milliseconds
Delay (Latency) 50 ms network delay
source to destination (ms)
Packets arriving at
Jitter Variation in packet arrival time milliseconds
different intervals
Reliability (Packet Percentage of packets successfully
Percentage (%) 1% packet loss
Loss) delivered
Importance of QoS in Computer Networks
1. Ensures Reliable Communication
QoS helps maintain reliable data transmission by controlling packet loss, delay, and congestion. This
ensures that data reaches the destination correctly and efficiently.
Example:
In online banking or financial transactions, reliable data delivery is very important. QoS helps prevent
packet loss and ensures accurate communication.
2. Supports Real-Time Applications
Real-time applications such as Voice over IP (VoIP), video conferencing, and online gaming require
very low delay and minimal jitter.
QoS prioritizes such traffic to ensure smooth communication.
Example:
During a video call on Zoom or Google Meet, QoS ensures that voice and video packets are delivered
quickly to avoid lag or interruptions.
3. Efficient Utilization of Network Resources
QoS helps in efficient management and allocation of network resources such as bandwidth. It
prevents network congestion by controlling the amount of data entering the network.
Example:
In a company network, QoS can allocate more bandwidth to business-critical applications and limit
bandwidth for less important activities like downloading large files.
4. Reduces Network Congestion
QoS mechanisms monitor and regulate network traffic, which helps reduce congestion and improves
overall network performance.
Example:
If many users start downloading large files simultaneously, QoS can limit their bandwidth to prevent
congestion and maintain smooth network operation.
5. Improves User Experience
By reducing delay, packet loss, and jitter, QoS improves the overall quality of network services and
provides a better experience for users.
Example:
Smooth video streaming on platforms like Netflix or YouTube is possible when QoS ensures sufficient
bandwidth and minimal buffering.
6. Supports Multimedia Applications
Modern networks support multimedia services such as video streaming, online education, and live
broadcasting. These services require stable and high-quality data transmission. QoS ensures that
multimedia data is transmitted without interruptions.
Example: During live online lectures, QoS ensures continuous video and audio transmission without
delays.
Routing Algorithms
Introduction
Routing is the process of determining the best path for data packets to travel from the source to
the destination in a network. Routers use routing algorithms to decide which path should be used
for forwarding packets efficiently.
Routing algorithms are generally classified into two categories:
1. Intra-domain routing (Interior routing)
2. Inter-domain routing (Exterior routing)
1. Intra-Domain Routing
Intra-domain routing refers to routing within the same autonomous system. Routers inside the
network cooperate to find the best path.
Common intra-domain routing algorithms include:
Shortest Path Algorithm
Distance Vector Algorithm
Link State Routing
1. Shortest Path Routing Algorithm
Definition
The Shortest Path Algorithm is used to determine the minimum cost path between a source and a
destination node in a network.
The cost of a path may depend on:
Distance
Delay
Bandwidth
Number of hops
The most commonly used shortest path algorithm is Dijkstra's Algorithm.
Shortest Path Routing uses complete network topology and Dijkstra algorithm to calculate optimal
paths quickly and accurately
Working
1. The algorithm starts with the source node.
2. It calculates the cost to all neighboring nodes.
3. It repeatedly selects the node with the smallest distance.
4. The process continues until the shortest path to all nodes is found.
Example
Consider the following network:
2
A -------- B
| |
4 1
| |
C -------- D
3
Costs represent link weights.
Possible paths from A to D:
1. A → B → D = 2 + 1 = 3
2. A → C → D = 4 + 3 = 7
Shortest path is:
A → B → D (cost = 3)
Thus, the router forwards packets through B.
Characteristics of Shortest Path Routing
1. Uses Complete Network Topology- Routers maintain complete information about network
structure.
2. Cost-Based Routing- Routing decisions depend on link costs.
3. Dynamic Routing- Routes change automatically when network topology changes.
4. Fast Convergence- Routing tables are updated quickly after changes.
5. Efficient Routing- Always selects optimal or minimum-cost path.
6. Loop-Free Operation- Chances of routing loops are very less.
7. High Scalability- Suitable for large and complex networks.
Advantages of Shortest Path Routing
1. Efficient Packet Delivery- Packets travel through optimal paths.
2. Reduced Delay- Shortest routes reduce transmission time.
3. Better Bandwidth Utilization- Network resources are used efficiently.
4. Fast Convergence- Topology changes are quickly reflected.
5. Reliable Routing- More accurate routing decisions are made.
6. Suitable for Large Networks- Works efficiently in enterprise and WAN networks.
7. Reduced Routing Loops- Complete topology information minimizes loops.
Disadvantages of Shortest Path Routing
1. Complex Algorithm- Requires complex calculations.
2. High CPU Usage- Path computation requires more processing power.
3. More Memory Requirement- Routers must store complete topology information.
4. Initial Overhead- Topology exchange increases initial network traffic.
5. Frequent Recalculations- Topology changes require route recalculation.
Applications
Used in Link State Routing protocols like OSPF.
Distance Vector Routing
Distance Vector Routing is a dynamic routing algorithm used in computer networks to determine the
best path for sending data packets from source to destination.
In this routing method:
Every router maintains a routing table.
The table stores:
o Distance (cost/metric) to reach destination networks
o Vector (direction or next hop router)
Routers exchange routing information with neighboring routers periodically.
The shortest path is selected based on minimum distance.
Distance Vector Routing works on the Bellman-Ford Algorithm.
Working of Distance Vector Routing
The working of Distance Vector Routing occurs in several steps.
Step 1: Creation of Routing Table
Each router creates a routing table containing:
Destination network
Distance to destination
Next hop router
Initially:
Distance to itself = 0
Distance to directly connected neighbors = link cost
Distance to unknown networks = infinity
Example:
Destination Distance Next Hop
A 0 -
B 1 B
C ∞ -
Step 2: Exchange of Routing Tables
Each router periodically sends its routing table to its immediate neighboring routers.
Example:
Router A sends its table to Router B
Router B sends its table to Router C and Router A
This exchange continues regularly.
NOTE- Only the distance vector is sent to the neighbouring routers instead of sending the whole
routing table.
Step 3: Receiving Routing Information
Neighbor routers receive routing tables and compare received routes with existing routes.
Step 4: Calculation of New Distance
Router calculates new distance using:
If new distance is smaller than existing distance: Routing table is updated.
Step 5: Updating Routing Table
If a shorter path is found:
Distance value changes
Next hop router changes
Example:
Before update:
Destination Distance Next Hop
C 4 C
After receiving update from Router B:
Destination Distance Next Hop
C 2 B
Step 6: Continuous Updates
Routers continuously exchange and update routing information until all routers have correct routing
tables. This state is called Convergence.
Example of Distance Vector Routing
Consider the following network:
A -----1----- B -----1----- C
Where:
Cost from A to B = 1
Cost from B to C = 1
Initial Routing Tables-
Router A
Destination Distance Next Hop
A 0 -
B 1 B
C infinite -
Router B
Destination Distance Next Hop
A 1 A
B 0 -
C 1 C
Router C
Destination Distance Next Hop
A infinite -
B 1 B
C 0 -
Updated Routing Table of A
Destination Distance Next Hop
A 0 -
B 1 B
C 2 B
Now Router A sends packets to C through B because it is the shortest path.
Characteristics of Distance Vector Routing
1. Distributed Routing Algorithm- Each router works independently.
No central controller is used.
2. Neighbor-to-Neighbor Communication- Routers exchange information only with directly
connected neighboring routers.
3. Periodic Updates- Routing tables are shared periodically after fixed time intervals.
Example:
RIP sends updates every 30 seconds.
4. Uses Distance Metric- Routing decisions are based on metrics such as:
Hop count
Delay
Bandwidth
Reliability
5. Simple Operation- Easy to understand, configure, and implement.
6. Iterative Process- Routers continuously update routing tables until network becomes stable.
7. Slow Convergence- When topology changes occur, routers take time to update routing
information.
8. Routing Table Based- Each router stores complete routing information in routing tables.
Advantages of Distance Vector Routing
1. Simple to Implement- Configuration and operation are easy.
2. Low Computational Complexity- Requires less CPU processing compared to complex routing
algorithms.
3. Less Memory Requirement- Only routing tables are stored.
4. Suitable for Small Networks- Efficient for small LANs and simple networks.
5. Easy Maintenance- Simple routing mechanism makes troubleshooting easier.
6. Automatic Route Updates- Routes are updated automatically when network changes occur.
Disadvantages of Distance Vector Routing
1. Slow Convergence- Routing updates spread slowly across the network.
2. Routing Loops- Packets may circulate endlessly between routers.
3. Count-to-Infinity Problem- Hop counts may increase continuously when routes fail.
4. High Network Traffic- Periodic routing updates consume bandwidth.
5. Poor Scalability- Not suitable for large and complex networks.
6. Limited Information- Routers know only neighboring router information, not complete network
topology.
7. Less Reliable in Dynamic Networks- Frequent network changes reduce efficiency.
Link State Routing
Link State Routing is a dynamic routing algorithm used in computer networks to determine the best
path between source and destination.
In this method, every router creates a complete map of the network topology and independently
calculates the shortest path to all destinations.
Unlike Distance Vector Routing:
Routers do not exchange entire routing tables.
Routers exchange only link state information.
Every router maintains complete knowledge of the network topology.
Link State Routing mainly uses the Dijkstra Shortest Path Algorithm.
It is widely used in modern networks because it provides:
Fast convergence
Accurate routing
Loop-free communication
Better scalability
Definition
Link State Routing is a routing technique in which each router gathers information about directly
connected links, floods this information to all routers in the network, and independently calculates
the shortest path using Dijkstra Algorithm.
Basic Concept of Link State Routing
In Link State Routing:
Every router discovers its neighboring routers.
Measures cost of directly connected links.
Creates Link State Packets (LSPs).
Floods LSPs throughout the network.
Builds complete topology database.
Independently calculates shortest paths.
Thus, each router has a complete map of the network.
Need of Sequence Number and TTL in LSP
1. Sequence Number
Sequence number identifies the latest Link State Packet.
Purpose:
Prevents duplicate packets
Identifies newest routing information
Avoids outdated updates
Maintains accurate topology database
Higher sequence number means newer information.
2. TTL (Time To Live) / Age Field
TTL specifies the lifetime of an LSP.
Purpose:
Removes old routing information
Prevents infinite circulation of packets
Maintains updated topology database
Improves network stability
When TTL becomes 0, the packet is discarded.
Working of Link State Routing
The working of Link State Routing occurs in several stages.
Step 1: Neighbor Discovery
Each router discovers directly connected neighboring routers using Hello packets.
Purpose:
Identify neighbors
Verify connectivity
Step 2: Measuring Link Cost
Router calculates cost of each link.
Cost may depend on:
Bandwidth
Delay
Reliability
Administrative cost
Lower cost indicates better path.
Step 3: Creation of Link State Packet (LSP)
Router creates LSP containing:
Router ID
Neighbor routers
Link costs
Sequence number
TTL/Age field
Example:
Router Neighbor Cost
A B 2
A C 5
Step 4: Flooding of LSPs
Each router floods its LSP throughout the network.
Flooding means:
Sending copies of LSPs to all routers.
Important points:
Every router receives same topology information.
Sequence number prevents duplicates.
TTL removes outdated packets.
Step 5: Building Topology Database
Each router stores all received LSPs in topology database.
As all routers receive same information:
Every router builds identical network map.
Step 6: Running Dijkstra Algorithm
Each router independently applies Dijkstra Algorithm to calculate:
Shortest path
Best next hop
Minimum cost routes
Step 7: Updating Routing Table
Finally routing table is prepared containing:
Destination
Cost
Next hop
Example of Link State Routing
Consider the network:
A -----2----- B
| |
5 1
| |
C -----3----- D
Step 1: LSP Creation
Router A creates:
Neighbor Cost
B 2
C 5
Router B creates:
Neighbor Cost
A 2
D 1
Similarly all routers create LSPs.
Step 2: Flooding
Routers flood LSPs throughout the network and this is called global knowledge.
Now every router knows:
All routers
All links
Link costs
Step 3: Shortest Path Calculation
Router A calculates:
Path A → B → D
2+1=3
Path A → C → D
5+3=8
Shortest path:
A→B→D
Cost = 3
Characteristics of Link State Routing
1. Complete Topology Knowledge- Every router maintains complete network map.
2. Uses Dijkstra Algorithm- Shortest path calculated using Dijkstra Algorithm.
3. Flooding Mechanism- LSPs are flooded throughout the network.
4. Fast Convergence- Topology changes are updated quickly.
5. Loop-Free Routing- Accurate topology information minimizes routing loops.
6. Event-Driven Updates- Updates are sent only when topology changes occur.
7. High Scalability- Suitable for large and complex networks.
8. Higher Resource Requirement- Requires more CPU power and memory.
Advantages of Link State Routing
1. Fast Convergence- Routing changes spread quickly.
2. Accurate Routing- Routers know complete network topology.
3. Loop Prevention- Very less chance of routing loops.
4. Efficient Bandwidth Usage- Updates occur only when needed.
5. Supports Large Networks- Highly scalable routing method.
6. Better Network Stability- Provides reliable routing.
7. Faster Route Calculation- Shortest path calculated efficiently.
Disadvantages of Link State Routing
1. Complex Configuration- More difficult than Distance Vector Routing.
2. High Memory Requirement- Routers store complete topology database.
3. High CPU Usage- Dijkstra calculations require processing power.
4. Flooding Overhead- Initial flooding creates extra traffic.
5. Expensive Hardware Requirement- Powerful routers may be required.
Link State Routing Protocols
1. OSPF (Open Shortest Path First)
Features:
Uses Dijkstra Algorithm
Fast convergence
Hierarchical routing
Widely used in enterprise networks.
Applications of Link State Routing
Enterprise networks
ISP networks
Large WANs
Comparison: Link State vs Distance Vector Routing
Feature Link State Routing Distance Vector Routing
Algorithm Dijkstra Bellman-Ford
Topology Knowledge Complete Neighbor only
Updates Triggered Periodic
Convergence Fast Slow
Routing Loops Rare Common
Complexity High Low
Scalability High Low
Example OSPF RIP
4. Inter-Domain Routing Protocols
Inter-domain routing is used for routing between different autonomous systems (AS).
Each autonomous system may have its own internal routing algorithm, but communication between
them requires inter-domain routing protocols.
The most widely used protocol is:
BGP (Border Gateway Protocol).
BGP is a path vector routing protocol used to exchange routing information between autonomous
systems.
Instead of selecting the shortest path, BGP selects the best path based on policies and network
rules.
Working
Each BGP router advertises:
Destination network
Path of autonomous systems (AS path)
Routers choose the best path based on:
AS path length
Network policies
Reliability
Example
Suppose there are three autonomous systems:
AS1 → AS2 → AS3
If a router in AS1 wants to send data to AS3, BGP determines the best path:
AS1 → AS2 → AS3
The router forwards packets through AS2.
Advantages
Supports large-scale networks like the Internet
Allows policy-based routing
Provides scalability
1. IPv4 Datagram Format
IPv4 (Internet Protocol version 4) is used to deliver packets from source to destination across
networks. Data is transmitted in the form of datagrams (packets).
An IPv4 datagram consists of two parts:
1. Header
2. Data (Payload)
The IPv4 header size ranges from 20 to 60 bytes.
IPv4 Datagram Format
IPv4 Header Field Size Explanation
Version 4 bits Specifies the IP version used. For IPv4, value is 4.
HLEN (Header Indicates length of the IP header. Minimum 20 bytes and maximum
4 bits
Length) 60 bytes.
Specifies priority and quality of service like delay, throughput, and
Type of Service (ToS) 8 bits
reliability.
Represents total size of IP packet including header and data.
Total Length 16 bits
Maximum size is 65535 bytes.
Identifies fragments belonging to the same original packet during
Identification 16 bits
reassembly.
Reserved Bit 1 bit Reserved for future use and usually set to 0.
IPv4 Header Field Size Explanation
Specifies whether fragmentation is allowed or not.
DF (Don’t Fragment)
1 bit DF = 1 → Packet cannot be fragmented
Bit
DF = 0 → Fragmentation allowed
Indicates whether more fragments of the packet are remaining.
MF (More
1 bit MF = 1 → More fragments are coming
Fragments) Bit
MF = 0 → Last fragment
Specifies the position of fragment in the original packet for
Fragment Offset 13 bits
reassembly.
Time To Live (TTL) 8 bits Limits packet lifetime in network to prevent infinite looping.
Protocol 8 bits Specifies upper-layer protocol such as TCP, UDP, or ICMP.
Header Checksum 16 bits Used for error detection in the IP header.
Source IP Address 32 bits Contains IP address of sender/source host.
Destination IP
32 bits Contains IP address of receiving/destination host.
Address
0–40
Options Used for optional functions like security, routing, and debugging.
bytes
Data (Payload) Variable Contains the actual user data being transmitted.
IPv4 Addresses
An IPv4 address is a 32-bit unique identifier assigned to every device connected to a network.
It is written in dotted decimal notation.
Example: [Link]
Each IPv4 address consists of 4 octets (8 bits each).
Example in binary: 11000000.10101000.00000001.00000001
Components of IPv4 Address
An IPv4 address consists of two parts:
1. Network ID
2. Host ID
Example: [Link]
Network ID → identifies the network
Host ID → identifies a device within the network
IPv4 addressing is divided into:
1. Classful Addressing
2. Classless Addressing
3.1 Classful Addressing
In classful addressing, IP addresses are divided into five classes.
Number of
Decimal Number of
Starting Default Network Host Hosts per
Class Address Range Range of Networks Purpose
Bits Subnet Mask Bits Bits Network
1st Octet (Calculation)
(Calculation)
Class [Link] – Large
0 1 – 126 [Link] 8 24 27 - 2 = 126 224 - 2
A [Link] networks
Class [Link] – 128 – Medium
10 [Link] 16 16 214 216- 2
B [Link] 191 networks
Class [Link] – 192 – Small
110 [Link] 24 8 221 28 - 2
C [Link] 223 networks
Class [Link] – 224 – Not Not
1110 Not Defined Not Defined Not Defined Multicasting
D [Link] 239 Defined Defined
Class 1111 [Link] – 240 – Not Defined Not Not Not Defined Not Defined Research and
E [Link] 255 Defined Defined Experimental
Number of
Decimal Number of
Starting Default Network Host Hosts per
Class Address Range Range of Networks Purpose
Bits Subnet Mask Bits Bits Network
1st Octet (Calculation)
(Calculation)
Use
Advantages of Classful Addressing
1. Simple and Easy Addressing Scheme
Classful addressing divides IP addresses into fixed classes such as Class A, B, and C, making
the system easy to understand.
The fixed network and host portions simplify address identification.
Routers can easily determine the class using the first octet or starting bits.
It is easy for beginners and administrators to learn and configure.
2. Easy Routing Process
Each class has a predefined subnet mask, simplifying routing.
Routers can quickly identify network and host portions without complex calculations.
Routing becomes faster and requires less processing power.
3. Organized Address Allocation
Addresses are allocated according to network size requirements.
Large organizations use Class A, medium organizations use Class B, and small organizations
use Class C.
This provides systematic and hierarchical address distribution.
Simplifies network planning and management.
4. Simplified Network Configuration
Fixed subnet masks make network configuration easier.
Reduces complexity in setup and troubleshooting.
Network administration becomes simpler and less time-consuming.
5. Suitable for Early Networks
Worked efficiently in early Internet environments with smaller networks.
Required less memory and processing power.
Easy to implement using old networking devices.
Provided a practical solution during the initial stages of networking.
Disadvantages of Classful Addressing
1. Huge Wastage of IP Addresses
Classful addressing allocates addresses based only on predefined classes rather than actual
organizational requirements.
Organizations often receive far more IP addresses than they actually need.
For example, an organization needing only a few hundred hosts may receive a Class B
network containing more than 65,000 addresses.
Most allocated addresses remain unused, causing inefficient utilization of IPv4 address
space.
This wastage became one of the major problems of classful addressing.
2. Fixed Network and Host Division
The division between network ID and host ID is fixed and cannot be modified according to
requirements.
Organizations cannot customize address allocation based on the exact number of hosts
needed.
This lack of flexibility results in inefficient network design.
Networks requiring intermediate-sized address spaces cannot be efficiently accommodated.
The rigid structure limits efficient utilization of available addresses.
3. IPv4 Address Exhaustion
Due to large-scale wastage of addresses, available IPv4 addresses started getting exhausted
rapidly.
Many organizations occupied large address blocks without fully utilizing them.
The rapid growth of the Internet increased the demand for IP addresses, worsening the
problem.
Available public IPv4 address space became insufficient for new networks.
This address exhaustion problem eventually led to the development of CIDR and IPv6.
4. Poor Scalability for Modern Networks
Classful addressing is not suitable for modern large-scale and rapidly growing networks.
Modern networks require flexible subnetting and efficient address allocation, which classful
addressing cannot provide.
Large enterprise networks and ISPs cannot efficiently manage address space using fixed
classes.
The rigid class structure creates difficulties in expanding networks efficiently.
It cannot support the scalability requirements of today’s Internet infrastructure.
5. Lack of Efficient Subnetting Support
Classful addressing does not efficiently support subnetting because subnet masks are fixed
for each class.
Network administrators cannot create variable-sized subnets according to organizational
requirements.
Proper network segmentation becomes difficult in complex network environments.
Address management becomes inefficient due to lack of flexibility.
This limitation increases address wastage and reduces overall network efficiency.
2. Classless Addressing (CIDR)
Classless addressing removes the fixed classes and allows flexible allocation of IP addresses based
on network requirements.
CIDR stands for: Classless Inter-Domain Routing
In CIDR, the network portion is indicated using a prefix length.
CIDR Notation
CIDR addresses are written as: IP address / prefix length
Example:
[Link]/20
Meaning:
20 bits → network
12 bits → host
Hosts possible:
2^12 - 2 = 4094 hosts
Example of CIDR Allocation
Suppose an organization requires 500 hosts.
Required host bits: 2^9 = 512
So host bits = 9
Network bits: 32 - 9 = 23
CIDR block: [Link]/23
Subnet mask: [Link]
This allows 512 addresses, which fits the requirement.
Advantages of Classless Addressing (CIDR)
1. Efficient Utilization of IP Addresses
Classless addressing allocates IP addresses according to the exact number of hosts required
by an organization.
It prevents unnecessary wastage of IP addresses that occurred in classful addressing.
Organizations receive only the required address space, improving address utilization.
This helps conserve the limited IPv4 address space.
2. Reduces IPv4 Address Exhaustion
CIDR minimizes address wastage and slows down depletion of IPv4 addresses.
Smaller address blocks can be efficiently assigned to different organizations.
It extends the usability of IPv4 addressing despite increasing Internet growth.
This became one of the major reasons for adopting classless addressing.
3. Supports Variable Length Subnet Masking (VLSM)
CIDR allows subnet masks of different lengths instead of fixed subnet masks.
Networks can be divided into subnets according to actual requirements.
Different subnet sizes can exist within the same network.
This provides greater flexibility in network design and management.
4. Reduces Routing Table Size
CIDR supports route aggregation or supernetting, where multiple networks are combined
into one routing entry.
This significantly reduces routing table size in routers.
Smaller routing tables improve router performance and routing efficiency.
It also reduces memory and processing overhead.
5. Better Scalability for Modern Networks
Classless addressing is highly suitable for large and rapidly growing networks.
It supports flexible and efficient expansion of enterprise and ISP networks.
Modern Internet infrastructure depends on CIDR for scalable routing and addressing.
It efficiently handles complex network environments and large-scale communication
systems.
Difference Between Classful and Classless Addressing
Feature Classful Addressing Classless Addressing
Address Division Fixed classes (A, B, C) No fixed classes
Network Size Fixed Flexible
Address Utilization Inefficient Efficient
Routing Larger routing tables Smaller routing tables
Notation Uses default subnet masks Uses CIDR notation (/prefix)
Flexibility Low High
Transition from IPv4 to IPv6
Introduction
The Internet originally used IPv4 (Internet Protocol version 4), which provides 32-bit addresses.
However, due to the rapid growth of Internet users and connected devices, the IPv4 address space
became insufficient.
To overcome this limitation, IPv6 (Internet Protocol version 6) was developed. IPv6 uses 128-bit
addresses, providing a much larger address space.
Since IPv4 and IPv6 are not directly compatible, a transition mechanism is required to allow both
protocols to operate together during the migration process.
The transition from IPv4 to IPv6 is performed using several techniques that enable communication
between IPv4 and IPv6 networks.
The three main transition techniques are:
1. Dual Stack
Dual stack is a transition mechanism in which a device runs both IPv4 and IPv6 protocols
simultaneously.
This allows the device to communicate with both IPv4 networks and IPv6 networks.
Working
In a dual stack system, a device is assigned both an IPv4 address and an IPv6 address.
Example:
IPv4 Address → [Link]
IPv6 Address → 2001:db8::10
When communication occurs:
If the destination supports IPv6, the device uses IPv6.
If the destination supports only IPv4, the device uses IPv4.
Thus, both protocols operate together until IPv6 fully replaces IPv4.
Advantages
Easy transition method
Supports both IPv4 and IPv6 networks
No need for packet conversion
Disadvantages
Requires devices and routers to support both protocols
Increases system complexity
2. Tunneling
Tunneling is a technique in which IPv6 packets are encapsulated inside IPv4 packets so that they can
travel through IPv4 networks.
This method is used when IPv6 networks are separated by IPv4 infrastructure.
Working
1. An IPv6 packet is generated by the sender.
2. The IPv6 packet is encapsulated inside an IPv4 packet.
3. The packet travels through the IPv4 network.
4. At the destination, the IPv4 header is removed and the original IPv6 packet is recovered.
Illustration:
IPv6 Network → IPv4 Network → IPv6 Network
Encapsulation process:
IPv6 Packet → Encapsulated → IPv4 Packet → Sent through IPv4 network
Types of Tunneling
Manual Tunneling- endpoints are configured manually
Automatic Tunneling- endpoints are determined automatically
Advantages
Allows IPv6 communication across IPv4 networks
No need to upgrade entire network immediately
Disadvantages
Extra processing due to encapsulation
Increased packet overhead
3. Translation
Translation is a technique used to convert IPv4 packets into IPv6 packets and vice versa.
This method enables communication between IPv4-only devices and IPv6-only devices.
Working
When an IPv6 device communicates with an IPv4 device:
1. The IPv6 packet reaches a translation gateway.
2. The gateway converts the IPv6 packet into an IPv4 packet.
3. The packet is then sent to the IPv4 destination.
Similarly, IPv4 packets are converted into IPv6 packets when communicating with IPv6 devices.
Examples of Translation Techniques
NAT64- Allows IPv6 clients to communicate with IPv4 servers.
DNS64- Works with NAT64 to translate domain name records.
Example: An IPv6 device sends a request to an IPv4 website.
The translator converts the IPv6 packet to IPv4 so that communication becomes possible.
Advantages
Enables communication between IPv4 and IPv6 devices
Supports gradual migration
Disadvantages
Additional processing overhead
Possible loss of some IPv6 features