Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
98 views

CH 20

Uploaded by

AD
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
98 views

CH 20

Uploaded by

AD
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 62

Chapter 20

Network Layer:
Internet Protocol

20.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
20-1 INTERNETWORKING

The physical and data link layers of a network


operate locally. These two layers are
jointly responsible for data delivery on the
network from one node to the next, To solve
the problem of delivery through several links,
the network layer (or the internetwork
: layer, as it is sometimes called) was designed.

20.2
Figure 20.1 Links between two hosts

20.3
Figure 20.2 Network layer in an internetwork

20.4
Figure 20.3 Network layer at the source, router, and destination

20.5
Figure 20.3 Network layer at the source, router, and destination (continued)

20.6
Switched Networks
Note

Switching at the network layer in the


Internet uses the datagram approach to
packet switching.

20.8
Datagram Networks
 In a packet-switched network, there is no resource reservation;
resources are allocated on demand
 In a datagram network, each packet is treated independently of
all others. Sometimes referred to as connectionless networks

8-9
Note

Communication at the network layer in


the Internet is connectionless.

20.10
20-2 IPv4

The Internet Protocol version 4 (IPv4) is the delivery


mechanism used by the TCP/IP protocols.

Topics discussed in this section:


Datagram
Fragmentation
Checksum
Options

20.11
Figure 20.4 Position of IPv4 in TCP/IP protocol suite

20.12
 IPv4 is an unreliable and connectionless
datagram protocol 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).
 IPv4 assumes the unreliability of the underlying
layers and does its best to get a transmission
through to its destination, but with no
guarantees.

20.13
 IPv4 is also a connectionless protocol for a packet-
switching network that uses the datagram approach.
 Each datagram is handled independently, and each
datagram can follow a different route to the destination.
 Packet could arrive out of order. Also, some could be
lost or corrupted during transmission.
 IPv4 relies on a higher-level protocol to take care of all
these problems.

20.14
Figure 20.5 IPv4 datagram format (Packets in the IPv4 layer are called
datagrams)

Ox45 00 00 54 00 03 58 50 20 06 00 00 7C 4E 03 02 B4 OE OF 02
Ox45 00 00 54 00 03 58 50 20 06 00 00 7C 4E 03 02 B4
OE OF 02

 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.
Version (VER): This 4-bit field defines the version of the
IPv4 protocol. (i.e. 4)
Header length (HLEN) :- This 4-bit field defines the total
length of the datagram header in 4-byte words. (i.e. 5)
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).
20.16
Figure 20.6 Service type or differentiated services

 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.
 A datagram used for network management is much more urgent
and important than a datagram containing optional
 information for a group.

20.17
Note

The precedence subfield was part of


version 4, but never used.

20.18
Table 20.2 Default types of service
only one of the bits can have the value of 1 in each datagram.

20.19
Table 20.3 Values for codepoints (Differential Services)
 When the 3 rightmost bits are Os, the 3 leftmost bits are interpreted
the same as the precedence bits in the service type interpretation.

 When the 3 rightmost bits are not all Os, the 6 bits define 64
services based on the priority assignment by the Internet or local
authorities

20.20
The total length field defines the total
length of the datagram including the
header.
 To find the length of the data coming from the upper layer,
subtract the header length from the total length. The header length
can be found by multiplying the value in the HLEN field by 4.
 the total length of the IPv4 datagram is limited to 65,535 (216 - 1)
bytes, of which 20 to 60 bytes are the header and the rest is data
from the upper layer.
 Length of data =total length - header length

Ox45 00 00 54 00 03 58 50 20 06 00 00 7C 4E 03 02 B4 OE OF 02
Figure 20.7 Encapsulation of a small datagram in an Ethernet frame

20.22
Fragmentation
 Divide the datagram to make it possible to pass through
the different networks 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.

20.23
Table 20.5 MTUs for some networks

20.24
Fields Related to Fragmentation
 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. The identification
number helps the destination in reassembling
the datagram.

20.25
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 fragment

20.26
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. The value of
the offset is measured in units of 8 bytes. This is done
because the length of the offset field is only 13 bits and
cannot represent a sequence of bytes greater than 8191.
This forces hosts or routers that fragment datagrams to
choose a fragment size so that the first byte number is
divisible by 8.

20.27
Time to live
 A datagram has a limited lifetime in its travel through an
internet
 This field is used mostly to control the maximum number
of hops (routers) visited by the datagram.
 When a source host sends the datagram, it stores a
number in this field.
 This value is approximately 2 times the maximum
number of routes between any two hosts. Each router
that processes the datagram decrements this number by
1.
 If this value, after being decremented, is zero, the router
discards the datagram.

20.28
Figure 20.8 Protocol field and encapsulated data

 This 8-bit field defines the higher-level protocol that uses


the services of the IPv4 layer. This field specifies the
final destination protocol to which the IPv4 datagram is
delivered.

20.29
Table 20.4 Protocol values

20.30
Example 20.1

An IPv4 packet has arrived with the first 8 bits as shown:


01000010
The receiver discards the packet. Why?

Solution
There is an error in this packet. The 4 leftmost bits (0100)
show the version, which is correct. The next 4 bits (0010)
show an invalid header length (2 × 4 = 8). The minimum
number of bytes in the header must be 20. The packet has
been corrupted in transmission.

20.31
Example 20.2

In an IPv4 packet, the value of HLEN is 1000 in binary.


How many bytes of options are being carried by this
packet?

Solution
The HLEN value is 8, which means the total number of
bytes in the header is 8 × 4, or 32 bytes. The first 20 bytes
are the base header, the next 12 bytes are the options.

20.32
Example 20.3

In an IPv4 packet, the value of HLEN is 5, and the value


of the total length field is 0x0028. How many bytes of
data are being carried by this packet?

Solution
The HLEN value is 5, which means the total number of
bytes in the header is 5 × 4, or 20 bytes (no options). The
total length is 40 bytes, which means the packet is
carrying 20 bytes of data (40 − 20).

20.33
Example 20.4

An IPv4 packet has arrived with the first few hexadecimal


digits as shown.
0x45000028000100000102 . . .
How many hops can this packet travel before being
dropped? The data belong to what upper-layer protocol?

Solution
To find the time-to-live field, we skip 8 bytes. The time-to-
live field is the ninth byte, which is 01. This means the
packet can travel only one hop. The protocol field is the
next byte (02), which means that the upper-layer protocol
is IGMP.
20.34
Figure 20.10 Flags used in fragmentation

20.35
Figure 20.11 Fragmentation example

20.36
Figure 20.12 Detailed fragmentation example

20.37
Example 20.5

A packet has arrived with an M bit value of 0. Is this the


first fragment, the last fragment, or a middle fragment?
Do we know if the packet was fragmented?

Solution
If the M bit is 0, it means that there are no more
fragments; the fragment is the last one. However, we
cannot say if the original packet was fragmented or not. A
non-fragmented packet is considered the last fragment.

20.38
Example 20.6

A packet has arrived with an M bit value of 1. Is this the


first fragment, the last fragment, or a middle fragment?
Do we know if the packet was fragmented?

Solution
If the M bit is 1, it means that there is at least one more
fragment. This fragment can be the first one or a middle
one, but not the last one. We don’t know if it is the first
one or a middle one; we need more information (the
value of the fragmentation offset).

20.39
Example 20.7

A packet has arrived with an M bit value of 1 and a


fragmentation offset value of 0. Is this the first fragment,
the last fragment, or a middle fragment?

Solution
Because the M bit is 1, it is either the first fragment or a
middle one. Because the offset value is 0, it is the first
fragment.

20.40
Example 20.8

A packet has arrived in which the offset value is 100.


What is the number of the first byte? Do we know the
number of the last byte?

Solution
To find the number of the first byte, we multiply the offset
value by 8. This means that the first byte number is 800.
We cannot determine the number of the last byte unless
we know the length.

20.41
Example 20.9

A packet has arrived in which the offset value is 100, the


value of HLEN is 5, and the value of the total length field
is 100. What are the numbers of the first byte and the last
byte?
Solution
The first byte number is 100 × 8 = 800. The total length is
100 bytes, and the header length is 20 bytes (5 × 4), which
means that there are 80 bytes in this datagram. If the first
byte number is 800, the last byte number must be 879.

20.42
Example 20.10

Figure 20.13 shows an example of a checksum


calculation for an IPv4 header without options. The
header is divided into 16-bit sections. All the sections are
added and the sum is complemented. The result is
inserted in the checksum field.

20.43
Figure 20.13 Example of checksum calculation in IPv4

20.44
Options
 Options, as the name implies, are not
required for a datagram. They can be
used for network testing and debugging.
Although options are not a required part
of the IPv4 header, option processing is
required of the IPv4 software.

20.45
A no-operation option is a I-byte option used as a filler between
options.
An end-of-option option is a I-byte option used for padding at the end of
the option field. It, however, can only be used as the last option
A record route option is used to record the Internet routers that handle
the datagram.
A strict source route option is used by the source to predetermine a
route for the datagram as it travels through the Internet (Service)
record the time of datagram processing by a router

20.46
20-3 IPv6

The network layer protocol in the TCP/IP protocol


suite is currently IPv4. Although IPv4 is well designed,
data communication has evolved since the inception of
IPv4 in the 1970s. IPv4 has some deficiencies that
make it unsuitable for the fast-growing Internet.

Topics discussed in this section:


Advantages
Packet Format
Extension Headers

20.47
Header comparison
0 15 16 31
vers hlen TOS total length Removed (6)
identification flags flag-offset • ID, flags, flag offset
20 TTL protocol header checksum • TOS, hlen
bytes
source address • header checksum
destination address

options and padding


Changed (3)
• total length => payload
IPv4 • protocol => next header
• TTL => hop limit
vers traffic class flow-label
Added (2)
payload length next header hop limit
• traffic class
40
bytes
source address • flow label

destination address
Expanded
• address 32 to 128 bits
IPv6
Figure 20.15 IPv6 datagram header and payload

20.49
Figure 20.16 Format of an IPv6 datagram

20.50
Table 20.6 Next header codes for IPv6

20.51
Table 20.7 Priorities for congestion-controlled traffic

20.52
Table 20.8 Priorities for noncongestion-controlled traffic

20.53
Table 20.9 Comparison between IPv4 and IPv6 packet headers

20.54
Figure 20.17 Extension header types

20.55
Table 20.10 Comparison between IPv4 options and IPv6 extension headers

20.56
20-4 TRANSITION FROM IPv4 TO IPv6

Because of the huge number of systems on the


Internet, the transition from IPv4 to IPv6 cannot
happen suddenly. It takes a considerable amount of
time before every system in the Internet can move from
IPv4 to IPv6. The transition must be smooth to prevent
any problems between IPv4 and IPv6 systems.

Topics discussed in this section:


Dual Stack
Tunneling
Header Translation
20.57
Figure 20.18 Three transition strategies

20.58
Figure 20.19 Dual stack
Dual Stack :- A station must run IPv4 and IPv6 simultaneously until all the
Internet uses IPv6

20.59
Figure 20.20 Tunneling strategy
Thnneling is a strategy used when two computers using IPv6 want to
Communicate with each other and the packet must pass through a region
that uses IPv4.

20.60
Figure 20.21 Header translation strategy
The sender wants to use IPv6, but the receiver does not understand IPv6
The IPv6 mapped address is changed to an IPv4 address by extracting the
rightmost 32 bits..

20.61
Table 20.11 Header translation

20.62

You might also like