0% found this document useful (0 votes)
13 views10 pages

Networking Unit 4

The document provides an overview of the Network Layer, which is the third layer of the OSI model, responsible for routing, logical addressing, internetworking, and fragmentation of data packets. It discusses IPv4 addresses, their structure, and the differences between classful and classless addressing, as well as subnetting and supernetting techniques. Additionally, it highlights the transition to IPv6, addressing its advantages over IPv4, including a larger address space and improved header formats.

Uploaded by

ikshitij975
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)
13 views10 pages

Networking Unit 4

The document provides an overview of the Network Layer, which is the third layer of the OSI model, responsible for routing, logical addressing, internetworking, and fragmentation of data packets. It discusses IPv4 addresses, their structure, and the differences between classful and classless addressing, as well as subnetting and supernetting techniques. Additionally, it highlights the transition to IPv6, addressing its advantages over IPv4, including a larger address space and improved header formats.

Uploaded by

ikshitij975
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/ 10

UNIT 4

Network Layer

NETWORK LAYER
● The Network Layer is the third layer of the OSI model.
● It handles the service requests from the transport layer and further forwards the
service request to the data link layer.
● The network layer translates the logical addresses into physical addresses
● 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.
● The main role of the network layer is to move the packets from the sending host to the
receiving host.

The main functions performed by the network layer are:

➔ 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.

➔ 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.

➔ Internetworking: This is the main role of the network layer that 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.

IPV4 ADDRESSES
An IPv4 address is a 32-bit address that uniquely and universally defines the connection
of a host or a router to the Internet. IPv4 addresses are unique in the sense that each
address defines one, and only one, connection to the Internet.
IPv4 addresses are universal in the sense that the addressing system must be accepted
by any host that wants to be connected to the Internet.
Address Space
An address space is the total number of addresses used by the protocol. If a protocol
uses b bits to define an address, the address space is 2b because each bit can have two
different values (0 or 1). IPv4 uses 32-bit addresses, which means that the address
space is 232 or 4,294,967,296 (more than four billion). If there were no restrictions,
more than 4 billion devices could be connected to the Internet.

Notation
There are three common notations to show an IPv4 address: binary notation (base 2), dotted-
decimal notation (base 256), and hexadecimal notation (base 16).

Hierarchy in Addressing
A 32-bit IPv4 address is also hierarchical, but divided only into two parts. The first part
of the address, called the prefix, defines the network; the second part of the address,
called the suffix, defines the node (connection of a device to the Internet). The prefix
length is n bits and the suffix length is (32- n) bits.
Classful Addressing:

Class A
● The first octet denotes the network address, and the last three octets are the host
portion. Any IP address whose first octet is between 1 and 126 is a Class A address. Note
that 0 is reserved as a part of the default address and 127 is reserved for internal
loopback testing.
● Format: network.host.host.host
● Default subnet mask = 255.0.0.0 or (slash notation) /8

Class B
● The first two octets denote the network address, and the last two octets are the host
portion. Any address whose first octet is in the range 128 to 191 is a Class B address.
● Format: network.network.host.host
● Default subnet mask =255.255.0.0 or /16

Class C
● The first three octets denote the network address, and the last octet is the host
portion. The first octet range of 192 to 223 is a Class C address.
● Format: network.network.network.host
● Default subnet mask = 255.255.255.0 or /24

Class D
● Used for multicast.
● Multicast IP addresses have their first octets in the range 224 to 239.

Class E
● Reserved for future use or research purpose and includes the range of addresses with a
first octet from 240 to 255.
address class.

Subnetting and Supernetting

In subnetting, a class A or class B block is divided into several subnets. Each subnet has
a larger prefix length than the original network. For example, if a network in class A is
divided into four subnets, each subnet has a prefix of nsub = 10. At the same time, if all
of the addresses in a network are not used, subnetting allows the addresses to be
divided among several organizations.
While subnetting was devised to divide a large block into smaller ones, supernetting was
devised to combine several class C blocks into a larger block to be attractive to
organizations that need more than the 256 addresses available in a class C block. This
idea did not work either because it makes the routing of packets more difficult.

Advantage of Classful Addressing

Given an address, we can easily find the class of the address and, since the prefix length
for each class is fixed, we can find the prefix length immediately.
In other words, the prefix length in classful addressing is inherent in the address; no
extra information is needed to extract the prefix and the suffix.

Classless Addressing:
In 1996, the Internet authorities announced a new architecture called classless
addressing. In classless addressing, variable-length blocks are used that belong to no
classes. We can have a block of 1 address, 2 addresses, 4 addresses, 128 addresses, and
so on. In classless addressing, the whole address space is divided into variable length
blocks. The prefix in an address defines the block (network); the suffix defines the
0 1 2 32
node (device). Theoretically, we can have a block of 2 , 2 , 2 , . . . , 2 addresses.

Unlike classful addressing, the prefix length in classless addressing is variable. We can
have a prefix length that ranges from 0 to 32. The size of the network is inversely
proportional to the length of the prefix. A small prefix means a larger network; a large
prefix means a smaller network. The idea of classless addressing can be easily applied to
classful addressing. An address in class A can be thought of as a classless address in
which the prefix length is 8. An address in class B can be thought of as a classless
address in which the prefix is 16, and so on. In other words, classful addressing is a
special case of classless addressing.

Prefix Length: Slash Notation:

In this case, the prefix length, n, is added to the address, separated by a slash. The
notation is informally referred to as slash notation and formally as classless interdomain
routing or CIDR (pronounced cider) strategy.
Extracting Information from an Address
Three pieces of information about the block to which the address belongs: the number
of addresses, the first address in the block, and the last address.

32−n
1. The number of addresses in the block is found as N = 2 .
2. To find the first address, we keep the n leftmost bits and set the (32 − n) rightmost bits
all to 0s.
3. To find the last address, we keep the n leftmost bits and set the (32 − n) rightmost bits
all to 1s.

Subnetting

An organization (or an ISP) that is granted a range of addresses may divide the range
into several subranges and assign each subrange to a subnetwork (or subnet). Note that
nothing stops the organization from creating more levels. A subnetwork can be divided
into several sub- subnetworks. A sub-subnetwork can be divided into several
sub-sub-subnetworks, and so on.

Designing Subnets
We assume the total number of addresses granted to the organization is N, the prefix
length is n, the assigned number of addresses to each subnetwork is Nsub, and the prefix
length for each subnetwork is nsub. Then the following steps need to be carefully
followed to guarantee the proper operation of the subnetworks.

The number of addresses in each subnetwork should be a power of 2.


The prefix length for each subnetwork should be found using the following
32 − n
formula: first address = (prefix in decimal) × 2 = (prefix in decimal) × N.

nsub = 32- log2Nsub

The starting address in each subnetwork should be divisible by the number of


addresses in that subnetwork. This can be achieved if we first assign addresses to
larger subnetworks.

Network Address Translation (NAT)

● A technology that can provide the mapping between the private and universal
addresses, and at the same time support virtual private networks, is Network
Address Translation (NAT).
● The technology allows a site to use a set of private addresses for internal
communication and a set of global Internet addresses (at least one) for
communication with the rest of the world.

Network Address Translation (NAT)

IPv4 Datagram Fragmentation

Why is IPv4 Datagram Fragmentation required?


Different Networks may have different maximum transmission units (MTU), for example due to
differences in LAN technology. When one network wants to transmit datagrams to a network
with a smaller MTU, the routers on path may fragment and reassemble datagrams.

In IPv4, when a packet is larger than the Maximum Transmission Unit (MTU) of the network link
it needs to traverse, it is fragmented into smaller packets. Each of these fragments contains a
portion of the original packet, along with additional information that identifies the fragment’s
position in the original packet and how it fits into the sequence of fragments.

Fragmentation can cause delays and other issues in the network. Here are a few ways in
which this can happen:
1. Increased processing overhead: Fragmentation requires additional processing and
memory resources from the network devices involved in the transmission. This can
increase the processing overhead and introduce additional delays into the network.
2. Increased likelihood of packet loss: Since each fragment is transmitted separately,
there is an increased likelihood of packet loss or corruption during transmission. If
any of the fragments are lost or corrupted, the entire packet must be retransmitted,
which can introduce additional delays and increase network congestion.
3. Reassembly delays: The receiver of the fragmented packets must reassemble the
original packet before it can be processed. This process can introduce additional
delays, particularly if there are delays in receiving all of the fragments or if the
fragments arrive out of order.

How is Fragmentation done?


When a packet is received at the router, destination address is examined and MTU is
determined. If the size of the packet is bigger than the MTU, and the ‘Do not Fragment (DF)’
bit is set to 0 in the header, then the packet is fragmented into parts and sent one by one. The
maximum size of each fragment is the MTU minus the IP header size (Minimum 20 bytes and
Maximum 60 bytes).

Each fragment is converted to a packet and the following changes happen in the datagram
header:

1. The total length field is changed to the size of the fragment.


2. The More Fragment bit (MF bit) is set for all the fragment packets except the last
one.
3. The fragment offset field is set, based on the number of fragment that is being set
and the MTU.
4. Header Checksum is re-calculated.

Example:
For a data packet of 4000 bytes and MTU of 1500 bytes, we have actual data of 3980 bytes
that is to be transmitted and 1480 bytes is the maximum data size that is permissible to be
sent. So, there would be 3 fragments:
For the first fragment, data size = 1480 bytes, offset = 0 and MF flag = 1
For the second fragment, data size = 1480 bytes, offset = 185(1480/ 8) and MF flag = 1
For the third fragment, data size = 1020 bytes, offset = 370 (2960/8) and MF flag = 0

An important point to be noted here is that all fragments would have the same identification
number, thus indicating that all the fragments belong to the same parent data packet.

IPv4 issues:

The major issues in IPv4 are


❖ Deficiency of address space - The devices connected to the Internet grow exponentially.
The size of address space 2^32 is quickly exhausted;
❖ Too large routing tables

Some more issues are:


● Weak expansibility of the protocol - the insufficient size of heading IPv4 doesn't allow
to place
demanded quantity of additional parameters in it;
● Problem of safety of communications - it is not stipulated any means for differentiation
of access
to the information placed in a network;
● Absence of support of quality of service (QoS) - accommodation of the information about
throughput, the delays and demanded for normal work of some network appendices is not
supported;
● Absence of the auto-configuration IP addresses mechanism.
IPv6 ADDRESSES

IPv6 Packet Header Format

The IPv6 protocol defines a set of headers, including the basic IPv6 header and the IPv6
extension headers. The following figure shows the fields that appear in the IPv6 header and the
order in which the fields appear.

Figure 11-3 IPv6 Basic Header Format

The following list describes the function of each header field.

● Version – 4-bit version number of Internet Protocol = 6.


● Traffic class – 8-bit traffic class field.
● Flow label – 20-bit field.
● Payload length – 16-bit unsigned integer, which is the rest of the packet that follows
the IPv6 header, in octets.
● Next header – 8-bit selector. Identifies the type of header that immediately follows
the IPv6 header. Uses the same values as the IPv4 protocol field.
● Hop limit – 8-bit unsigned integer. Decremented by one by each node that forwards
the packet. The packet is discarded if the hop limit is decremented to zero.
● Source address – 128 bits. The address of the initial sender of the packet.
● Destination address – 128 bits. The address of the intended recipient of the packet.
The intended recipient is not necessarily the recipient if an optional routing header is
present.

IPv6 Extension Headers


The Concept:
IPv6 is using two distinct types of headers: Main/Regular IPv6 Header and IPv6 Extension
Headers. The main IPv6 header is equivalent to the basic IPv4 one despite some field
differences that are the result of lessons learned from operating IPv4. Figure 1 presents the
IPv4 and IPv6 main headers.
Unlike IPv4 options, IPv6 extension headers can be of arbitrary length. Also, the number of
options that a packet carries is not limited to 40 bytes. This feature, in addition to the manner
in which IPv6 options are processed, permits IPv6 optTo improve performance when handling
subsequent option headers, and the transport protocol that follows, IPv6 options are always an
integer multiple of 8 octets long. The integer multiple of 8 octets retains the alignment of
subsequent headers.

The following IPv6 extension headers are currently defined:

● Routing – Extended routing, such as IPv4 loose source route


● Fragmentation – Fragmentation and reassembly
● Authentication – Integrity and authentication, and security
● Encapsulating Security Payload – Confidentiality
● Hop-by-Hop options – Special options that require hop-by-hop processing
● Destination options – Optional information to be examined by the destination node

Comparison of IPv4 vs IPv6

Ipv4 Ipv6

Address length IPv4 is a 32-bit address. IPv6 is a 128-bit address.

Fieldsions to be used for IPv4 is a numeric address that IPv6 is an alphanumeric address
functions consists of 4 fields which are that consists of 8 fields, which
separated by dot (.). are separated by colon(:).

Classes IPv4 has 5 different classes of IP IPv6 does not contain classes of
address that includes Class A, Class IP addresses.
B, Class C, Class D, and Class E.

Number of IP address IPv4 has a limited number of IP IPv6 has a large number of IP
addresses. addresses.

VLSM It supports VLSM (Virtual Length It does not support VLSM.


Subnet Mask). Here, VLSM means
that Ipv4 converts IP addresses
into a subnet of different sizes.

Address configuration It supports manual and DHCP It supports manual, DHCP,


configuration. auto-configuration, and
renumbering.

Address space It generates 4 billion unique It generates 340 undecillion


addresses unique addresses.

End-to-end connection In IPv4, end-to-end connection In the case of IPv6, end-to-end


integrity integrity is unachievable. connection integrity is achievable.

Security features In IPv4, security depends on the In IPv6, IPSEC is developed for
application. This IP address is not security purposes.
developed in keeping the security
feature in mind.

Address representation In IPv4, the IP address is In IPv6, the representation of the


represented in decimal. IP address in hexadecimal.

Fragmentation Fragmentation is done by the Fragmentation is done by the


senders and the forwarding routers. senders only.

Packet flow identification It does not provide any mechanism It uses a flow label field in the
for packet flow identification. header for the packet flow
identification.

Checksum field The checksum field is available in The checksum field is not
IPv4. available in IPv6.

Transmission scheme IPv4 is broadcasting. On the other hand, IPv6 is


multicasting, which provides
efficient network operations.

Encryption It does not provide encryption and It provides encryption and


and Authentication authentication. authentication.

Number of octets It consists of 4 octets. It consists of 8 fields, and each


field contains 2 octets.
Therefore, the total number of
octets in IPv6

Question Bank:

1. What is the Network Layer? What are the functions performed by


the Network Layer?(6 Marks)
2. Explain the classes in IPv4 addressing. (7 Marks)
3. What is Network Address Translation (NAT)? (5 Marks)
4. What are the issues in IPv4?(6 Marks)
5. Explain IPv6 Packet format?(6 /7 Marks)
6. Compare IPv4 and IPv6.(6/8 Marks)

You might also like