0% found this document useful (0 votes)
17 views18 pages

Network Layer

The document discusses the design issues and functionalities of the Network Layer, including addressing, routing, and packet switching methods such as store and forward. It also covers connection-oriented and connectionless services, shortest path algorithms like Dijkstra's and Bellman-Ford, and congestion control techniques including the leaky bucket and token bucket algorithms. Additionally, it provides an overview of the Internet Protocol (IP), its history, and the differences between IPv4 and IPv6.

Uploaded by

Mukesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views18 pages

Network Layer

The document discusses the design issues and functionalities of the Network Layer, including addressing, routing, and packet switching methods such as store and forward. It also covers connection-oriented and connectionless services, shortest path algorithms like Dijkstra's and Bellman-Ford, and congestion control techniques including the leaky bucket and token bucket algorithms. Additionally, it provides an overview of the Internet Protocol (IP), its history, and the differences between IPv4 and IPv6.

Uploaded by

Mukesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Design Issues in Network Layer

The Network layer is majorly focused on getting packets from the source to the destination,
routing error handling, and congestion control. Before learning about design issues in the
network layer, let’s learn about its various functions.
 Addressing: Maintains the address at the frame header of both source and destination
and performs addressing to detect various devices in the network.
 Packeting: This is performed by Internet Protocol. The network layer converts the
packets from its upper layer.
 Routing: It is the most important functionality. The network layer chooses the most
relevant and best path for the data transmission from source to destination.
 Inter-networking: It works to deliver a logical connection across multiple devices.

Network Layer Design Issues


The network layer comes with some design issues that are described as follows:
1. Store and Forward packet switching:
The host sends the packet to the nearest router. This packet is stored there until it has fully
arrived once the link is fully processed by verifying the checksum then it is forwarded to the
next router till it reaches the destination. This mechanism is called “Store and Forward packet
switching.”
2. Services provided to the Transport Layer:
Through the network/transport layer interface, the network layer transfers its patterns services
to the transport layer. These services are described below. But before providing these services
to the transfer layer, the following goals must be kept in mind:-
 Offering services must not depend on router technology.
 The transport layer needs to be protected from the type, number, and topology of the
available router.
 The network addresses for the transport layer should use uniform numbering
patterns, also at LAN and WAN connections.
Based on the connections there are 2 types of services provided :
 Connectionless – The routing and insertion of packets into the subnet are done
individually. No added setup is required.
 Connection-Oriented – Subnet must offer reliable service and all the packets must be
transmitted over a single route.
3. Implementation of Connectionless Service:
Packets are termed as “datagrams” and corresponding subnets as “datagram subnets”. When
the message size that has to be transmitted is 4 times the size of the packet, then the network
layer divides into 4 packets and transmits each packet to the router via. a few protocols. Each
data packet has a destination address and is routed independently irrespective of the packets.
4. Implementation of Connection-Oriented service:
To use a connection-oriented service, first, we establish a connection, use it, and then release it.
In connection-oriented services, the data packets are delivered to the receiver in the same
order in which they have been sent by the sender. It can be done in either two ways :
 Circuit Switched Connection – A dedicated physical path or a circuit is established
between the communicating nodes and then the data stream is transferred.
 Virtual Circuit Switched Connection – The data stream is transferred over a packet
switched network, in such a way that it seems to the user that there is a dedicated path
from the sender to the receiver. A virtual path is established here. While, other
connections may also be using the same path.
Connection-less vs Connection-Oriented
Both Connection-less and Connection-Oriented are used for the connection establishment
between two or more devices. These types of services are provided by the Network Layer.
Connection-oriented service: In connection-Oriented service we have to establish a connection
between sender and receiver before communication. Handshske method is used to establish a
connection between sender and receiver. Connection-Oriented service include both connection
establishment as well as connection termination phase. Real life example of this service is
telephone service, for conversation we have to first establish a connection.

Connection-less service: In Connection-Less service no need of connection establishment and


connection termination. This Service does not give a guarantee of reliability. In this service,
Packets may follow the different path to reach their destination. Real life examples of this
service is postal system, Online gaming, real-time video and audio streaming etc.
Shortest Path Algorithm in Computer Network
In between sending and receiving data packets from the sender to the receiver, it will go
through many routers and subnets. So as a part of increasing the efficiency in routing the data
packets and decreasing the traffic, we must find the shortest path. In this article, we are
discussing the shortest path algorithms.
What is Shortest Path Routing?
It refers to the algorithms that help to find the shortest path between a sender and receiver for
routing the data packets through the network in terms of shortest distance, minimum cost, and
minimum time.
 It is mainly for building a graph or subnet containing routers as nodes and edges as
communication lines connecting the nodes.
 Hop count is one of the parameters that is used to measure the distance.
 Hop count: It is the number that indicates how many routers are covered. If the hop
count is 6, there are 6 routers/nodes and the edges connecting them.
 Another metric is a geographic distance like kilometers.
 We can find the label on the arc as the function of bandwidth, average traffic,
distance, communication cost, measured delay, mean queue length, etc.
Common Shortest Path Algorithms
 Dijkstra’s Algorithm
 Bellman Ford’s Algorithm
 Floyd Warshall’s Algorithm

Dijkstra’s Algorithm
The Dijkstra’s Algorithm is a greedy algorithm that is used to find the minimum distance
between a node and all other nodes in a given graph. Here we can consider node as a router
and graph as a network. It uses weight of edge .ie, distance between the nodes to find a
minimum distance route.
Algorithm:
1: Mark the source node current distance as 0 and all others as infinity.
2: Set the node with the smallest current distance among the non-visited nodes as the current
node.
3: For each neighbor, N, of the current node:
 Calculate the potential new distance by adding the current distance of the current
node with the weight of the edge connecting the current node to N.
 If the potential new distance is smaller than the current distance of node N, update
N's current distance with the new distance.
4: Make the current node as visited node.
5: If we find any unvisited node, go to step 2 to find the next node which has the smallest
current distance and continue this process.
Example:
Consider the graph G:

Now,we will start normalising graph one by one starting from node 0.

Nearest neighbour of 0 are 2 and 1 so we will normalize them first .


Similarly we will normalize other node considering it should not form a cycle and will keep track
in visited nodes.

Bellman Ford’s Algorithm


The Bell man Ford’s algorithm is a single source graph search algorithm which help us to find the
shortest path between a source vertex and any other vertex in a give graph. We can use it in
both weighted and unweighted graphs. This algorithm is slower than Dijkstra's algorithm and it
can also use negative edge weight.
Algorithm
1: First we Initialize all vertices v in a distance array dist[] as INFINITY.
2: Then we pick a random vertex as vertex 0 and assign dist[0] =0.
3: Then iteratively update the minimum distance to each node (dist[v]) by comparing it with the
sum of the distance from the source node (dist[u]) and the edge weight (weight) N-1 times.
4: To identify the presence of negative edge cycles, with the help of following cases do one
more round of edge relaxation.
 We can say that a negative cycle exists if for any edge uv the sum of distance from the
source node (dist[u]) and the edge weight (weight) is less than the current distance to
the largest node(dist[v])
 It indicates the absence of negative edge cycle if none of the edges satisfies case1.
Example: Bellman ford detecting negative edge cycle in a graph.
Consider the Graph G:

Step 1:

Step 2:
Step 3:

Step 4:
Step 5:

Outcome: The graph contains a negative cycle in the path from node D to node F and then to
node E.

Floyd Warshall’s Algorithm


The Floyd Warshall’s Algorithm is used to find the shortest path between any two nodes in a
given graph. It keeps a matrix of distances between each pair of vertices.it will continue
iterating the matrix until it reaches at a shortest path.
Algorithm:
1: Using the data about the graph, make a matrix.
2: By taking all vertices as an intermediate vertex, we have to update the final matrix.
3: It is to be noted that it includes at a time we pick one vertex, and we update the shortest
path which includes this chosen vertex as an in-between point along the path.
4: When we select a vertex say k almost like the middle of the path, in previous calculations we
have already taken all vertices P{0,1,2..,k-1} as potential middle points.
5: We have to consider the following subpoints while dealing with the source and destination
vertices I,j respectively
 If vertex k is not the part of shortest path from I to j, we don’t have to change dist[i][j]
value .ie, it will remain unchanged.
 If vertex k is indeed part of shortest path from I to j, update dist[i][j] to the sum of dist[i]
[k] and dist[k][j] but note that only if dist[i][j] is greater than this value we newly
calculated.
Example: Consider the given graph G,
Step 1:

Step 2:
Step 3:

Step 4:

Step 5:
Step 6:

Step 7:

Congestion Control in Computer Networks


Congestion control is a crucial concept in computer networks. It refers to the methods used to
prevent network overload and ensure smooth data flow. When too much data is sent through
the network at once, it can cause delays and data loss. Congestion control techniques help
manage the traffic, so all users can enjoy a stable and efficient network connection. These
techniques are essential for maintaining the performance and reliability of modern networks.
What is Congestion?
Congestion in a computer network happens when there is too much data being sent at the
same time, causing the network to slow down. Just like traffic congestion on a busy road,
network congestion leads to delays and sometimes data loss. When the network can’t handle all
the incoming data, it gets “clogged,” making it difficult for information to travel smoothly from
one place to another.

Congestion Control Algorithm


 Congestion Control is a mechanism that controls the entry of data packets into the
network, enabling a better use of a shared network infrastructure and avoiding
congestive collapse.
 Congestive-avoidance algorithms (CAA) are implemented at the TCP layer as the
mechanism to avoid congestive collapse in a network.
 There are two congestion control algorithms which are as follows:

Leaky Bucket Algorithm:


 The leaky bucket algorithm discovers its use in the context of network traffic shaping or
rate-limiting.
 A leaky bucket execution and a token bucket execution are predominantly used for
traffic shaping algorithms.
 This algorithm is used to control the rate at which traffic is sent to the network and
shape the burst traffic to a steady traffic stream.
 The disadvantages compared with the leaky-bucket algorithm are the inefficient use of
available network resources.
 The large area of network resources such as bandwidth is not being used effectively.
Let us consider an example to understand Imagine a bucket with a small hole in the bottom. No
matter at what rate water enters the bucket, the outflow is at constant rate. When the bucket is
full with water additional water entering spills over the sides and is lost.
Similarly, each network interface contains a leaky bucket and the following steps are involved in
leaky bucket algorithm:
 When host wants to send packet, packet is thrown into the bucket.
 The bucket leaks at a constant rate, meaning the network interface transmits packets at
a constant rate.
 Bursty traffic is converted to a uniform traffic by the leaky bucket.
 In practice the bucket is a finite queue that outputs at a finite rate.

Token Bucket Algorithm:


 The leaky bucket algorithm has a rigid output design at an average rate independent of
the bursty traffic.
 In some applications, when large bursts arrive, the output is allowed to speed up. This
calls for a more flexible algorithm, preferably one that never loses information.
Therefore, a token bucket algorithm finds its uses in network traffic shaping or rate-
limiting.
 It is a control algorithm that indicates when traffic should be sent. This order comes
based on the display of tokens in the bucket.
 The bucket contains tokens. Each of the tokens defines a packet of predetermined size.
Tokens in the bucket are deleted for the ability to share a packet.
 When tokens are shown, a flow to transmit traffic appears in the display of tokens.
 No token means no flow sends its packets. Hence, a flow transfers traffic up to its peak
burst rate in good tokens in the bucket.
Need of Token Bucket Algorithm
The leaky bucket algorithm enforces output pattern at the average rate, no matter how bursty
the traffic is. So in order to deal with the bursty traffic we need a flexible algorithm so that the
data is not lost. One such algorithm is token bucket algorithm.
Steps of this algorithm can be described as follows:
 In regular intervals tokens are thrown into the bucket. ƒ
 The bucket has a maximum capacity. ƒ
 If there is a ready packet, a token is removed from the bucket, and the packet is sent.
 If there is no token in the bucket, the packet cannot be sent.
Let’s understand with an example, In figure (A) we see a bucket holding three tokens, with five
packets waiting to be transmitted. For a packet to be transmitted, it must capture and destroy
one token. In figure (B) We see that three of the five packets have gotten through, but the other
two are stuck waiting for more tokens to be generated.

Token Bucket vs Leaky Bucket


The leaky bucket algorithm controls the rate at which the packets are introduced in the
network, but it is very conservative in nature. Some flexibility is introduced in the token bucket
algorithm. In the token bucket algorithm, tokens are generated at each tick (up to a certain
limit). For an incoming packet to be transmitted, it must capture a token and the transmission
takes place at the same rate. Hence some of the busty packets are transmitted at the same rate
if tokens are available and thus introduces some amount of flexibility in the system.
Formula: M * s = C + ? * s where S – is time taken M – Maximum output rate ? – Token arrival
rate C – Capacity of the token bucket in byte
Let’s understand with an example,

Advantages
 Stable Network Operation
 Reduced Delays
 Less Data Loss
 Optimal Resource Utilization
 Scalability
 Adaptability
Disadvantages
 Complexity
 Overhead
 Algorithm Sensitivity
 Resource Allocation Issues
 Dependency on Network Infrastructure

What is IP?
Here, IP stands for internet protocol. It is a protocol defined in the TCP/IP model used for
sending the packets from source to destination. The main task of IP is to deliver the packets
from source to the destination based on the IP addresses available in the packet headers. IP
defines the packet structure that hides the data which is to be delivered as well as the
addressing method that labels the datagram with a source and destination information.
An IP protocol provides the connectionless service, which is accompanied by two transport
protocols, i.e., TCP/IP and UDP/IP, so internet protocol is also known as TCP/IP or UDP/IP.
The first version of IP (Internet Protocol) was IPv4. After IPv4, IPv6 came into the market, which
has been increasingly used on the public internet since 2006.
History of Internet Protocol
The development of the protocol gets started in 1974 by Bob Kahn and Vint Cerf. It is used in
conjunction with the Transmission Control Protocol (TCP), so they together named the TCP/IP.
The first major version of the internet protocol was IPv4, which was version 4. This protocol was
officially declared in RFC 791 by the Internet Engineering Task Force (IETF) in 1981.
After IPv4, the second major version of the internet protocol was IPv6, which was version 6. It
was officially declared by the IETF in 1998. The main reason behind the development of IPv6
was to replace IPv4. There is a big difference between IPv4 and IPv6 is that IPv4 uses 32 bits for
addressing, while IPv6 uses 128 bits for addressing.
Function : The main function of the internet protocol is to provide addressing to the hosts,
encapsulating the data into a packet structure, and routing the data from source to the
destination across one or more IP networks. In order to achieve these
functionalities, internet protocol provides two major things which are given below.
An internet protocol defines two things:
o Format of IP packet
o IP Addressing system
What is an IP packet?
Before an IP packet is sent over the network, two major components are added in an IP packet,
i.e., header and a payload.

An IP header contains lots of information about the IP packet which includes:


o Source IP address: The source is the one who is sending the data.
o Destination IP address: The destination is a host that receives the data from the sender.
o Header length
o Packet length
o TTL (Time to Live): The number of hops occurs before the packet gets discarded.
o Transport protocol: The transport protocol used by the internet protocol, either it can be
TCP or UDP.
There is a total of 14 fields exist in the IP header, and one of them is optional.
Payload: Payload is the data that is to be transported.
How does the IP routing perform?
IP routing is a process of determining the path for data so that it can travel from the source to
the destination. As we know that the data is divided into multiple packets, and each packet will
pass through a web of the router until it reaches the final destination. The path that the data
packet follows is determined by the routing algorithm. The routing algorithm considers various
factors like the size of the packet and its header to determine the efficient route for the data
from the source to the destination. When the data packet reaches some router, then the source
address and destination address are used with a routing table to determine the next hop's
address. This process goes on until it reaches the destination. The data is divided into multiple
packets so all the packets will travel individually to reach the destination.
For example, when an email is sent from the email server, then the TCP layer in this email server
divides the data into multiple packets, provides numbering to these packets and transmits them
to the IP layer. This IP layer further transmits the packet to the destination email server. On the
side of the destination server, the IP layer transmits these data packets to the TCP layer, and the
TCP layer recombines these data packets into the message. The message is sent to the email
application.
What is IP Addressing?
An IP address is a unique identifier assigned to the computer which is connected to the internet.
Each IP address consists of a series of characters like 192.168.1.2. Users cannot access the
domain name of each website with the help of these characters, so DNS resolvers are used that
convert the human-readable domain names into a series of characters. Each IP packet contains
two addresses, i.e., the IP address of the device, which is sending the packet, and the IP address
of the device which is receiving the packet.
Types of IP addresses
IPv4 addresses are divided into two categories:
o Public address
o Private address

Public address
The public address is also known as an external address as they are grouped under the WAN
addresses. We can also define the public address as a way to communicate outside the network.
This address is used to access the internet. The public address available on our computer
provides the remote access to our computer. With the help of a public address, we can set up
the home server to access the internet. This address is generally assigned by the ISP (Internet
Service Provider).
Key points related to public address are:
o The scope of the public address is global, which means that we can communicate
outside the network.
o This address is assigned by the ISP (Internet Service Provider).
o It is not available at free of cost.
o We can get the Public IP by typing on Google "What is my IP".
Private address
A private address is also known as an internal address, as it is grouped under the LAN addresses.
It is used to communicate within the network. These addresses are not routed on the internet
so that no traffic can come from the internet to this private address. The address space for the
private address is allocated using InterNIC to create our own network. The private addresses are
assigned to mainly those computers, printers, smartphones, which are kept inside the home or
the computers that are kept within the organization. For example, a private address is assigned
to the printer, which is kept inside our home, so that our family member can take out the print
from the printer.
If the computer is assigned with a private address, then the devices available within the local
network can view the computer through the private ip address. However, the devices available
outside the local network cannot view the computer through the private IP address, but they
can access the computer if they know the router's public address. To access the computer
directly, NAT (Network Address Translator) is to be used.
Key points related to private address are:
o Its scope is local, as we can communicate within the network only.
o It is generally used for creating a local area network.
o It is available at free of cost.
o We can get to know the private IP address by simply typing the "ipconfig" on the
command prompt.

You might also like