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

Unit-3 - IP Protocol (1)

IPv4 is an unreliable, connectionless datagram protocol that provides best-effort delivery without error control, requiring pairing with TCP for reliability. The IPv4 datagram consists of a header and data, with the header containing essential fields for routing and delivery, such as version, header length, and total length. IPv4 has limitations, such as address depletion and lack of support for real-time transmission and security, leading to the development of IPv6, which offers a larger address space and improved functionalities.

Uploaded by

Shivaani Nainwal
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)
13 views32 pages

Unit-3 - IP Protocol (1)

IPv4 is an unreliable, connectionless datagram protocol that provides best-effort delivery without error control, requiring pairing with TCP for reliability. The IPv4 datagram consists of a header and data, with the header containing essential fields for routing and delivery, such as version, header length, and total length. IPv4 has limitations, such as address depletion and lack of support for real-time transmission and security, leading to the development of IPv6, which offers a larger address space and improved functionalities.

Uploaded by

Shivaani Nainwal
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
You are on page 1/ 32

IPv4 Protocol

UNIT-3
 IPv4 is an unreliable and connectionless datagram protocol which provides a best-effort delivery
service.
 The term best-effort means that IPv4 provides no error control or flow control (except for error detection
on the header).
 If reliability is important, IPv4 must be paired with a reliable protocol such as TCP.
 IPv4 is also a connectionless protocol that uses the datagram approach. This means that each datagram is
handled independently, and each datagram can follow a different route to the destination.
IPV4 Datagram format

Packets in the IPv4 protocol are


called as datagrams.
A datagram is a variable-length packet
consisting of two parts: header and data.
 The header is 20 to 60 bytes in length
and contains information essential to
routing and delivery.
 The data is 20 to 65,536 bytes in
length.
IPV4 Datagram Header fields

1. Version(VER):
 This 4 bit field tells the IP software
running in the processing machine that
the datagram has the format of IP
version 4 protocol.
 All other fields must be interpreted as
specified in the fourth version of the
protocol.
 If the machine is using some other
version of IP, the datagram is discarded
rather than interpreted incorrectly.
IPV4 Datagram Header fields

2. Header length (HLEN):


 This 4-bit field defines the total length of
the datagram header in 4-byte words.
 This field is needed because the length
of the header is variable (between 20
and 60 bytes).
 When there are no options, the header
length is 20 bytes, and the value of this
field is 5 (5 x 4 = 20).
 When the option field is at its maximum
size, the value of this field is 15 (15 x 4
= 60).
IPV4 Datagram Header fields

3. Services.
IETF has changed the interpretation and name
of this 8-bit field. This field, previously called
service type, is now called differentiated
services.
Service Type
In this interpretation, the first 3 bits are called precedence bits. The next 4 bits are called
type of service (TOS) bits, and the last bit is not used.
a. Precedence is a 3-bit subfield ranging from 0 (000 in binary) to 7 (111 in binary). The
precedence defines the priority of the datagram in issues such as congestion. If a router
is congested and needs to discard some datagrams, those datagrams with lowest
precedence are discarded first.
b. TOS bits
It is a 4-bit subfield with each bit having a special
meaning.
Although a bit can be either 0 or 1, one and only one
of the bits can have the value of 1 in each datagram.

Application programs can request a specific type of


service. The defaults for some
applications are shown above
Differentiated Services
In this interpretation, the first 6 bits make up the codepoint subfield, and the last 2 bits are not used.
The codepoint subfield can be used in two different ways:
a. When the 3 rightmost bits are 0s, the 3 leftmost bits are interpreted the same as the precedence bits
in the service type interpretation.
b. When the 3 rightmost bits are not all 0s, the 6 bits define 64 services based on the priority
assignment by the Internet or local authorities according to Table 20.3.
The first category contains 32 service types (numbers 0, 2,4, ... ,62) assigned by the Internet authorities
(IETF).
The second category contains 16 service types (3, 7, 11, 15, , 63) can be used by local authorities
(organizations).
The third category also contains 16 service types(1, 5, 9, ,61) which are temporary and can be used for
experimental purposes.
IPV4 Datagram Header fields

4. Total length.
This is a 16-bit field that defines the total length (header
plus data) of the IPv4 datagram in bytes.
Length of data =total length - header length
The header length can be found by multiplying the value
in the HLEN field by 4.
Since the size of “total length” field is 16 bits, the total
length of the IPv4 datagram is limited to 65,535 (2 16 - 1)
bytes, of which 20 to 60 bytes are the header and the rest
is data from the upper layer.
IPV4 Datagram Header fields

8. Time to live.
A datagram has a limited lifetime in its
travel through an internet.
This field holds a timestamp, which was
decremented by each visited router. The
datagram was discarded when the value
became zero.
IPV4 Datagram Header fields

9. Protocol.
This 8-bit field defines the higher-level protocol that
uses the services of the n/w layer.
An IPv4 datagram can encapsulate data from several
higher-level protocols such as TCP, UDP, ICMP, and
IGMP.
In other words, since the IPv4 protocol carries data from
different other protocols, the value of this field helps
the receiving network layer know to which protocol the
data belong.

10. Checksum.
The checksum is used to secure the IPv4 header.
 Source address. This 32-bit field defines the IPv4
address of the source.
 Destination address. This 32-bit field defines the
IPv4 address of the destination.
Source and destination field must remain unchanged
during the time the IPv4 datagram travels from the
source host to the destination host
 Options. The header of the IPv4 datagram is made
of two parts: a fixed part and a variable part. The
fixed part is 20 bytes long. The variable part
comprises the options that can be a maximum of
40 bytes.
Options, as the name implies, are not required for
a datagram. They can be used for network testing
and debugging.
Encapsulation of IP packet
in a frame at data link
layer

 IPv4 datagram can travel through different


networks to reach the destination.
 Each router decapsulates the IPv4 datagram
from the frame it receives, processes it, and
then encapsulates it in another frame.
 The format and size of the received frame
depend on the protocol used by the sender’s
network through which the frame has just
traveled.
 The format and size of the sent frame
depend on the protocol used by the physical
network through which the frame is going to
travel.
For example, if a router connects a LAN to a
 Maximum Transfer Unit (MTU)
when a datagram is encapsulated in a frame at data link layer, the total size of the datagram
must be less than this maximum size limit, which is defined by the restrictions imposed by the
hardware and software used in the network at data link layer.
The value of the MTU depends on the physical network
protocol.
Fragmenation

 To make the IPv4 protocol independent of the physical network , we have to set the
maximum length of the IPv4 datagram equal to 65,535 bytes.
 However, for other physical networks, if datagram size is above this limit, then we must
divide the datagram to make it possible to pass through these networks. This is called
fragmentation
 When a datagram is fragmented, each fragment has its own header with most of
the fields repeated, but with some changed.
 A fragmented datagram may itself be fragmented if it encounters a network with
an even smaller MTU. In other words, a datagram can be fragmented several times
before it reaches the final destination.
 In IPv4, a datagram can be fragmented by the source host or any router in the
path although there is a tendency to limit fragmentation only at the source.
 The reassembly of the datagram, however, is done only by the destination
host because the fragmented datagrams can travel through different routes, and we
can never control or guarantee which route a fragmented datagram may take, all the
fragments belonging to the same datagram should finally arrive at the destination
host. So it is logical to do the reassembly at the final destination.
 When a datagram is fragmented, required parts of the header must be
copied by all fragments. The option field may or may not be copied.
 The host or router that fragments a datagram must change the values of
three fields: flags, fragmentation offset, and total length.
The rest of the fields must be copied
The fields that are related to fragmentation and reassembly of an IPv4 datagram are:
1. identification
2. flags
3. fragmentation offset

Identification:
This 16-bit field identifies a datagram originating from the source host.
The combination of the identification and source IPv4 address must uniquely define a datagram as it leaves
the source host.
When a datagram is fragmented, the value in the identification field is copied to all fragments. In other
words, all fragments have the same identification number, the same as the original datagram.
The identification number helps the destination in reassembling the datagram. It knows that all fragments
having the same identification value must be assembled into one datagram.
Flags : This is a 3-bit field.
 The first bit is reserved.
 The second bit is called the do not fragment bit. If its value is 1, the machine must
not fragment the datagram. If it cannot pass the datagram through any available
physical network, it discards the datagram and sends an ICMP error message to the
source host. If its value is 0, the datagram can be fragmented if necessary.
 The third bit is called the more fragment bit. If its value is 1, it means the datagram
is not the last fragment; there are more fragments after this one. If its value is 0, it
means this is the last or only fragments.
Fragmentation offset.
This 13-bit field shows the relative position of this fragment with respect to the whole datagram. It is the
offset of the data in the original datagram measured in units of 8 bytes.
Figure 20.11 shows a datagram with a data size of 4000 bytes fragmented into three fragments. The
bytes in the original datagram are numbered 0 to 3999.
 The first fragment carries bytes 0 to 1399. The offset for this datagram is 0/8 =0.
 The second fragment carries bytes 1400 to 2799; the offset value for this fragment is 1400/8 =
175.
 Finally, the third fragment carries bytes 2800 to 3999. The offset value for this fragment is 2800/8
=350.
Even if each fragment follows a
different path and arrives out of order,
the final destination host can
reassemble the original datagram from
the fragments received (if none of them
is lost) by using the following strategy:
1. The first fragment has an offset field
value of zero.
2. Divide the length of the first fragment by
8. The second fragment has an offset
value equal to that result.
3. Divide the total length of the first and
second fragments by 8. The third
fragment has an offset value equal to
that result.
4. Continue the process. The last fragment
has a more bit value of 0.
 Notice the value of the identification field is the same in all fragments. Notice the value
of the flags field with the more bit set for all fragments except the last. Also, the value
of the offset field for each fragment is shown.
 The figure also shows what happens if a fragment itself is fragmented. In this case the
value of the offset field is always relative to the original datagram.
 For example, in the figure, the second fragment is itself fragmented later to two
fragments of 800 bytes and 600 bytes, but the offset shows the relative position of the
fragments to the original data.
Que:- Suppose IPv4 packet is reached at destination node
with following information :
0x45 00 00 60 00 02 46 40 18 11 00 00 6D 3C 02 01 C3
0D 1F 01
Field name Hexadeci Decimal value Field Hexadec Decimal
mal name imal value
digits digits
Version(4bits): (0x4) 4 TTL(8 18 24
Header 5 (5*4)= 20 bytes bits)
length(4bits): protocol 11 17(UDP)
Service(8 bits): 00 (000-
precedence ERROR Checksu No error
0000 -normal present m(0000)
0- unused) or not?
Total length(16 bits): 0060 (96 bytes) Source 6D 3C 02 109.60.2.1
ip? 01
Size of Data 96-20=76 bytes
(Total length- HLEN) Destinati C30D1F0 195.13.31.1
on ip? 1
Identification no.(16 0002 2
IPV6

Although IPv4 is well designed, IPv4 has some deficiencies (listed below) that make it
unsuitable for the fast-growing Internet.
1. Despite all short-term solutions, such as subnetting, classless addressing, and NAT,
address depletion is still a long-term problem in the Internet.
2. The Internet must accommodate real-time audio and video transmission. This type of
transmission requires minimum delay strategies and reservation of resources not
provided in the IPv4 design.
3. The Internet must accommodate encryption and authentication of data for some
applications. No encryption or authentication is provided by IPv4.

To overcome these deficiencies, IPv6 (Internetworking Protocol, version 6), was proposed and
is now a standard.
Advantages of IPV6:

The next-generation IP, or IPv6, has some advantages over IPv4 that can be
summarized as follows: -
 Larger address space. An IPv6 address is 128 bits long, Compared with the 32-bit address of IPv4,
this is a huge increase in the address space.
 Better header format. IPv6 uses a new header format in which options are separated from the
base header and inserted, when needed, between the base header and the upper-layer data. This
simplifies and speeds up the routing process because most of the options do not need to be checked
by routers.
 New options. IPv6 has new options to allow for additional functionalities.
 Allowance for extension. IPv6 is designed to allow the extension of the protocol if required by new
technologies or applications.
 Support for resource allocation. In IPv6, the type-of-service field has been removed, but a
mechanism (called Flow label) has been added to enable the source to request special handling of
the packet. This mechanism can be used to support traffic such as real-time audio and video.
 Support for more security. The encryption and authentication options in IPv6 provide
Packet Format

 Each IPV6 packet/datagram is composed of a


mandatory base header followed by the
payload.
 The payload consists of two parts: optional
extension headers and data from an upper
layer.
 The base header occupies 40 bytes, whereas
the extension headers and data from the
upper layer contain up to 65,535 bytes of
information
Base Header

Base header contains eight fields.


These fields are as follows:
1. Version. This 4-bit field defines the version
number of the IP. For IPv6, the value is 6.
2. Priority. The 4-bit priority field defines the
priority of the packet with respect to other
packets from the same source during traffic
congestion. the datagram with the lower
packet priority will be discarded,
3. Flow label. The flow label is a 3-byte (24-
bit) field that is designed to provide special
handling for a particular flow of data.
4. Payload length. The 2-byte payload length
field defines the length of the IP datagram
excluding the base header.
5. Next header. The next header is an 8-bit
field defining the header that follows the base
header in the datagram. The next header is
either one of the optional extension headers
used by IP or the header of an encapsulated
packet such as UDP or TCP.
 Hop limit. This 8-bit hop limit field serves
the same purpose as the TIL field in IPv4.
 Source address. The source address field is
a 16-byte (128-bit) Internet address that
identifies the original source of the
datagram.
 Destination address. The destination
address field is a 16-byte (128-bit) Internet
address that usually identifies the final
destination of the datagram. However, if
source routing is used, this field contains the
address of the next router

You might also like