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

CN Unit 3

Computer network BCA subject unit 3

Uploaded by

rahulnr052020
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)
6 views

CN Unit 3

Computer network BCA subject unit 3

Uploaded by

rahulnr052020
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/ 58

Introduction to Network

Layer
Unit 3
Network Layer
• Network layer is the 3rd layer in the OSI model of computer
networks.
• It’s main function is to transfer network packets from the
source to the destination.
• Packets: All data sent over the Internet is broken down into
smaller chunks called "packets."
Cont..
• At the source, it accepts a packet from the transport
layer, encapsulates it in a datagram and then deliver the
packet to the data link layer so that it can further be
sent to the receiver.
• At the destination, the datagram is decapsulated, the
packet is extracted and delivered to the corresponding
transport layer.
• 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.
Cont..
Network Layer Functionalities:
• Routing: Devices which work on Network Layer mainly focus
on routing. Routing may include various tasks. (Network routing is
the process of selecting a path across one or more networks.)
• Logical Addressing: The network layer adds a header to the packet
which includes the logical addresses of both the sender and the
receiver.
• Internetworking: This is the main role of the network layer that it
provides the logical connection between different types of networks.
• Fragmentation: The fragmentation is a process of breaking the
packets into the smallest individual data units that travel through
different networks.
Network layer services
• The services which are offered by the network layer protocol are as
follows:
1.Packetizing
2. Routing and Forwarding
1.Packetizing
The process of encapsulating the data received from upper layers
of the network(also called as payload) in a network layer packet at the
source and decapsulating the payload from the network layer packet at
the destination is known as packetizing.
Cont..
2. Routing
• The network layer specifies has some strategies which find out the
best possible route. This process is referred to as routing.
• There are a number of routing protocols that are used in this process
and they should be run to help the routers coordinate with each
other and help in establishing communication throughout the
network.
3. Forwarding is simply defined as the action applied by each router
when a packet arrives at one of its interfaces.
• When a router receives a packet from one of its attached networks, it
needs to forward the packet to another attached network (unicast
routing) or to some attached networks(in case of multicast routing).
Packet Switching
• Packet switching is the transfer of small pieces of data
across various networks.
• These data chunks or “packets” allow for faster, more
efficient data transfer.
• 2 Types of Packet Switching
• 1. Datagram approach (Connectionless Packet
Switching)
• 2. Virtual Circuit approach (Connection-oriented
Packet Switching)
Cont..
Datagram approach (Connectionless Packet Switching)
• Each packet is independent
• Each packet contains all necessary addressing information such as
source address, destination address and port numbers, etc.
• Packets belonging to one flow may take different routes because
routing decisions are made dynamically, so the packets arrived at the
destination might be out of order. It has no connection setup.

R1 R2

R4
R3

R5
Cont..
Virtual Circuit approach (Connection-oriented Packet
Switching)
• Before starting the transmission, it establishes a logical path
or virtual connection using signaling protocol, between
sender and receiver and all packets.
• Virtual Circuit ID is provided by switches/routers to uniquely
identify this virtual connection.
• Data is divided into small units and all these small units are
appended with help of sequence numbers.
Cont..
Cont..
• Overall, three phases take place here-
• The setup (All address information is only transferred during the
setup phase)
• Data transfer and
• Tear down phase. (Disconnect the connection) virtual circuit identifier (VCI)

The data transfer

Port No 1,2,3
Cont..
Setup The destination sends an acknowledgment
to switch 3. The frame also carries VCI 77

Setup -
Acknowledgement
Network Layer Performance
The characteristics that measure the performance of a
network are :
• Bandwidth
• Throughput
• Latency (Delay)
• Packet Loss
• Jitter
Cont..
BANDWIDTH
• One of the most essential conditions of a website’s performance is
the amount of bandwidth allocated to the network.
• Bandwidth determines how rapidly the webserver is able to upload
the requested information.
• Bandwidth is characterized as the measure of data or information
that can be transmitted in a fixed measure of time.
• In the case of digital devices, the bandwidth is measured in bits per
second(bps) or bytes per second. In the case of analogue devices, the
bandwidth is measured in cycles per second, or Hertz (Hz).
Cont..
THROUGHPUT
• Throughput is the number of messages successfully transmitted per unit time.
• Bandwidth is the potential measurement of a link, whereas throughput is an actual
measurement of how fast we can send data.
• Throughput is measured by tabulating the amount of data transferred between
multiple locations during a specific period of time, usually resulting in the unit of bits
per second(bps), which has evolved to bytes per second(Bps), kilobytes per
second(KBps), megabytes per second(MBps) and gigabytes per second(GBps).
Cont..
LATENCY
• In a network, during the process of data communication, latency(also
known as delay) is defined as the total time taken for a complete message
to arrive at the destination,
• Latency=Propagation time+Transmission time+Queuing time+Processing
delay
• Eg:

• Propagation time: The first bit of the message reach to designation (B)
• Transmission time: Transmission delay is the time needed to push all the packet
bits on the transmission link.
• Queuing time: Between A and B various network devices also connected the delay
time in each device.
• Processing delay: It refers to the time taken by a router or switch to process a
packet of data before forwarding it to next node in the network.
• The network connections where small delays occur are called “Low-
Latency-Networks” and the network connections which suffer from long
delays are known as “High-Latency-Networks”.
Cont..
JITTER
• Jitter is another performance issue related to delay. In technical
terms, jitter is a “packet delay variance”.
• It can simply mean that jitter is considered as a problem when
different packets of data face different delays in a network and the
data at the receiver application is time-sensitive, i.e. audio or video
data.
• Eg: P1 (Video) and P2 (Audio), First packet P1 will reach to designation after
few seconds second packet P1 will reach to designation. So synchronization
problem occurs
• Jitter is measured in milliseconds(ms).
Cont..
• In the image, it can be noticed that the time it takes for packets to be
sent is not the same as the time in which he will arrive at the receiver
side. One of the packets faces an unexpected delay on its way and is
received after the expected time. This is jitter.
IPv4 Addresses
• IP stands for Internet Protocol and v4 stands for Version Four (IPv4).
• IPv4 was the primary version brought into action for production
within the ARPANET in 1983. (Advanced Research Projects Agency Network (ARPANET))
• IPv4 addresses are 32 bit-addresses and are divided into 4 octets(1
octet = 8 bits). They are usually represented in dotted decimals, but
binary representation is another way to represent them.
• Example- 192.168.1.152 could be an IPv4 address.

Octet=Range 0 to 255

Convert in to Binary
Number
11000000.10101000.00000001.10011000
Cont..
Cont..
• The IPv4 address works on the network layer which is responsible for
the transmission of data in the form of packets.
• IPv4 uses a 32-bit address space which provides 4,294,967,296 (232)
unique addresses, but large blocks are reserved for particular
networking purposes.
Different Types of Addressing Modes
In IPV4, Host can communicate one in 3 different ways
• Unicast addressing mode
• Broadcast addressing mode
• Multicast addressing mode
Cont..
Unicast addressing mode :
• As the name suggests, the data is
sent to only a single host(uni=one).
There is one source and one
Destination(receiver).
• Unicast addresses represent a
single LAN interface. A unicast
frame will be sent to a specific
device, not to a group of devices
on the LAN
Cont..
Broadcast addressing mode :
• In broadcast addressing mode, the data is sent to all the devices in
the network, i.e., multiple hosts.
• The destination address field of the packet consists of the IP address
called the Special Broadcast address which is represented by
255.255.255.255.
• The client then sends the packet
which is received by all other servers
on the network.
Cont..
Multicast addressing mode :
• In multicasting addressing mode, there is one source
and a group of destinations.
• The relationship between the source and the
destination is one too many. The destination address
consists of a special address starting with 224.x.x.x
• The class D addresses
(224.0.0.0 to 239.255.255.255) define the multicast
group.
Cont.. Netid is also called as prefix
Parts of IPv4 Hostid is also called as suffix
Class A (8 bits)
Here, each class has a fixed Class B (16 bits)
number of hostid and netid. Class C (24 bits)
Network part :
• The network part is also known
as net id which is used to classify
the network to which the host is
connected.
Host part :
• The host part is also known as
the host id which is the part of
the IP address which is used to
uniquely identify the host on a
network.
Network layer protocol: Internet Protocol(IP)
• The Internet Protocol
(IP) is a protocol, or
set of rules, for
routing and
addressing packets of
data so that they can
travel across networks
and arrive at the
correct destination.
• It is unreliable
datagram
protocol(post office)
Cont..
1. Version-
• Version is a 4 bit field that indicates the IP version used.
• The most popularly used IP versions are version-4 (IPv4) and version-6
(IPv6).
• Only IPv4 uses the above header.
• So, this field always contains the decimal value 4.
2. Header Length-
• Header length is a 4 bit field that contains the length of the IP header.
• It helps in knowing from where the actual data begins.
Cont..
3. Type Of Service-
• Type of service is a 8 bit field that is used for Quality of Service (QoS).
• TOS field categories different priorities of data, so that a network
device could process important data first and less important after
that.
Eg: 000 (0) – Routine, 001 (1) – Priority, 010 (2) – Immediate, etc

4. Total Length-
• Total length is a 16 bit field that contains the total length of the
datagram (in bytes).
Total length = Header length + Payload length
Cont..
5. Identification-
• Identification is a 16 bit field.
• It is used for the identification of the fragments of an original IP
datagram.
When an IP datagram is fragmented,
• Each fragmented datagram is assigned the same identification
number.
• This number is useful during the re-assembly of fragmented
datagrams.
• It helps to identify to which IP datagram, the fragmented datagram
belongs to.
Cont..
6. DF Bit-
• DF bit stands for Do Not Fragment bit.
• Its value may be 0 or 1.
When DF bit is set to 0,
• It grants the permission to the intermediate devices to fragment the datagram if
required.
When DF bit is set to 1,
• It indicates the intermediate devices not to fragment the IP datagram at any cost.
• If network requires the datagram to be fragmented to travel further but settings
does not allow its fragmentation, then it is discarded.
• An error message is sent to the sender saying that the datagram has been
discarded due to its settings.
Cont..
7. MF Bit-
• MF bit stands for More Fragments bit.
• Its value may be 0 or 1.
When MF bit is set to 0,
• It indicates to the receiver that the current datagram is either the last
fragment in the set or that it is the only fragment.
When MF bit is set to 1,
• It indicates to the receiver that the current datagram is a fragment of
some larger datagram.
• MF bit is set to 1 on all the fragments except the last one.
Cont..
8. Fragment Offset-
• Fragment Offset is a 13 bit field.
• It indicates the position of a fragmented datagram in the original
unfragmented IP datagram.
• The first fragmented datagram has a fragment offset of zero.

Fragment offset for a given fragmented datagram


= Number of data bytes ahead of it in the original
unfragmented datagram
Cont..
9. Time To Live- HOP counts refer to the number of devices, usually routers,
that a piece of data travels from source to destination.
• Time to live (TTL) is a 8 bit field.
• It indicates the maximum number of hops a datagram can take to
reach the destination.
• The main purpose of TTL is to prevent the IP datagrams from looping
around forever in a routing loop.
The value of TTL is decremented by 1 when-
• Datagram takes a hop to any intermediate device having network
layer.
• Datagram takes a hop to the destination.
If the value of TTL becomes zero before reaching the destination, then
datagram is discarded.
Cont..
10. Protocol-
• Protocol is a 8 bit field.
• It tells the network layer at the destination host to which protocol the IP
datagram belongs to.
• In other words, it tells the next level protocol to the network layer at the
destination side.
• Protocol number of ICMP is 1, IGMP is 2, TCP is 6 and UDP is 17.
11. Header Checksum-
• Header checksum is a 16 bit field.
• It contains the checksum value of the entire header.
• The checksum value is used for error checking of the header.
At each hop,
• The header checksum is compared with the value contained in this field.
• If header checksum is found to be mismatched, then the datagram is discarded.
• Router updates the checksum field whenever it modifies the datagram header.
ICMPv4
• Internet Control Message Protocol Version4 (ICMPV4)
• Since IP does not have an inbuilt mechanism for sending
error and control messages.
• So It is used for reporting errors.
Traceroute (routing path between 2 devices)
• Network diagnostics
ping
Cont..
Error reporting messages:
1. Designation unreachable
2. Source quench message :
• Source quench message is a request to decrease the traffic rate for
messages sending to the host(destination).
• ICMP will take the source IP from the discarded packet and informs
the source to slow down the message.
Cont..
3. Parameter problem :
• This message is generated when the field in the header in invalid.
• If there is a mismatch packet will be dropped by the router.
• ICMP will take the source IP from the discarded packet and informs to
the source by sending a parameter problem message.
Cont..
4. Time exceeded message :
• When some fragments are
lost in a network then the
holding fragment by the
router will be dropped then
ICMP will take the source IP
from the discarded packet
and informs the source, of
discarded datagram due to
time to live field reaches zero,
by sending time exceeded
message.
Cont..
5. 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.
Mobile IP
• Mobile IP is a communication protocol (created by extending Internet
Protocol, IP) that allows the users to move from one network to another
with the same IP address.
• It ensures that the communication will continue without the user’s
sessions or connections being dropped.
Terminologies:
1.Mobile Node (MN) is the hand-held communication device that the user
carries e.g. Cell phone.
2.Home Network is a network to which the mobile node originally belongs
as per its assigned IP address (home address).
3.Home Agent (HA) is a router in-home network to which the mobile node
was originally connected
4.Home Address is the permanent IP address assigned to the mobile node
(within its home network).
Cont..
• 5.Foreign Network is the current network to which the mobile node
is visiting (away from its home network).
• 6.Foreign Agent (FA) is a router in a foreign network to which the
mobile node is currently connected. The packets from the home
agent are sent to the foreign agent which delivers them to the mobile
node.
• 7.Correspondent Node (CN) is a device on the internet
communicating to the mobile node.
• 8.Care-of Address (COA) is the temporary address used by a mobile
node while it is moving away from its home network.
Cont..
• 9.Foreign agent COA, the COA could be located at the FA, i.e., the
COA is an IP address of the FA. The FA is the tunnel end-point and
forwards packets to the MN. Many MN using the FA can share this
COA as a common COA.
Routing Algorithms
• The routing protocol is a routing algorithm that provides the best path
from the source to the destination. The best path is the path that has the
"least-cost path" from source to the destination.
• Routing is the process of forwarding the packets from source to the
destination but the best route to send the packets is determined by the
routing algorithm.
Classification of a Routing algorithm
1. Adaptive Algorithms –
These are the algorithms that change their routing decisions
whenever network topology or traffic load changes.
Parameter: Hop Count, Distance, Transmission time

2. Non-Adaptive Algorithms –
These are the algorithms that do not change their routing
decisions once they have been selected.
Cont..
Adaptive Algorithms
• Isolated – During this technique, every node makes its routing
choices.
• It is an algorithm that obtains the routing information by using local
information rather than gathering information from other nodes.
• Centralized algorithm: It is also known as global routing algorithm as
it computes the least-cost path between source and destination by
using complete and global knowledge about the network.
• Distributed – During this technique, the node collects data from its
neighbors and then takes the choice concerning routing the packets.
Cont..
Non-Adaptive Algorithms
• Flooding: All the incoming packets will be transmitted to all outgoing
links
• Disadvantage: Multiple copies of packets
• Random walks: In case of random walks, a packet sent by the node to
one of its neighbors randomly.
• An advantage of using random walks is that it uses the alternative
routes very efficiently.
Cont..
Shortest Path Routing Algorithm:
• To Find the shortest path between a given pair of routes
• Dijkstra’s Shortest Path Algorithm
• A basic introduction to Graphs
• Graphs are pictorial representations of connections between pairs of elements. The
graphs in our case represent a network topology.
We have three types of graphs:
1.Undirected: You can move using the edges towards any direction.(without
arrows)
2.Directed: The direction you can move is specified and shown using arrows.
3.Weighted: The edges of weighted graphs denote a certain metric like
distance, time taken to move using the edges, etc.
Cont..
Cont..

{0}
We check the distances 0 -> 1 and 0 -> 2, which are 2 and 6,
respectively. We first update the distances from nodes 1 and 2 in the
table.
Cont..

Shortest path=0→1→3→4→6
Unicast Routing Protocols
Unicast – Unicast means the transmission from a single sender to a
single receiver.
There are two kinds of routing protocols available to route unicast
packets:
• Distance Vector Routing Protocol
• Link State Routing Protocol
Distance Vector Routing Protocol
• Distance Vector is simple routing protocol which takes routing
decision on the number of hops between source and destination.
• A route with less number of hops is considered as the best route.
• Ultimately, all routers build up their network topology based on the
advertisements of their peer routers
• For example Routing Information Protocol (RIP).
Cont..
Link State Routing Protocol
• Link State protocol is slightly complicated protocol than Distance
Vector.
• It takes into account the statuses of links of all the routers in a
network.
• This technique helps routes build a common graph of the entire
network.
• All routers then calculate their best path for routing purposes.
• for example, Open Shortest Path First (OSPF) and Intermediate
System to Intermediate System (ISIS).
Cont..
OSPF Messages – OSPF is a very complex protocol. It uses five different types of
messages. These are as follows:
1.Hello message (Type 1) – It is used by the routers to introduce themselves to the
other routers.

2.Database description message (Type 2) – It is normally sent in response to the


Hello message.

3.Link-state request message (Type 3) – It is used by the routers that need


information about specific Link-State packets.

4.Link-state update message (Type 4) – It is the main OSPF message for building
Link-State Database.

5.Link-state acknowledgement message (Type 5) – It is used to create reliability in


the OSPF protocol.
IPv6 Addressing
• IPv6 was developed by Internet Engineering Task Force (IETF) to deal
with the problem of IP v4 exhaustion.
• IPv6 is a 128-bits address having an address space of 2^128, which is
way bigger than IPv4.
• In IPv6 we use Colon-Hexa representation. There are 8 groups and
each group represents 2 Bytes.
• For example, given below is a 128 bit IPv6 address represented in
binary format and divided into eight 16-bits blocks:
Cont..
Cont..
• In IPv6 representation, we have three addressing methods :
• Unicast
• Multicast
• Anycast
1. Unicast Address –
• Unicast Address identifies a single network interface.
• A packet sent to a unicast address is delivered to the interface
identified by that address.
Cont..
2. Multicast Address –
• Multicast Address is used by multiple hosts, called as Group, acquires
a multicast destination address.
• These hosts need not be geographically together. If any packet is sent
to this multicast address, it will be distributed to all interfaces
corresponding to that multicast address.
Cont..
3. Anycast Address –
• Anycast Address is assigned to a group of interfaces.
• Any packet sent to an anycast address will be delivered to only one
member interface (mostly nearest host possible).

You might also like