Networking Unit 4
Networking 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.
➔ 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.
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.
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.
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.
● 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.
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.
Each fragment is converted to a packet and the following changes happen in the datagram
header:
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 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.
Ipv4 Ipv6
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.
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.
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.
Question Bank: