3 IPv4 Part1
3 IPv4 Part1
1
IP Features
IP is a connectionless or datagram
internetwork service, providing no end-to-
end delivery guarantees.
IP datagrams may arrive at the destination
host damaged, duplicated, out of order, or
not at all.
2
IP Features
The layers above IP are responsible for
reliable delivery service when it is required.
The IP protocol includes provision for
addressing, type-of-service specification,
fragmentation and re-assembly, and
security.
The datagram or connectionless nature of
IP is a fundamental and characteristic
feature of the Internet architecture.
3
Connectionless IP
Internetworking
Advantages
Flexibility
Robust
No unnecessary overhead
Unreliable
Not guaranteed delivery
Not guaranteed order of delivery
Packets can take different routes
Reliability is responsibility of next layer up (e.g.
TCP)
4
IP
Operation
5
Router-based Networking
6
Internetworking Protocols
7
IP provides several services:
Addressing. IP headers contain 32-bit addresses which identify the sending and
receiving hosts. These addresses are used by intermediate routers to select a path
through the network for the packet.
Fragmentation. IP packets may be split, or fragmented, into smaller packets. This
permits a large packet to travel across a network which can only handle smaller
packets. IP fragments and reassembles packets transparently.
Packet timeouts. Each IP packet contains a Time To Live (TTL) field, which is
decremented every time a router handles the packet. If TTL reaches zero, the packet
is discarded, preventing packets from running in circles forever and flooding a
network.
Type of Service. IP supports traffic prioritization by allowing packets to be labeled
with an abstract type of service.
Options. IP provides several optional features, allowing a packet's sender to set
requirements on the path it takes through the network (source routing), trace the
route a packet takes (record route), and label packets with security features.
8
Internet Protocol Packet
Header
9
VERS - Version
The version of the IP protocol. The current
version is 4. 5 is experimental and 6 is IPng
(see IP: The Next Generation (IPng)).
The version of
the IP
protocol
10
LEN - Length
The length of the IP header counted in 32-
bit quantities. This does not include the
data field.
The length of
the IP header
11
Type of Service
The type of service is an indication of the
quality of service requested for this IP
datagram.
quality of
service??
12
Type of Service - Precedence
Is a measure of the nature and
priority of this datagram:
000 Routine
001 Priority
010 Immediate
011 Flash
100 Flash override
101 Critical
110 Internetwork control
111 Network control
13
TOS - Type Of Service
Specifies the type of
service value:
1000 Minimize delay
0100 Maximize throughput
0010 Maximize reliability
0001 Minimize monetary
cost
0000 Normal service
A detailed description of the type of
service can be found in the RFC
1349
14
MBZ - Must Be Zero
Reserved for
future use
("must be
zero" unless
participating in
an Internet
protocol
experiment
which makes
use of this bit)
15
Total Length
Total length of the IP datagram in bytes
Maximum size is 64k because there are 16
bits for it
That means a single IP datagram cannot
be bigger than 65536 bytes including the
header
16
Fragmentation Related
Information
The next 32 bits contain information related to
fragmentation
This information can be used to reassemble a
fragmented IP datagram
Fragmentation means that on its way a single IP
datagram was broken into smaller IP datagrams
because the intervening network was unable to
carry the original datagram because it was too big
17
Why Fragment?
When an IP datagram travels from one host to another, it can cross
different physical networks. Physical networks have a maximum frame
size, called the Maximum Transmission Unit (MTU), which limits the length
of a datagram that can be placed in one physical frame. Therefore, a
scheme has been put in place to fragment long IP datagrams into smaller
ones, and to reassemble them at the destination host. IP requires that
each link has an MTU of at least 68 bytes, so if any network provides a
lower value than this, fragmentation and re-assembly must be
implemented in the network interface layer in a way that is transparent to
IP. 68 is the sum of the maximum IP header length of 60 bytes and the
minimum possible length of data in a non-final fragment (8 bytes). IP
implementations are not required to handle unfragmented datagrams
larger than 576 bytes, but most implementations will handle larger values,
typically slightly more than 8192 bytes or higher, and rarely less than
1500.
18
Why Fragment?
Host - A Host - B
19
Fragmentation Procedure
An unfragmented datagram has all-zero
fragmentation information. That is, the
more fragments flag bit is zero and the
fragment offset is zero. When
fragmentation is to be done, the following
steps are performed:
20
Fragmentation Procedure
The DF flag bit is checked to see if
fragmentation is allowed. If the bit is set, the
datagram will be discarded and an error will
be returned to the originator using ICMP.
Based on the MTU value, the data field is
split into two or more parts. All newly
created data portions must have a length
which is a multiple of 8 bytes, with the
exception of the last data portion.
21
Fragmentation Example
22
Fragmentation Procedure - 2
All data portions are placed in IP datagrams. The header of these
datagrams are copies of the original one, with some modifications:
The more fragments flag bit is set in all fragments except the last.
The fragment offset field in each is set to the location this data
portion occupied in the original datagram, relative to the beginning
of the original unfragmented datagram. The offset is measured in 8-
byte units.
If options were included in the original datagram, the high order bit
of the option type byte determines whether or not they will be
copied to all fragment datagrams or just to the first one. For
instance, source route options have to be copied in all fragments and
therefore they have this bit set.
The header length field is of the new datagram is set.
The total length field of the new datagram is set.
The header checksum field is re-calculated.
23
Fragmentation Procedure - 3
Each of these fragmented datagrams is
now forwarded as a normal IP datagram.
IP handles each fragment independently,
that is, the fragments may traverse
different routers to the intended
destination, and they may be subject to
further fragmentation if they pass through
networks that have smaller MTUs.
24
25
Correction in Previous Slide
There are two major points that should be considered in the
previous slide
1.Size of header during the process of fragmentation
2.Size of fragmented data should be taken as integral multiple
of 8. So that the offset field of the next fragment can be
mentioned.
26
Correction
28
Reassembley Procedure - 2
In order to reassemble the fragments, the
receiving host allocates a buffer in storage as
soon as the first fragment arrives. A timer routine
is then started. When the timer timeouts and not
all of the fragments have been received, the
datagram is discarded. The initial value of this
timer is called the IP datagram time-to-live (TTL)
value. It is implementation dependent, and some
implementations allow it to be configured; for
example AIX Version 3.2 provides an ipfragttl
option with a default value of 60 seconds.
29
Re-assembly Procedure - 3
When subsequent fragments of the
datagram arrive, before the timer expires,
the data is simply copied into the buffer
storage, at the location indicated by the
fragment offset field. As soon as all
fragments have arrived, the complete
original unfragmented datagram is
restored, and processing continues, just as
for unfragmented datagrams.
30
Fragmentation Fields
Identification - A unique number assigned by
the sender to aid in reassembling a fragmented
datagram. Fragments of a datagram will have the
same identification number.
Fragment Offset - Used with fragmented
datagrams, to aid in reassembly of the full
datagram. The value is the number of 64-bit
pieces (header bytes are not counted) that are
contained in earlier fragments. In the first (or
only) fragment, this value is always zero.
31
Flags
Where:
0 Reserved, must be zero
DF Don't Fragment:
0 means
allow fragmentation
1 means do not allow
fragmentation
MF More Fragments: 0 means that this is the
last fragment of this datagram, 1 means that
this is not the last fragment.
32
Dealing with Failure in Re-
assembly
Re-assembly may fail if some fragments
get lost
Need to detect failure
Re-assembly time out
Assigned to first fragment to arrive
If timeout expires before all fragments arrive,
discard partial data
Use packet lifetime (time to live in IP)
If time to live runs out, kill partial data
33
TTL - Time To Live
Specifies the time (in seconds) this
datagram is allowed to travel. Each
router where this datagram passes is
supposed to subtract from this field
its processing time for this datagram.
Actually a router is able to process a
datagram in less than 1 second; thus
it will subtract one from this field, and the
TTL becomes a hop-count metric rather than a time
metric. When the value reaches zero, it is assumed that
this datagram has been traveling in a closed loop and it is
discarded. The initial value should be set by the higher-
level protocol which creates the datagram.
34
Protocol- Protocol Number
Indicates the higher-level protocol to which IP should deliver the data in
this datagram. Some important values are:
0 Reserved
1 Internet Control Message Protocol (ICMP)
2 Internet Group Management Protocol (IGMP)
3 Gateway-to-Gateway Protocol (GGP)
4 IP (IP encapsulation)
5 Stream
6 Transmission Control (TCP)
8 Exterior Gateway Protocol (EGP)
9 Private Interior Routing Protocol
17 User Datagram (UDP)
89 Open Shortest Path First
The full list can be found in STD 2 - Assigned Internet Numbers.
35
Header Checksum
Is a checksum on the header only. It does
not include the data. The checksum is
calculated as the 16-bit one's complement
of the one's complement sum of all 16-bit
words in the header. For the purpose of
this calculation, the checksum field is
assumed to be zero. If the header
checksum does not match the contents,
the datagram is discarded because at least
one bit in the header is corrupt, and the
datagram may even have arrived at the
wrong destination.
36
Options
Various options
regarding this
datagram, including
how to route it, how to
identify it (security
labeling), how to trace
the places through
which it passes, how to
time-stamp it for delay •Security
•Source routing
measurement, etc. •Route recording
•Timestamping
37
Options
Options – Up to 40 bytes of option data added by source
host or intermediate routers
1 byte Option id, followed by an optional 1 byte Option
length, followed by Option data
Padded to a multiple of 4 bytes
5 options currently defined
Security – Security identifier
source routing – Complete route specified
Record route – Each router appends its address to
the list
Timestamp – Each router appends address &
timestamp
stream id (used for voice) for stream line
transmission
38
39