0% found this document useful (0 votes)
12 views

cn_unit_3

The document provides an overview of the Network Layer in the OSI model, detailing its functions such as routing, logical addressing, internetworking, and fragmentation. It also discusses the services provided by the Network Layer, including guaranteed delivery and security services, and explains the role of routers and their internal components. Additionally, the document compares IPv4 and IPv6, introduces the OSPF routing protocol, and outlines its operational states and message formats.

Uploaded by

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

cn_unit_3

The document provides an overview of the Network Layer in the OSI model, detailing its functions such as routing, logical addressing, internetworking, and fragmentation. It also discusses the services provided by the Network Layer, including guaranteed delivery and security services, and explains the role of routers and their internal components. Additionally, the document compares IPv4 and IPv6, introduces the OSPF routing protocol, and outlines its operational states and message formats.

Uploaded by

rkawadkar2025
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

UNIT No.

3
o The Network Layer is the third layer of the OSI model.
o It handles the service requests from the transport layer and further forwards the service
request to the data link layer.
o The network layer translates the logical addresses into physical addresses
o It determines the route from the source to the destination and also manages the traffic
problems such as switching, routing and controls the congestion of data packets.
o The main role of the network layer is to move the packets from sending host to the
receiving host.

The main functions performed by the network layer are:


o Routing: When a packet reaches the router's input link, the router will move the packets
to the router's output link. For example, a packet from S1 to R1 must be forwarded to
the next router on the path to S2.
o Logical Addressing: The data link layer implements the physical addressing and
network layer implements the logical addressing. Logical addressing is also used to
distinguish between source and destination system. The network layer adds a header to
the packet which includes the logical addresses of both the sender and the receiver.
o Internetworking: This is the main role of the network layer that it provides the logical
connection between different types of networks.
o Fragmentation: The fragmentation is a process of breaking the packets into the smallest
individual data units that travel through different networks.

Services Provided by the Network Layer


o Guaranteed delivery: This layer provides the service which guarantees that the packet
will arrive at its destination.
o Guaranteed delivery with bounded delay: This service guarantees that the packet will
be delivered within a specified host-to-host delay bound.
o In-Order packets: This service ensures that the packet arrives at the destination in the
order in which they are sent.
o Guaranteed max jitter: This service ensures that the amount of time taken between two
successive transmissions at the sender is equal to the time between their receipt at the
destination.
o Security services: The network layer provides security by using a session key between
the source and destination host. The network layer in the source host encrypts the
payloads of datagrams being sent to the destination host. The network layer in the
destination host would then decrypt the payload. In such a way, the network layer
maintains the data integrity and source authentication services.
o A Router is a networking device that fulfills the need for devices to
share files and forward data packets between devices over computer
networks. Routers perform some directing functions on the Internet so
the data sent over the internet, such as a web page in the form of data
packets
o Example: Let us understand this by a very general example, suppose,
we search for www.google.com in your web browser then this will be a
request which will be sent from system to the google`s server to serve
that webpage, now the request is nothing but a stream of packets don`t
just go the google`s server straightaway they go through a series of
devices known as a router which accepts this packets and forwards
them to correct path and hence it reaches to the destination server.

o How does Router work?

o A wireless router connects directly to a modem by a cable then a router


can receive and transmit information or data to the internet. Then the
router starts to communicate with the wifi network and provides internet
access to all devices within the network range of the router.
o A generic router consists of the following components:
1. Input Port: This is the interface by which packets are admitted into the
router, it performs several key functions as terminating the physical link at
the router
2. Switching Fabric: This is the main component of the Router, it connects
the input ports with the output ports. It is kind of a network inside a
networking device.
3. Output Ports: This is the segment from which packets are transmitted out
of the router. The output port looks at its queuing buffers (when more than
one packets have to be transmitted through the same output port queuing
buffers are formed) and takes packets
4. Routing Processor: It executes the routing protocols, and works like a
traditional CPU. It uses various routing algorithms like link-state algorithm,
distance-vector algorithm, etc.

The Internal Components of Router:

Below is the raw diagram showing the internal components of the router:
Internal Components of Router

The router is an intelligent device, routers use routing algorithms such


as Dijkstra’s Algorithm to map the destination or to find the best route to a
destination on the parameters like the number of hops.
1. CPU: The CPU in the router executes the commands and processes the
commands in the operating system. The flow of data on the interface is
controlled by the CPU.
2. ROM: Read Only Memory in the router mainly works when the router boots
up or is powered up. It stores the bootstrap program needed when the
router is turned on.
3. RAM: Random Access Memory in the router contains the executable file
and running file of the configuration file and the contents are lost when the
router’s power is turned off.
4. Flash Memory: It contains the operating system. The data of the flash
memory remain unchanged when the router is rebooted or powered off.
So, whenever the router is powered on the OS is loaded into RAM from
flash memory.
5. NVRAM: It stands for Nonvolatile RAM. It is a backup copy of the running
configuration file. Its functioning basically helps when the router loses
power and the router needs to establish the configuration and load it again.
The content of NVRAM is changeable. When the router is powered on it
searches the startup-config file in NVRAM only.
6. Interfaces / Ports: If we want to connect the router with wire or we want a
wired connection there are multiple interfaces that are used to connect the
network. i.e. Fast Ethernet, Gigabit Ethernet, and Serial.


● IPv4 and IPv6 are internet protocol version 4 and internet protocol
version 6, IP version 6 is the new version of Internet Protocol, which is
way better than IP version 4 in terms of complexity and efficiency.
● Difference Between IPv4 and IPv6:

IPv4 IPv6

IPv4 has a 32-bit address length IPv6 has a 128-bit address length

It Supports Manual and DHCP address It supports Auto and renumbering address
configuration configuration

In IPv4 end to end, connection integrity In IPv6 end to end, connection integrity is
is Unachievable Achievable

Address space of IPv6 is quite large it can


It can generate 4.29×109 address space produce 3.4×1038 address space

The Security feature is dependent on IPSEC is an inbuilt security feature in the


application IPv6 protocol

Address representation of IPv4 is in Address Representation of IPv6 is in


decimal hexadecimal

Fragmentation performed by Sender and In IPv6 fragmentation performed only by the


forwarding routers sender

In IPv4 Packet flow identification is not In IPv6 packet flow identification are
available Available and uses the flow label field in the
header

In IPv4 checksum field is available In IPv6 checksum field is not available

It has broadcast Message Transmission In IPv6 multicast and anycast message


Scheme transmission scheme is available

In IPv6 Encryption and Authentication are


In IPv4 Encryption and Authentication provided
facility not provided

IPv6 has header of 40 bytes fixed


IPv4 has a header of 20-60 bytes.

IPv4 can be converted to IPv6 Not all IPv6 can be converted to IPv4

IPv4 consist of 4 fields which are IPv6 consist of 8 fields, which are separated
separated by dot (.) by colon (:)

IPv4’s IP addresses are divided into


five different classes. Class A , Class B,
Class C , Class D , Class E. IPv6 does not have any classes of IP address.

IPv4 supports VLSM(Variable Length


subnet mask). IPv6 does not support VLSM.

Example of IPv6:
Example of IPv4: 66.94.29.13 2001:0000:3238:DFE1:0063:0000:0000:FEFB

The OSPF stands for Open Shortest Path First. It is a widely used and
supported routing protocol. It is an intra domain protocol, which means that it
is used within an area or a network. It is an interior gateway protocol that has
been designed within a single autonomous system. It is based on a link-state
routing algorithm in which each router contains the information of every
domain, and based on this information, it determines the shortest path. The
goal of routing is to learn routes. The OSPF achieves by learning about every
router and subnet within the entire network. Every router contains the same
information about the network. The way the router learns this information by
sending LSA (Link State Advertisements). These LSAs contain information
about every router, subnet, and other networking information. Once the LSAs
have been flooded, the OSPF stores the information in a link-state database
known as LSDB. The main goal is to have the same information about every
router in an LSDBs.

OSPF Terms

1. Router Id – It is the highest active IP address present on the router. First,


the highest loopback address is considered. If no loopback is configured
then the highest active IP address on the interface of the router is
considered.
2. Router priority – It is an 8-bit value assigned to a router operating OSPF,
used to elect DR and BDR in a broadcast network.
3. Designated Router (DR) – It is elected to minimize the number of
adjacencies formed. DR distributes the LSAs to all the other routers. DR is
elected in a broadcast network to which all the other routers share their
DBD. In a broadcast network, the router requests for an update to DR, and
DR will respond to that request with an update.
4. Backup Designated Router (BDR) – BDR is a backup to DR in a
broadcast network. When DR goes down, BDR becomes DR and performs
its functions.
5. DR and BDR election – DR and BDR election takes place in the
broadcast network or multi-access network. Here are the criteria for the
election:
● The router having the highest router priority will be declared as DR.
● If there is a tie in router priority then the highest router I’d be
considered. First, the highest loopback address is considered. If no
loopback is configured then the highest active IP address on the
interface of the router is considered.

OSPF States
The device operating OSPF goes through certain states. These states are:

● Down – In this state, no hello packets have been received on the


interface.
● Note – The Downstate doesn’t mean that the interface is
physically down. Here, it means that the OSPF adjacency
process has not started yet.
● INIT – In this state, the hello packets have been received from the other
router.
● 2WAY – In the 2WAY state, both the routers have received the hello
packets from other routers. Bidirectional connectivity has been
established.
● Note – In between the 2WAY state and Exstart state, the DR and
BDR election takes place.
● Exstart – In this state, NULL DBD are exchanged. In this state, the master
and slave elections take place. The router having the higher router I’d
become the master while the other becomes the slave. This election
decides Which router will send its DBD first (routers who have formed
neighbourship will take part in this election).
● Exchange – In this state, the actual DBDs are exchanged.
● Loading – In this state, LSR, LSU, and LSA (Link State
Acknowledgement) are exchanged.
Important – When a router receives DBD from other router, it compares its
own DBD with the other router DBD. If the received DBD is more updated
than its own DBD then the router will send LSR to the other router stating
what links are needed. The other router replies with the LSU containing the
updates that are needed. In return to this, the router replies with the Link
State Acknowledgement.
● Full – In this state, synchronization of all the information takes place.
OSPF routing can begin only after the Full state.

OSPF divides the autonomous systems into areas where the area is a collection of
networks, hosts, and routers. Like internet service providers divide the internet into a
different autonomous system for easy management and OSPF further divides the
autonomous systems into Areas.

Routers that exist inside the area flood the area with routing information

In Area, the special router also exists. The special routers are those that are present at
the border of an area, and these special routers are known as Area Border Routers. This
router summarizes the information about an area and shares the information with other
areas.

How does OSPF work?


There are three steps that can explain the working of OSPF:
Step 1: The first step is to become OSPF neighbors. The two connecting routers running
OSPF on the same link creates a neighbor relationship.
Step 2: The second step is to exchange database information. After becoming the
neighbours, the two routers exchange the LSDB information with each other.
Step 3: The third step is to choose the best route. Once the LSDB information has been
exchanged with each other, the router chooses the best route to be added to a routing
table based on the calculation of SPF.

How a router forms a neighbour relationship?


The first thing is happened before the relationship is formed is that each router chooses
the router ID.

Router ID (RID): The router ID is a number that uniquely identifies each router on a
network. The router ID is in the format of the IPv4 address. There are a few ways to set
the router ID, the first way is to set the router ID manually and the other way is to let
the router decides itself.

The following is the logic that the router chooses to set the router ID:

o Manually assigned: The router checks whether the router ID is manually set or
not. If it manually set, then it is a router ID. If it is not manually set, then it will
choose the highest 'up' status loopback interface IP address. If there are no
loopback interfaces, then it will choose the highest 'up' status non-loopback
interface IP address.

Two routers connected to each other through point to point or multiple routers are
connected can communicate with each other through an OSPF protocol. The two
routers are adjacent only when both the routers send the HELLO packet to each other.
When both the routers receive the acknowledgment of the HELLO packet, then they
come in a two-way state. As OSPF is a link state routing protocol, so it allows to create
the neighbour relationship between the routers. The two routers can be neighbors only
when they belong to the same subnet, share the same area id, subnet mask, timers,
and authentication. The OSPF relationship is a relationship formed between the routers
so that they can know each other. The two routers can be neighbors if atleast one of
them is designated router or backup designated router in a network, or connected
through a point-to-point link.

Types of links in OSPF


A link is basically a connection, so the connection between two routers is known as a
link.
There are four types of links in OSPF:
1. Point-to-point link: The point-to-point link directly connects the two routers without
any host or router in between.
2. Transient link: When several routers are attached in a network, they are known as a
transient link.
The transient link has two different implementations:
Unrealistic topology: When all the routers are connected to each other, it is known as
an unrealistic topology.
Realistic topology: When some designated router exists in a network then it is known
as a realistic topology. Here designated router is a router to which all the routers are
connected. All the packets sent by the routers will be passed through the designated
router.
3. Stub link: It is a network that is connected to the single router. Data enters to the
network through the single router and leaves the network through the same router.
4. Virtual link: If the link between the two routers is broken, the administration creates the
virtual path between the routers, and that path could be a long one also.

OSPF Message Format


The following are the fields in an OSPF message format:

o Version: It is an 8-bit field that specifies the OSPF protocol version.


o Type: It is an 8-bit field. It specifies the type of the OSPF packet.
o Message: It is a 16-bit field that defines the total length of the message, including the
header. Therefore, the total length is equal to the sum of the length of the message and
header.
o Source IP address: It defines the address from which the packets are sent. It is a
sending routing IP address.
o Area identification: It defines the area within which the routing takes place.
o Checksum: It is used for error correction and error detection.
o Authentication type: There are two types of authentication, i.e., 0 and 1. Here, 0 means
for none that specifies no authentication is available and 1 means for pwd that specifies
the password-based authentication.
o Authentication: It is a 32-bit field that contains the actual value of the authentication
data.

Border Gateway Protocol (BGP):


It is used to Exchange routing information for the internet and is the protocol
used between ISP which are different Autonomous systems.
BGP is the main routing protocol of the internet - It a external route protocol
used to provide route selection. And is what all ISPs use to exchange
advertise their networks.

The protocol can connect together any internetwork of autonomous system


using an arbitrary topology. The only requirement is that each AS have at
least one router that is able to run BGP and that is router connect to at least
one other AS’s BGP router. BGP’s main function is to exchange network
reach-ability information with other BGP systems. Border Gateway Protocol
constructs an autonomous systems’ graph based on the information
exchanged between BGP routers.
Characteristics of Border Gateway Protocol (BGP):
● Inter-Autonomous System Configuration: The main role of BGP is to
provide communication between two autonomous systems.
● BGP supports Next-Hop Paradigm.
● Coordination among multiple BGP speakers within the AS (Autonomous
System).
● Path Information: BGP advertisement also include path information, along
with the reachable destination and next destination pair.
● Policy Support: BGP can implement policies that can be configured by
the administrator. For ex:- a router running BGP can be configured to
distinguish between the routes that are known within the AS and that which
are known from outside the AS.
● Runs Over TCP.
● BGP conserve network Bandwidth.
● BGP supports CIDR.
● BGP also supports Security.

BGP peers performs 3 functions, which are given below.


1. The first function consist of initial peer acquisition and authentication. both
the peers established a TCP connection and perform message exchange
that guarantees both sides have agreed to communicate.
2. The second function mainly focus on sending negative or positive reach-
ability information.
3. The third function verifies that the peers and the network connection
between them are functioning correctly.

BGP Route Information Management Functions:


● Route Storage: Each BGP stores information about how to reach other
networks.
● Route Update: In this task, Special techniques are used to determine
when and how to use the information received from peers to properly
update the routes.
● Route Selection: Each BGP uses the information in its route databases to
select good routes to each network on the internet network.
● Route advertisement: Each BGP speaker regularly tells its peer what is
known about various networks and methods to reach them.

ICMP Protocol
The ICMP stands for Internet Control Message Protocol. It is a network layer protocol.
It is used for error handling in the network layer, and it is primarily used on network
devices such as routers. As different types of errors can exist in the network layer, so
ICMP can be used to report these errors and to debug those errors.
For example, some sender wants to send the message to some destination, but the
router couldn't send the message to the destination. In this case, the router sends the
message to the sender that I could not send the message to that destination.
The IP protocol does not have any error-reporting or error-correcting mechanism, so it
uses a message to convey the information. For example, if someone sends the message
to the destination, the message is somehow stolen between the sender and the
destination. If no one reports the error, then the sender might think that the message
has reached the destination. If someone in-between reports the error, then the sender
will resend the message very quickly.

The ICMP messages are usually divided into two categories:

o Error-reporting messages

The error-reporting message means that the router encounters a problem when it
processes an IP packet then it reports a message.
o Query messages
The query messages are those messages that help the host to get the specific
information of another host. For example, suppose there are a client and a server, and
the client wants to know whether the server is live or not, then it sends the ICMP
message to the server.

ICMP Message Format


The message format has two things; one is a category that tells us which type of
message it is. If the message is of error type, the error message contains the type and
the code. The type defines the type of message while the code defines the subtype of
the message.
The ICMP message contains the following fields:

o Type: It is an 8-bit field. It defines the ICMP message type. The values range from 0 to
127 are defined for ICMPv6, and the values from 128 to 255 are the informational
messages.
o Code: It is an 8-bit field that defines the subtype of the ICMP message
o Checksum: It is a 16-bit field to detect whether the error exists in the message or not.

Note: The ICMP protocol always reports the error messages to the original source.
For example, when the sender sends the message, if any error occurs in the
message then the router reports to the sender rather than the receiver as the
sender is sending the message.
o Destination unreachable

The destination unreachable error occurs when the packet does not reach the
destination. Suppose the sender sends the message, but the message does not reach
the destination, then the intermediate router reports to the sender that the destination
is unreachable.

The above diagram shows the message format of the destination unreachable
message. In the message format:

Type: It defines the type of message. The number 3 specifies that the destination is
unreachable.

Code (0 to 15): It is a 4-bit number which identifies whether the message comes from
some intermediate router or the destination itself.

o Source quench

There is no flow control or congestion control mechanism in the network layer or the IP
protocol. The sender is concerned with only sending the packets, and the sender does
not think whether the receiver is ready to receive those packets or is there any
congestion occurs in the network layer so that the sender can send a lesser number of
packets, so there is no flow control or congestion control mechanism. In this case,
ICMP provides feedback, i.e., source quench. Suppose the sender resends the packet at
a higher rate, and the router is not able to handle the high data rate. To overcome such
a situation, the router sends a source quench message to tell the sender to send the
packet at a lower rate.

The above diagram shows the message format of the source quench message. It is a
type 4 message, and code is zero.

o Time exceeded
Sometimes the situation arises when there are many routers that exist between the
sender and the receiver. When the sender sends the packet, then it moves in a routing
loop. The time exceeded is based on the time-to-live value. When the packet traverses
through the router, then each router decreases the value of TTL by one. Whenever a
router decreases a datagram with a time-to-live value to zero, then the router discards
a datagram and sends the time exceeded message to the original source.

Each of the MAC layers has different data units. For example, some layers can handle
upto 1500 data units, and some can handle upto 300 units. When the packet is sent
from a layer having 1500 units to the layer having 300 units, then the packet is divided
into fragments; this process is known as fragmentation. These 1500 units are divided
into 5 fragments, i.e., f1, f2, f3, f4, f5, and these fragments reach the destination in a
sequence. If all the fragments are not reached to the destination in a set time, they
discard all the received fragments and send a time-exceeded message to the original
source.

In the case of fragmentation, the code will be different as compared to TTL. Let's
observe the message format of time exceeded.

The above message format shows that the type of time-exceeded is 11, and the code
can be either 0 or 1. The code 0 represents TTL, while code 1 represents fragmentation.
In a time-exceeded message, the code 0 is used by the routers to show that the time-
to-live value is reached to zero.

The code 1 is used by the destination to show that all the fragments do not reach within
a set time.

Parameter problems

The router and the destination host can send a parameter problem message. This
message conveys that some parameters are not properly set.
The above diagram shows the message format of the parameter problem. The type of
message is 12, and the code can be 0 or 1.

Redirection

When the packet is sent, then the routing table is gradually augmented and updated.
The tool used to achieve this is the redirection message. For example, A wants to send
the packet to B, and there are two routers exist between A and B. First, A sends the
data to the router 1. The router 1 sends the IP packet to router 2 and redirection
message to A so that A can update its routing table.

You might also like