cn_unit_3
cn_unit_3
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.
Below is the raw diagram showing the internal components of the router:
Internal Components of Router
●
● 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
In IPv4 Packet flow identification is not In IPv6 packet flow identification are
available Available and uses the flow label field in the
header
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 (:)
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
OSPF States
The device operating OSPF goes through certain states. These states are:
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.
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.
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.
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.
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.