0% found this document useful (0 votes)
9 views73 pages

Introduction to Network Layer Services

Uploaded by

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

Introduction to Network Layer Services

Uploaded by

antoniyajeswin
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Chapter 18

Introduction
to
Network
Layer
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The communication at the network layer is host-to-host.
Note: Source, routers and destination are referred to as
hosts
Figure 18.1: Communication between Alice and Bob at the network layer

18.3
NETWORK LAYER SERVICES

• Packetizing
• Routing
• Forwarding
• Error control – no
• Flow control – no
• Congestion control – no
• Quality of Service - no
• Security
Packetizing
 The first duty of the network layer is definitely
packetizing:
• Encapsulating the payload (data received
from the upper layer) in a network-layer
packet at the source and de-capsulating
the payload from the network-layer
packet at the destination
• The source host receives the payload from
an upper-layer protocol, adds a header that
contains the source and destination
addresses and delivers the packet to the
data-link layer. The source is not allowed to
change the content of the payload unless it
is too large for delivery and needs to be
fragmented.
• The destination host receives the network-layer
packet from its data-link layer, decapsulates the
packet, and delivers the payload to the corresponding
upper-layer protocol. If the packet is fragmented at
the source or at routers along the path, the network
layer is responsible for waiting until all fragments
arrive, reassembling them, and delivering them to the
upper-layer protocol.
• The routers in the path are not allowed to decapsulate
the packets they received unless the packets need to
be fragmented. The routers are not allowed to change
source and destination addresses either.
• Note : if a packet is fragmented, the header
needs to be copied to all fragments and some
changes are needed.
SOURCE DESTINATION
7
Routing and Forwarding

Routing
• There is more than one route from the source to
the destination.
• The network layer is responsible for
finding the best one among these possible
routes.
• The network layer needs to have some specific
strategies for defining the best route.
• So, routing is applying some strategies and
running some routing protocols to create the
decision-making tables for each router

18.8
Routing and Forwarding
Forwarding
• Forwarding can be defined as the action applied by
each router when a packet arrives at one of its
interfaces.
• The decision-making table a router normally uses for
applying this action is sometimes called the
forwarding table and sometimes the routing table.
• When a router receives a packet from one of
its attached networks, it needs to forward the
packet to another attached network (in unicast
routing) or to some attached networks (in multicast
routing). To make this decision, the router uses a
piece of information in the packet header, which can
be the destination address or a label, to find the
corresponding output interface number in the
forwarding table.
Forwarding process

18.10
Error control
 There is no error control at the network layer
• Although error control also can be
implemented in the network layer, it is
ignored
 One reason for this decision is the fact
that the packet in the network layer may
be fragmented at each router, which
makes error checking at this layer
inefficient.
• A checksum field is added to the datagram to
control any corruption in the header, but not
in the whole datagram.
Flow control
• There is no flow control at the network layer. It
is there only in the transport layer.
• To control the flow of data, the transport
layer at the receiver needs to send some
feedback to the transport layer of the sender
to inform the latter that it is overwhelmed
with data
Congestion control
• Although congestion control is indirectly
implemented in network layer, still there is a
lack of congestion control in the network
layer
Quality of Service (QoS)
• As the Internet has allowed new applications
such as multimedia communication (in
particular real-time communication of audio
and video), the quality of service (QoS) of the
communication has become more and more
important.
• However, to keep the network layer untouched,
the QoS provisions are mostly
implemented in the upper layer.
Security
• To provide security for a connectionless network
layer, we need to have another virtual level that
changes the connectionless service to a connection-
oriented service. This virtual layer is called IPSec
(Internet Protocol Security)
Key features of IPSec:
• Confidentiality: IPSec can encrypt IP packets to
protect their contents from unauthorized access.
• Integrity: IPSec can verify the integrity of IP
packets to ensure they haven't been modified or
corrupted during transmission.
• Authentication: IPSec can authenticate the
sender and receiver of IP packets to verify their
identities.
PACKET SWITCHING

• Datagram Approach

• Virtual-Circuit Approach
PACKET SWITCHING

• Switching at the network layer is a process that


involves forwarding data packets from one network
to another based on their destination address.
• A router, in fact, is a (3-level) switch that creates a
connection between an input port and an output port,
just as an electrical switch connects the input to the
output to let electricity flow..

18.17
1. Efficient Data Delivery:
Why do we need switching?

Routers determine the optimal


path for data packets to reach
their destination. This ensures
efficient and timely delivery.
2. Internetworking:
Network layer switching
enables the interconnection of
different networks, such as
local area networks (LANs),
wide area networks (WANs),
and the internet. This allows
for global communication.
3. Scalability:
Why do we need switching?

As networks grow in size and


complexity, switching at the
network layer becomes crucial
to handle increased traffic
and accommodate new
devices.
4. Reliability and Fault
Tolerance:
Network layer switching can be
implemented with redundant
paths, providing backup
routes in case of failures.
This ensures reliability and
minimizes service disruptions
PACKET SWITCHING

• Although in data communication, switching


techniques are divided into two broad categories,
circuit switching and packet switching, only packet
switching is used at the network layer because the
unit of data at this layer is a packet.

• Packet switching at the network layer uses datagram


approach or virtual circuit approach

18.20
Datagram Approach : Connectionless Service

When the Internet was started, the network layer was designed
to provide a connectionless service in which the network-layer
protocol treats each packet independently, with each packet
having no relationship to any other packet. The idea was that
the network layer is only responsible for delivery of packets
from the source to the destination.

18.21
Datagram Approach : Connectionless Service

In this approach, the packets in a message may or may


not travel the same path to their destination. Each packet
travelling in the Internet is treated as an independent
entity; there is no relationship between packets belonging
to the same message. The switches in this type of
network are called routers. A packet belonging to a
message may be followed by a packet belonging to the
same message or to a different message. A packet may
be followed by a packet coming from the same or from a
different source.

18.22
Datagram Approach : Connectionless Service

• Each packet is routed based on the information


contained in its header: source and destination
addresses. The destination address defines
where it should go; the source address defines
where it comes from. The router routes the
packet based only on the destination address.
The source address may be used to send an
error message to the source if the packet is
discarded. Figure shows the forwarding process
in a router in this case. We have used symbolic
addresses such as A and B.
A connectionless datagram network

18.24
Forwarding process in a router when used in a connectionless network

18.25
Virtual-Circuit Approach :
Connection-Oriented Service
• In a connection-oriented service (also called virtual-circuit
approach), there is a relationship between all packets belonging
to a message.
• Before the packets in a message can be sent, a virtual connection
should be set up to define the path for the packets. After
connection setup, the datagrams can all follow the same path.
• Here, the packet must contain
 The source address
 The destination addresses
 A flow label (a virtual circuit identifier) that defines the virtual
path the packet should follow.
• The forwarding decision is based on the value of the label

18.27
• Although it looks as though the use of the label may make
the source and destination addresses unnecessary during the
data transfer phase, parts of the Internet at the network layer
still keep these addresses.
 One reason is that part of the packet path may still be
using the connectionless service.
 Another reason is that the protocol at the network layer
is designed with these addresses, and it may take a while
before they can be changed.

18.28
A virtual-circuit packet-switched network

18.29
Figure: Forwarding process in a router when used in a virtual
circuit network

18.30
Virtual-Circuit Approach :
Connection-Oriented Service

• To create a connection-oriented service, a three-


phase process is used: setup, data transfer, and
teardown
 In the setup phase, the source and
destination addresses of the sender and
receiver are used to make table entries
 In the teardown phase, the source and
destination inform the router to delete the
corresponding entries.
 Data transfer occurs between these two
phases.

18.31
Virtual-Circuit Approach :
Connection-Oriented Service

Setup Phase
• In the setup phase, a router creates an entry for
a virtual circuit.
• For example, source A needs to create a virtual
circuit to destination B. Two auxiliary packets
need to be exchanged between the sender and
the receiver: the request packet and the
acknowledgment packet.
• A request packet is sent from the source
to the destination. This auxiliary packet
carries the source and destination addresses.

18.32
Figure: Sending request packet in a virtual-circuit network

18.33
Virtual-Circuit Approach :
Connection-Oriented Service
Setup Phase – Request Packet
1. Source A sends a request packet to router R1.
2. Router R1 receives the request packet. It knows
that a packet going from A to B goes out
through port 3. The router creates an entry in
its table for this virtual circuit, but it is only able
to fill three of the four columns – incoming port,
incoming label and outgoing port. The router
assigns the incoming port (1) and chooses an
available incoming label (14) and the outgoing
port (3). It does not yet know the outgoing
label, which will be found during the
acknowledgment step. The router then
forwards the packet through port 3 to router
18.34
Virtual-Circuit Approach : Connection-Oriented
Service
Setup Phase – Request Packet
3. Router R3 receives the setup request packet. The
same events happen here as at router R1; three
columns of the table are completed: in this case,
incoming port (1), incoming label (66), and
outgoing port (3).
4. Router R4 receives the setup request packet. Again,
three columns are completed: incoming port (1),
incoming label (22), and outgoing port (4).
5. Destination B receives the setup packet, and if it is
ready to receive packets from A, it assigns a label to
the incoming packets that come from A, in this case
77
Virtual-Circuit Approach : Connection-Oriented
Service

Setup Phase – Acknowledgement Packet


• A special packet, called the acknowledgment
packet, completes the entries in the switching
tables.
Figure : Sending acknowledgments in a virtual-circuit network

18.37
Virtual-Circuit Approach : Connection-Oriented
Service
Setup Phase – Acknowledgement Packet
1. The destination sends an acknowledgment to
router R4. The acknowledgment carries the
global source and destination addresses so the
router knows which entry in the table is to be
completed. The packet also carries label 77,
chosen by the destination as the incoming label
for packets from A. Router R4 uses this label to
complete the outgoing label column for this
entry. Note that 77 is the incoming label for
destination B, but the outgoing label for router
R4.
2. Router R4 sends an acknowledgment to router
R3 that contains its incoming label in the table,
Virtual-Circuit Approach : Connection-Oriented
Service

Setup Phase – Acknowledgement Packet


3. Router R3 sends an acknowledgment to router
R1 that contains its incoming label in the table,
chosen in the setup phase. Router R1 uses this
as the outgoing label in the table.
4. Finally router R1 sends an acknowledgment to
source A that contains its incoming label in the
table, chosen in the setup phase.
5. The source uses this as the outgoing label for
the data packets to be sent to destination B.
Figure : Flow of one packet in an established virtual circuit

18.40
Virtual-Circuit Approach : Connection-Oriented
Service

Teardown Phase
• In the teardown phase, source A, after sending
all packets to B, sends a special packet called a
teardown packet. Destination B responds
with a confirmation packet. All routers delete
the corresponding entries from their tables
Internet Protocol (IP)
⚫ IP stands for Internet Protocol and describes a set of
standards and requirements for creating and
transmitting data packets, or datagrams, across
networks.
⚫ The Internet Protocol (IP) is part of the Internet layer
of the Internet protocol suite. In the OSI model, IP
would be considered part of the network layer.
⚫ IP is traditionally used in conjunction with a higher-
level protocol, most notably TCP. The IP standard is
governed by RFC 791.
43
IPV4 PACKET FORMAT
• Version (VER): 4 bits,
indicating the IP version
(always 4 for IPv4).
• Header Length (HLEN): 4
bits, specifying the length of
the header in 32-bit words
(minimum 5 words, maximum
15 words).
• Type of Service: 8 bits, used
to indicate the desired service
(e.g., priority). This field is
optional.
• Total Length: 16 bits,
specifying the total length of
the entire packet, including
header and data.
• Identification: 16 bits, used
for fragmenting and
Header

reassembling packets.
 All fragments of the same
packet will carry the same
identification value in-
order to identify the packet
• Flags: 3 bits, used for fragmentation
control:
• Reserved: 1 bit, always 0.
• DF (Don't Fragment): 1 bit,
indicates if the packet should not be
fragmented.
• MF (More Fragments): 1 bit,
indicates if this is a fragment of a
larger packet.
• Fragment Offset: 13 bits, specifies the
offset of this fragment in the original
packet.
• Time to Live (TTL): 8 bits, specifies
the maximum number of hops the
packet can travel before being
discarded.
• Protocol: 8 bits, indicates the upper-
layer protocol (e.g., TCP, UDP, ICMP).
• Header Checksum: 16 bits, used for
error detection in the header.
Header
• Source Address: 32 bits, the IP
address of the sending host.
• Destination Address: 32 bits, the IP
address of the receiving host.
IPV4 address
• An IP address (internet protocol address) is a
numerical representation that uniquely identifies a
specific interface on the network.
• Why is IPv6 preferred over IPv4?

• Addresses in IPv4 are 32-bits long. This allows for a


maximum of 4,294,967,296 (232) unique addresses.
• Addresses in IPv6 are 128-bits, which allows for 3.4 x
1038 (2128) unique addresses.
• Since the address space of IPv6 is much larger than the
addresss space of IPv4, IPv6 is preferred
47
48

⚫ There are three common notations


to show an IPv4 address:
 binary notation (base 2)
 dotted-decimal notation (base
256)
IPV4 Address Notation

 hexadecimal notation (base 16)


⚫ In binary notation, an IPv4 address
is displayed as 32 bits. To make the
address more readable, one or more
spaces are usually inserted between
each octet or byte (8 bits).
⚫ To make the IPv4 address more
compact and easier to read, it is
usually written in decimal form with
a decimal point (dot) separating the
bytes. This format is referred to as
dotted-decimal notation. Note that
because each byte (octet) is only 8
bits, each number in the dotted-
decimal notation is between 0 and
255.
⚫ IPv4 address in hexadecimal
notation - Each hexadecimal digit is
equivalent to four bits. This means
that a 32-bit address has 8
hexadecimal digits.
IPV4 Address Notation
• 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 (network part); the
second part of the address, called
Hierarchy in Addressing

the suffix, defines the node (host


part).
• The prefix length is n bits and the
suffix length is (32 − n) bits.
• A prefix can be fixed length
or variable length.
• Classful addressing - The
prefix has a fixed-length.
Classful and Classless addressing

This scheme is obsolete


now.
• Classless addressing – new
scheme which uses a
variable-length network
prefix.
Classful Addressing
⚫ IPv4 addresses were divided into 5 categories.
◦ Class A
◦ Class B
◦ Class C
◦ Class D
◦ Class E
⚫ This allocation has come to be called classful
addressing

52
Classful Addressing

⚫ IPv4 address of 4 bytes defines 3 fields.


⮚ Class Type
⮚ Network ID(Netid)
⮚ HostID

53
Class A
⚫ Class A addresses were designed for large organizations with
a large number of attached hosts or routers.
⚫ In a Class A network, the first eight bits, or the first dotted
decimal, is the network part of the address, with the
remaining part of the address being the host part of the
address. There are 128 possible Class A networks.
[Link] to [Link]
⚫ However, any address that begins with 127. is considered a
loopback address.

54
Class B
⚫ Class B addresses were designed for midsize organizations with tens of
thousands of attached hosts or routers.
⚫ In a Class B network, 2 bytes for class type and netid and 2 bytes for
hostid.
⚫ All Class B networks have their first bit set to 1 and the second bit set
to 0.
⚫ In dotted decimal notation, that makes [Link] to [Link] as
Class B networks.
⚫ There are 16,384 possible Class B networks.
⚫ Example for a Class B IP address:
[Link]

55
Class C
⚫ Class C addresses were designed for small organizations with a
small number of attached hosts or routers.
⚫ It uses 3 bytes for class type and netid and 1 byte for hostid.
⚫ In a Class C network, the first two bits are set to 1, and the third bit
is set to 0.
⚫ That makes the first 24 bits of the address the network address and
the remainder as the host address.
⚫ Class C network addresses range from [Link] to [Link].
There are over 2 million possible Class C networks.
[Link]

56
Classful Addressing

58
• In class A, the network
length is 8 bits, but since
the first bit, which is 0,
defines the class, we can
have only seven bits as the
network identifier. This
means there are only 27 =
128 networks in the world
that can have a class A
address.
• In class B, the network
length is 16 bits, but since
the first two bits, which are
(10)2, define the class, we
can have only 14 bits as
the network identifier. This
means there are only 214 =
16,384 networks in the
world that can have a class
B address.
• All addresses that start
with (110)2 belong to
class C. In class C, the
network length is 24
• Class D is not divided into
prefix and suffix. It is used
for multicast addresses.
All addresses that start
with 1111 in binary belong
to class E.
• As in Class D, Class E is
not divided into prefix and
suffix and is used as
reserve.
Class Range Subnet Mask

A [Link] - [Link] [Link]

B [Link] - [Link] [Link]

C [Link] - [Link] [Link]

D [Link] - [Link] Reserved for multicast

E [Link] - [Link] Reserved for experimental use


62
Find the network address given the
following:

IP address of a node in a network:


[Link]

Solution:

Since it is a class A address use the subnet mask


[Link]

Logical AND of IP address and mask will give the


network address
IP address [Link]
Mask [Link]
[Link]
63
Change the following IPv4 addresses from binary notation to dotted-
decimal notation.

Solution
We replace each group of 8 bits with its equivalent decimal number and
add dots for separation.

64
65
66
67
68
Disadvantages of Classful
Addressing
• If we consider class A, the number of addresses in
each block is more than enough for almost any
organization. So, it results in wastage of addresses.
This class can be assigned to only 128 organizations in
the world, but each organization needs to have a single
network with 16,777,216 nodes (computers in this
single network). Since there may be only a few
organizations that are this large, most of the addresses
in this class were wasted (unused).
• Same is the case with class B, probably an
organization receiving block from class B would not
require that much of addresses. So, it also results in
wastage of addresses.
• A block in class C may be too small to fulfil the
addresses requirement of an organization
• Class E addresses were almost never used, wasting
the whole class.
69
Subnetting and Supernetting
• To overcome the flaws of classful addressing,
these two solutions were introduced to
compensate for the wastage of addresses.

• Let us discuss them one by one.

70
Subnetting
⚫ As class A/class B block is too large for any
organization, a class A/class B block can be divided
into several smaller networks called subnets

Supernetting
⚫Several class C blocks can be combined into a
larger block

4/5/2022 Karpagam Institute of 64


Subnetting
⚫A subnet, or subnetwork, is a segmented piece
of a larger network.
⚫More specifically, subnets are a logical partition
of an IP network into multiple, smaller network
segments.
⚫Organizations will use a subnet to subdivide
large networks into smaller, more efficient
subnetworks.

72
73

You might also like