Network Layer

Download Report

Transcript Network Layer

Chapter 20
Network Layer:
Internet Protocol
20.1
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Background
In chapter 19 we studied how to assign
addresses to nodes in a network.
 Addresses assigned to nodes are logical
addresses called IP addresses.
 This chapter is about the IP i.e. the
Internet protocol used at the network
layer.
NOTE:
 Kindly do not confuse IP address with IP
protocol. These are two different things.

20.2
Difference between IP
(protocol) and IP address:
IP address is
the logical
name of the
computer.
20.3
IP protocol is a
set of rules to
govern
communication
on the network
layer.
Data link Vs. Network Layer




20.4
Data link layer provides hop to hop
delivery.
Network layer provides host to host
delivery.
If the transmission is within a network we
use only physical and data link layer.
If the transmission is outside the network
we use network layer+data link+physical
layer.
20-1 INTERNETWORKING
In this section, we discuss internetworking, connecting
networks together to make an internetwork or an
internet.
Topics discussed in this section:
Need for Network Layer
Internet as a Datagram Network
Internet as a Connectionless Network
20.5
Figure 20.1 Links between two hosts
20.6
Figure 20.2 Network layer in an internetwork
20.7
Note
Communication at the network layer in
the Internet is connectionless.
20.9
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.10
Figure 20.4 Position of IPv4 in TCP/IP protocol suite
20.11
Figure 20.5 IPv4 datagram format
20.12
IPv4 Datagram Format






20.13
IPv4 Packet is called datagram.
A datagram is of variable length.
Consists of two parts: Header + Data
Header’s length is 20 to 60 bytes.
Header contains information essential for
routing and delivering Data.
It is customary in TCP/IP to show the
header in 4-byte sections.
Header Fields (1)

VERSION (VER)


4 bit in length
Defines the version of IP (either IPv6 or IPv4)
Header Length (HLEN)



20.14
4 bit in length
Defines the length of the header.
Its value falls between 20 to 60 bytes
Header Fields (2)

Services




20.15
the IETF has changed the interpretation and
name of this 8-bit field.
It was previously called as service type, now
called differentiated services.
I will explain “service type”.
“differentiated services” is your homework.
Service Type(1)




First 3 bits are Precedence bits.
Next 4 bits are called Type of Service
(TOS) bits,
and the last bit is not used.
Precedence:




20.16
Value ranges from 000 to 111.
Defines priority of the datagram
Used in situations of Network Congestion
Router discards datagrams of low precedence
in case of congestion.
Service Type(2)

TOS bits



20.18
4 bit in length
Out of 4 only a single bit can be 1 at a time,
thus we have 5 different types of services.
Bit patterns and their interpretations are
shown below.
Total Length


20.20
This field defines the total length of the
Datagram (header + Data)
Value lies between 20 to 65536 bytes.
Time to Live




20.21
A datagram has a limited lifetime in its
travel through an internet.
It holds a timestamp which is
decremented on each visit of a router.
The datagram is discarded when the value
of this field becomes zero.
The purpose is prevent datagram from
monopolizing the network and causing
congestion.
Protocol



20.22
8-bit length
It defines the higher level protocol that
uses the services of the IPv4 Layer.
It defines the higher level protocol to
which the IPv4 datagram is delivered.
Figure 20.8 Protocol field and encapsulated data
20.23
Table 20.3 protocol values
20.24
Checksum



20.25
An error detection mechanism
Performed only with header fields
Detects error in header part of datagram
only.
Source/ Destination Address

Source Address




Destination Address



20.26
32 bit field
Defines the IPv4 address of the source
Remains unchanged during travel from source
to destination.
32 bit field
Defines the IPv4 address of the destination
Remains unchanged during travel from source
to destination.
Fragmentation

Why Fragmentation is Required?


A datagram can travel through different networks
whose Protocols are defined by the data link and
Physical Layer.
We know that at the data link layer we deal with
Frames.


20.27
For different network Protocols at data link layer we
have different formats and sizes of frames.
Now we also know that the Packet from network layer
called datagram (Header + data) act completely as
data for the data link Frame.
Figure 20.9 Maximum transfer unit (MTU)
20.28
Continued


20.29
Different Data link layer Protocols e.g.
X.25, Frame Relay, Ethernet etc have
different frame formats in which there is a
field that limits the size of the Data in the
frame called Maximum Transfer Unit.
Thus in many cases (datagram traveling
from LAN to WAN) it is required to
fragment the datagram according to the
MTU of the underlying network.
Table 20.5 MTUs for some networks
20.30
Fields Related To Fragmentation

Identification




Flags


20.31
16-bit field
Each datagram is assigned a unique number
When the datagram is fragmented the same
identification number is copied to all the
fragments.
3 bit field
1st bit is reserved
Continued…..

2nd bit is Do not Fragment



3rd bit is More Fragment


20.32
if the value of this field is 1 the machine must not
fragment the datagram. If it cannot pass the
datagram though any available physical network, it
discards the datagram and sends and ICMP error
message to the source host.
If the value is 0, this means that whenever
required the datagram can be fragmented
according to the requirement of the physical
network it is travelling.
If its value is 1, it means this is not the last
fragment more fragments have to come.
If its value is 0, it means this is the last fragment
or the only fragment.
Figure 20.10 Flags used in fragmentation
20.33
Continued…..

Fragmentation Offset



20.34
13 bit Field
Shows the relative position of the fragment in
the whole datagram.
Offset is measured in units of 8 bytes.
Figure 20.11 Fragmentation example
20.35
Figure 20.12 Detailed fragmentation example
20.36
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.37
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.38
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.39
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.40
OPTIONS

20.41
Options field can be used for network
testing and debugging.
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:
Deficiencies of IPv4
Advantages of IPv6
Packet Format
Extension Headers
20.42
Deficiencies of IPv4




20.43
Despite all short-term solution the
problem of address Depletion still persists
in IPv4.
Demand of Real time audio and video
Fast growing Mobile IP, IP telephony, IPcapable mobile telephony services
IPv4 do not have any security measures
i.e. Encryption and Authentication
Advantages of IPv6

Larger Address Space


Better Header Format



20.44
Options separated from base header and
made part of data.
Improves Routing
New Options


128 bits address
To allow additional functionalities
Support For More Security
Continued….

Allowance for extension


Support For Resource Allocation


The field “flow label” provides support for
Resource allocation for special applications
like real time audio and video.
Support for more Security

20.45
IPv6 is designed to handle future extensions
Encryption and authentication provides
Confidentiality and Integrity.
Packet Format

Each Packet is composed of:


Mandatory Base Header (40 bytes)
Payload (65535 bytes)

20.46
Consists of optional extension header + data
Figure 20.15 IPv6 datagram header and payload
20.47
Base Header

1.
There are 8 fields:
Version

2.
Priority

3.
4-bit defines the priority of the packet with
respect to traffic congestion.
Flow Label

20.48
4-bit in length defines the version of IP, here
value is ‘6’.
24-bit designed to provide special handling
for a particular flow of data.
4.
Payload Length

5.
Next Header



6.
8-bit Same as TTL field in IPv4
Source Address/ Destination Address

20.49
8-bit
Either optional extension header or header
of another protocol e.g. TCP, UDP
Just like the protocol field in IPv4.
Hop Limit

7.
2 byte defines the length of the payload.
16 bytes both
Figure 20.16 Format of an IPv6 datagram
20.50
Table 20.6 Next header codes for IPv6
20.51
Table 20.9 Comparison between IPv4 and IPv6 packet headers
20.52
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.53
Figure 20.18 Three transition strategies
20.54
Dual Stack





20.55
All hosts before complete migration from IPv6 to
IPv4 must have a dual stack of protocols.
A station must run IPv4 and IPv6
simultaneously.
To determine which version a destination host is
using, the source host queries the DNS.
If the DNS returns an IPv4 address, the source
then send IPv4 packets.
If the DNS returns an IPv6 address, the source
then send IPv6 packets.
Figure 20.19 Dual stack
20.56
Tunneling



20.57
It is a mechanism used when both sender
and receiver hosts use IPv6 but in
between a region falls that uses IPv4.
To pass through this region the IPv6
packet is first encapsulated in IPv4 Header
and after coming out this header is
removed.
The field ‘protocol’ in IPv4 has value 41
when the data it contains is an IPv6
Packet.
Figure 20.20 Tunneling strategy
20.58
Header Translation

20.59
In this case the header of IPv6 is
completely changed in IPv4 header.
Figure 20.21 Header translation strategy
20.60
Table 20.11 Header translation
20.61