0% found this document useful (0 votes)
4 views97 pages

TCPIP-Module II - Part 3

Module II of ITT302 focuses on the Network Layer of TCP/IP, detailing the Internet Protocol (IP) and its characteristics, including connectionless delivery and error control messages via ICMP. It explains the structure and function of IPv4 datagrams, including fragmentation, service types, and the importance of the Internet Protocol in data transfer. The module also covers the Maximum Transfer Unit (MTU) and the process of datagram encapsulation and reassembly.

Uploaded by

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

TCPIP-Module II - Part 3

Module II of ITT302 focuses on the Network Layer of TCP/IP, detailing the Internet Protocol (IP) and its characteristics, including connectionless delivery and error control messages via ICMP. It explains the structure and function of IPv4 datagrams, including fragmentation, service types, and the importance of the Internet Protocol in data transfer. The module also covers the Maximum Transfer Unit (MTU) and the process of datagram encapsulation and reassembly.

Uploaded by

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

Module II

ITT302 - INTERNETWORKING WITH TCP/IP

Network Layer

Text Book:
1. Douglas E Comer, “Internetworking with TCP/IP Principles, Protocol, and Architecture” ,
Volume I, 6th Edition, Pearson Education, 2013
2. Andrew S. Tanenbaum, “Computer Networks”, Prentice Hall. 5th Edition.
3. James F Kurose, Keith W Ross, Computer Networking: A top Down Approach featuring

Krishnaprasad P.K
the Internet, Pearson Education, 3rd Edition

[Link]
Contents/Syllabus
 Internet Protocol: Connectionless Datagram Delivery (IPv4,IPv6)
 Introduction, Connectionless Delivery System Characteristics
 Purpose And Importance Of The Internet Protocol
 The IP Datagram
 Datagram Type Of Service And Differentiated Services
 Datagram Encapsulation
 Datagram Size, Network MTU and Fragmentation
 Datagram Reassembly
 Header Fields Used For Datagram Reassembly,
 Time To Live (IPv4) And Hop Limit (IPv6)
 Optional IP Items
 Options Processing During Fragmentation
 Internet Protocol: Error And Control Messages (ICMP)
 Introduction
 The Internet Control Message Protocol
 Error Reporting Vs. Error Correction
 ICMP Message Delivery
 Conceptual Layering
 ICMP Message Format Slide 2- 2
Internet Architecture And Philosophy
 Conceptually, a TCP/IP internet provides three sets of services.
 At the lowest level, a connectionless delivery service provides a
foundation on which everything rests.
 The connectionless service runs over arbitrary network hardware
 At the next level, a reliable transport service provides a higher-level
platform on which applications depend.
 At the highest level, application services provides wide varieties of
services for the hosts/users, depends on the requirement.

Fig 2.1 The conceptual organization of protocol software in layers. Slide 1- 3


Connectionless Delivery System Characteristics
 The most fundamental Internet service consists of a packet delivery s/m.
 Technically, the service is defined as an unreliable, best-effort,
connectionless packet delivery system.
 Term unreliable to mean that delivery is not guaranteed. A packet may be
lost, duplicated, delayed, or delivered out of order.
 The connectionless service will not detect such conditions, nor will it
inform the sender or receiver.
 The basic service is classified as connectionless because each packet is
treated independently from all others.
 A sequence of packets sent from one computer to another may travel over
different paths, or some may be lost while others are delivered.
 Finally, the service is said to use best-effort delivery because the Internet
software makes an earnest attempt to deliver packets.
 That is, the Internet does not discard packets capriciously; unreliability arises
only when resources are exhausted or underlying networks fail.
 To provide reliability IP must be paired with a reliable protocol like TCP
Slide 1- 4
Purpose & Importance of The Internet Protocol

 The protocol that defines the unreliable, connectionless delivery


mechanism is called the Internet Protocol (IP).
 The Internet Protocol provides three important specifications.
1) IP defines the basic unit of data transfer used throughout a TCP/IP
internet. (packet format)
2) IP software performs the forwarding function, choosing a path over
which a packet will be sent
3) IP includes a set of rules that embody the basis of unreliable delivery.
 The rules characterize how hosts and routers should process packets, how
and when error messages should be generated, and the conditions under
which packets can be discarded.
 The Internet Protocol is such a fundamental part of the design that the
Internet is sometimes called an IP-based technology.

Slide 1- 5
Network layer in the Internet
 Switching at the network layer in the Internet uses the datagram approach
to packet switching.
 Communication at the network layer in the Internet is connectionless.

Fig 2-2: Position of IP in TCP/IP protocol suite Slide 2- 6


IPv4 Datagram format

Fig 2-3: IPv4 datagram format Slide 2- 7


IPv4 Datagram format
 A datagram is a variable-length packet consisting of two parts: header
and payload (data).
 Version Number. The 4-bit version number (VER) field defines the
version of the IPv4 protocol, which has the value of 4.
 All IP software is required to check the version field before processing a
datagram to ensure it matches the format the software expects.
 Header Length. The 4-bit header length (HLEN) field defines the total
length of the datagram header in 4-byte words.
 The IPv4 datagram has a variable-length header. (20 to 60 Bytes)
 The total length is divided by 4 and the value is inserted in the field. The
receiver needs to multiply the value of this field by 4 to find the total length.
 Service Type. In the original design of the IP header, this field was
referred to as type of service (TOS), which defined how the datagram
should be handled.
 IETF redefined the field to provide differentiated services (DiffServ).
Slide 2- 8
Fig: 2-4 Service type or differentiated services Table: 2-1 Type of service
 IPv4 Datagram format - 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.
 Precedence is a 3-bit subfield ranging from 0 to 7.
 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.
 For example, a datagram used for network management is much more urgent
and important than a datagram containing optional information for a group.
 TOS bits is a 4-bit subfield with each bit having a special meaning.
(Table 2-1) With only 1 bit set at a time Slide 2- 9
Fig: 2-4 Service type or differentiated services Table: 2-2 Values for codepoints

 IPv4 Datagram format - 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.
1) When the 3 rightmost bits are 0s, the 3 leftmost bits are interpreted the
same as the precedence bits in the service type interpretation.
 In other words, it is compatible with the old interpretation.
2) 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 2-2.

Slide 2- 10
IPv4 Datagram format
 Total Length. This 16-bit field defines the total length (header plus data)
of the IP datagram in bytes.
 A 16-bit number can define a total length of up to 65,535
 Length of data = total length − (HLEN) × 4
 Total length field is helpful to determine how much is really data and how
much is padding.
 Identification, Flags, and Fragmentation Offset. These three fields are
related to the fragmentation of the IP datagram when the size of the
datagram is larger than the underlying network can carry.
 Time-to-live. (TTL) field is used 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.
 Each router that processes the datagram decrements this number by one. If
this value, after being decremented, is zero, the router discards the datagram

Fig: 2-5 Encapsulation of a small


datagram in an Ethernet frame
Slide 2- 11
IPv4 Datagram format
 Protocol. The Internet authority has given any protocol that uses the
service of IP a unique 8-bit number which is inserted in the protocol field.
 When the payload is encapsulated in a datagram at the source IP, the
corresponding protocol number is inserted in this field.
 When the datagram arrives at the destination, the value of this field helps to
define to which protocol the payload should be delivered.
 Some protocol values: ICMP 01, IGMP 02, TCP 06, UDP 17, OSPF 89
 Header checksum: IP puts the burden of error checking of the payload
on the protocol that owns the payload, such as UDP or TCP.
 The datagram header, is added by IP, and its error-checking is the
responsibility of IP.
 The value of some fields, such as TTL, which are related to fragmentation and
options, may change from router to router, the checksum needs to be
recalculated at each router.
 PADDING, depends on the options selected.
 It represents bits containing zero that may be needed to ensure the datagram
header extends to an exact multiple of 32 bits. Slide 2- 12
IPv4 Datagram format
 Source and Destination Addresses. 32-bit source and destination
address fields define the IP address of the source and destination.
 The source host should know its IP address.
 The destination IP address is either known by the protocol that uses the
service of IP or is provided by the DNS.
 Note that the value of these fields must remain unchanged during the time
the IP datagram travels from the source host to the destination host.
 Options. A datagram header can have up to 40 bytes of options.
 Options can be used for network testing and debugging.
 Although options are not a required part of the IP header, option processing is
required of the IP software.
 The existence of options in a header creates some burden on the datagram
handling; some options can be changed by routers, which forces each router
to recalculate the header checksum.
 Payload :is the packet coming from other protocols that use the service of
IP.
Slide 2- 13
Protocol MTU
IPv4 Datagram format - Hyperchannel 65,535
Token Ring (16 Mbps) 17,914
Datagram Size, Network MTU Token Ring (4 Mbps) 4,464
FDDI 4,352
Ethernet 1,500
X.25 576
PPP 296
Table: 2-3 MTU of some network
Fig: 2-6 Maximum Transfer Unit
 Each router decapsulates the IP 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 physical 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 WAN, it receives a frame in the
LAN format and sends a frame in the WAN format.

 Maximum Transfer Unit (MTU)


 Each link-layer protocol has its own frame format.
 One of the features of each format is the maximum size of the payload that
can be encapsulated. Slide 2- 14
IPv4 Datagram format -
Datagram Size, Network MTU,
 Maximum Transfer Unit (MTU)
 When a datagram is encapsulated in a frame, the total size of the
datagram must be less than this maximum size.
 The value of the MTU differs from one physical network protocol to
another. For example, the value for a LAN is normally 1500 bytes.
 To make the IPv4 protocol independent of the physical network, the
designers decided to make the maximum length of the IPv4 datagram
equal to 65,535 bytes
 The process of dividing the datagram to make it possible for it to pass
through networks is called fragmentation. (If size of datagram > MTU)
 A datagram may be fragmented several times before it reaches the final
destination.
 A datagram can be fragmented by the source host or any router in the path.
 The reassembly of the datagram, however, is done only by the destination
host, because each fragment becomes an independent datagram.
Slide 2- 15
 Whereas the fragmented datagram can travel through different routes,
IPv4 Datagram format - Fragmentation
 Fields Related to Fragmentation
 Most parts of the header, with the exception of some options, must be
copied by all fragments.
 Three fields in an IP datagram that are related to fragmentation:
identification, flags, and fragmentation offset
 The host or router that fragments a datagram must change the values of
these three fields.
 The value of the checksum must be recalculated regardless of fragmentation.
 The 16-bit identification field identifies a datagram originating from the
source host. All fragments have the same identification number.
 The combination of the identification and source IP address must uniquely
define a datagram as it leaves the source host.
 The identification number helps the destination in reassembling the
datagram. It knows that all fragments having the same identification value
should be assembled into one datagram.
Slide 2- 16
IPv4 Datagram format –
Fragmentation
Fig: 2-7 Flag Fields

 Fields Related to Fragmentation D=1 NOT Fragment


M=1 NOT LAST
 The 3-bit flags field defines three flags.
 The leftmost bit is reserved (not used). The second bit (D 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 (M 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.

Slide 2- 17
IPv4 Datagram format –
Fragmentation
 The 13-bit fragmentation offset 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 in units of 8 bytes
 Figure 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.

Fig: 2-8 Fragmentation Example Slide 2- 18


Fragmentation

Fig: 2-9 Detailed


Fragmentation Example

Slide 2- 19
IPv4 Options
 IPV4 options can be a maximum of 40 bytes (in multiples of 4-bytes)
 Options, as the name implies, are not required for a datagram. They can
be used for network testing and debugging.
 Options are divided into two broad categories: single-byte options and
multiple-byte options.
 Each option starts with a single octet option code that identifies the
option. An option code may be followed by a single octet length and a set
of data octets for that option.
 Single-Byte Options
 There are two single-byte options.
 No Operation: A no-operation option is a 1-byte option used as a filler
between options.
 End of Option: An end-of-option option is a 1-byte option used for
padding at the end of the option field. It, however, can only be used as the
last option.
Slide 2- 20
IPv4 Options
 Multliple-Byte Options
 There are four multiple-byte options
 Record Route Fig: 2-10 Taxonomy of options in IPv4
 A record route option is used to record the Internet routers that handle the
datagram.
 It can list up to nine router addresses. It can be used for debugging and
management purposes.
 Strict Source Route
 A strict source route option is used by the source to predetermine a route
for the datagram, as it travels through the Internet.
 Dictation of a route by the source can be useful for several purposes.
 The sender can choose a route with a specific type of service, such as
minimum delay or maximum throughput.
 It may choose a route that is safer or more reliable for the sender’s purpose,
datagram does not travel through a competitor’s network. Slide 2- 21
IPv4 Options

 Strict Source Route


 If a datagram specifies a strict source route, all the routers defined in the
option must be visited by the datagram.
 A router must not be visited if its IPv4 address is not listed in the
datagram.
 If the datagram visits a router that is not on the list, the datagram is
discarded and an error message is issued.
 If the datagram arrives at the destination and some of the entries were not
visited, it will also be discarded and an error message issued.
 Loose Source Route
 A loose source route option is similar to the strict source route, but it is
less rigid.
 Each router in the list must be visited, but the datagram can visit other
routers as well.
Slide 2- 22
IPv4 Options
 Both source route options require routers along the path to overwrite
items in the address list with their local network addresses.
 Thus, when the datagram arrives at its destination, it contains a list of all
addresses visited, exactly like the list produced by the record route option
 Timestamp
 A timestamp option is used to record the time of datagram processing by
a router.
 The time is expressed in milliseconds from midnight, Universal time or
Greenwich mean time.
 Knowing the time a datagram is processed can help users and managers
track the behavior of the routers in the Internet.
 We can estimate the time it takes for a datagram to go from one router to
another.
 Each entry in a timestamp list contains two 32-bit values that are set to the
IPv4 address of the router that filled the entry and a 32-bit integer timestamp
Slide 2- 23
IPv4 Addresses
 The identifier used in the network layer of the TCP/IP protocol suite to
identify each device connected to the Internet is called the Internet
address or IP address.
 An IPv4 address is a 32-bit address that uniquely and universally defines
the connection of a host or a router to the Internet.
 IP addresses are unique. i.e. two devices on the Internet can never have
the same address.
 The address space of IPv4 is 232 or 4,294,967,296.
 IPv4 addresses are written as four decimal integers separated by decimal
points, where each integer gives the value of one octet of the address
 Note that because each byte (octet) is 8 bits, each number in dotted-
decimal notation is a value ranging from 0 to 255.

Fig: 2-11 Dotted-decimal notation and binary notation for an IPv4 address Slide 2- 24
IPv4 Addresses
 Find the error, if any, in the following IPv4 addresses.
a) [Link] a) There must be no leading zero (045).

b) [Link].20 b) There can be no more than four numbers in


an IPv4 address.
c) [Link]
c) Each number needs to be ≤ 255
d) 11100010.23.14.67
d) A mixture of binary notation and dotted-
 Classful Addressing decimal notation is not allowed.
 The address space is divided into five classes: A, B, C, D, and E.
 In classful addressing, an IP address in class A, B, or C is divided into
netid and hostid. (Also known as prefix and suffix of an IP address)
 Note that the concept does not apply to classes D and E.
 Netid and hostid parts are of varying lengths, depending on the class of
the address.
 In class A, one byte defines the netid and three bytes define the hostid.
 In class B, two bytes define the netid and two bytes define the hostid.
 In class C, three bytes define the netid and one byte defines the hostid.
Slide 2- 25
IPv4 Addresses

Fig: 2-12 Finding the classes in binary and dotted-decimal notation

Fig: 2-13 Occupation of the address space in classful addressing Slide 1- 26


IPv4 Addresses - Classful Addressing
 In class A, first bit (0), defines the class, we can have only seven bits as
the network identifier.
 There are only 27 = 128 networks in the world that can have a class A address
 In class B, first two bits (10) , define the class, we can have only 14 bits
as the network identifier.
 There are only 214 = 16,384 networks in the world that can have a class B
address
 In class C, first three bits (110) , define the class we can have only 21
bits as the network identifier.
 There are 221 = 2,097,152 networks in the world that can have a class C
address.

Table: 2-4 Number of blocks and block size in classful IPv4 addressing Slide 1- 27
IPv4 Addresses - Classful Addressing
 Classful addressing: a large part of the available addresses were wasted
 Class A addresses were designed for large organizations with a large
number of attached hosts or routers.
 A block in class A address is too large for almost any organization.
 This means most of the addresses in class A were wasted and were not used.
 Class B addresses were designed for midsize organizations with tens of
thousands of attached hosts or routers.
 A block in class B is also very large.
 Class C addresses were designed for small organizations with a small
number of attached hosts or routers.
 A block in class C is probably too small for many organizations.
 Class D addresses were designed for multicasting.
 Each address in this class is used to define one group of hosts on the Internet
 The Internet authorities wrongly predicted a need for 268,435,456 groups.
 Class E addresses were reserved for future use; Slide 1- 28
IPv4 Addresses - Classful Addressing
 The length of the netid and hostid is predetermined in classful addressing,
 We can use a mask (also called the default mask), a 32-bit number made of
contiguous 1s followed by contiguous 0s.
 The masks for classes A, B, and C are shown in Table 2-5. The concept
does not apply to classes D and E.
 The mask can help us to find the netid and the hostid.
 The last column of Table 2-5 shows the mask in the form /n where n can
be 8, 16, or 24 in classful addressing.
 This notation is also called slash notation or Classless Interdomain
Routing (CIDR) notation.

Table: 2-5 Default masks for classful addressing Slide 1- 29


Classless Addressing
 Classful addressing, which is almost obsolete, is replaced with classless
addressing
 To overcome address depletion and give more organizations access to
the Internet, classless addressing was designed and implemented.
 In this scheme, there are no classes, but the addresses are still granted in
blocks.
 Address Blocks
 In classless addressing, when an entity, small or large, needs to be
connected to the Internet, it is granted a block (range) of addresses.
 The size of the block (the number of addresses) varies based on the nature
and size of the entity.
 To simplify the handling of addresses, the Internet authorities impose
three restrictions on classless address blocks:
Slide 2- 30
 1. The addresses in a block must be contiguous, one after another.
 2. The number of addresses in a block must be a power of 2 (1, 2, 4, 8,...)
 3. The first address must be evenly divisible by the number of addresses.
Classless Addressing
 Fig 2-14 shows a block of addresses, in both binary and dotted-decimal
notation, granted to a small business that needs 16 addresses.
 We can see that the restrictions are applied to this block.
 The addresses are contiguous.
 The number of addresses is a power of 2 (16=24) and
 The first address is divisible by 16.
 The first address, when converted to a decimal number, is 3,440,387,360, which
when divided by 16 results in 215,024,210.

Fig: 2-14 A block of 16 addresses granted to a small organization Slide 2- 31


Classless Addressing
 In IPv4 addressing, a block of addresses can be defined as x.y.z.t /n in
which x.y.z.t defines one of the addresses and the /n defines the mask.
 The first address in the block can be found by setting the rightmost 32 - n
bits to 0s. [OR]
 The first address in the block = (Any address in the block) AND (mask).

 The last address in the block can be found by setting the rightmost 32 - n
bits to 1s. [OR]
 The last address in the block = (Any address in the block) OR [(NOT
(mask)].

 The number of addresses in the block can be found by using the formula
232- n.
 The number of addresses in the block N = (NOT (mask))decimal + 1.
Slide 2- 32
Classless Addressing
 A block of addresses is granted to a small organization. We know that one of the
addresses is [Link]/28. a) What is the first address in the block?, b) Find
the last address for the block? c) Find the number of addresses ?
 The binary representation of the given address is
 11001101 00010000 00100101 00100111
a) If we set 32−28 rightmost bits to 0, we get
 11001101 00010000 00100101 00100000 or [Link].

b) If we set 32 − 28 rightmost bits to 1, we get


 11001101 00010000 00100101 00101111 or [Link]

c) The value of n is 28, which means that number of addresses is 2 32−28 or 16

Slide 1- 33
Classless Addressing
 A block of addresses is granted to a small organization. We know that one of the
addresses is [Link]/27 (a) What is the first address in the block?, (b)
Find the last address for the block? (c)Find the number of addresses ?

 Suppose an organization is assigned a block of 2048 contiguous


addresses starting at address [Link], what will be the last
address of this block.
Slide 1- 34
Classless Addressing
 The first address in a block is normally not assigned to any device; it is
used as the network address that represents the organization to the rest
of the world. E.g: [Link]/28

The router has two addresses. One


belongs to the granted block; the other
belongs to second address, x.y.z.t/n.

Fig: 2-15 A network configuration for the block [Link]/28


 Each address in the block can be considered as a two-level hierarchical
structure (No Subnetting): the leftmost n bits (prefix) define the network;
the rightmost 32 - n bits define the host.
Fig: 2-16: Two levels of
hierarchy in an IPv4 address
Slide 2- 35
Classless Addressing
 Three-Levels of Hierarchy: Subnetting Slide 2- 36

 An organization that is granted a large block of addresses could divide the


addresses into several contiguous groups and assign each group to
smaller networks (called subnets)
 The rest of the world still sees the organization as one entity; however,
internally there are several subnets.
 All outgoing messages are sent to the router address that connects the
organization to the rest of the Internet; the router routes the incoming
message to the appropriate subnets.
 The organization, needs to create small subblocks of addresses, each
assigned to specific subnets.
 The organization has its own mask; each subnet must also have its own
subnetmask.

Fig: 2-17 Three-


level hierarchy in
an IPv4 address
Classless Addressing
Slide 2- 37
 An organization is granted the block [Link]/26. The organization
needs 4 subnets. What is the subnet prefix length? What are the subnet
addresses and the range of addresses for each subnet ?
 There are 232-26= 64 addresses in this block. The first address is
[Link]/26; the last address is [Link]/26.

number of number of Subnet First Address Last Address


addresses addresses mask
(Requirement) (Allocated) length
16 16 28 [Link]/28 [Link]/28
16 16 28 [Link]/28 [Link]/28
16 16 28 [Link]/28 [Link]/28
16 16 28 [Link]/28 [Link]/28
Classless Addressing
 Suppose an organization is given the block [Link]/26, which contains
64 addresses. The organization has three offices and needs to divide the
addresses into three subblocks of 32, 16, and 16 addresses. What are the
subnet addresses and the range of addresses for each subnet

Slide 2- 38
Classless Addressing
 An organization is granted a block of addresses with the beginning
address [Link]/24. The organization needs to have 3 subblocks of
addresses to use in its three subnets: one subblock of 10 addresses, one
subblock of 60 addresses, and one subblock of 120 addresses. Design
the subblocks.

Slide 2- 39
Classless Addressing
 Address Allocation
 The ultimate responsibility of address allocation is given to a global
authority called the Internet Corporation for Assigned Names and
Addresses (ICANN).
 However, ICANN does not normally allocate addresses to individual
organizations.
 It assigns a large block of addresses to an ISP.
 Each ISP, in turn, divides its assigned block into smaller subblocks and
grants the subblocks to its customers.
 In other words, an ISP receives one large block to be distributed to its
Internet users.
 This is called address aggregation: many blocks of addresses are
aggregated in one block and granted to one ISP.

Slide 2- 40
Classless Addressing
 An ISP is granted a block of addresses starting with [Link]/16 (65,536
addresses). The ISP needs to distribute these addresses to three groups of
customers as follows: Design the subblocks and find out how many addresses are
still available after these allocations.
 The first group has 64 customers; each needs 256 addresses.
 The second group has 128 customers; each needs 128 addresses.
 The third group has 128 customers; each needs 64 addresses.

Slide 2- 41
Network Address Translation (NAT).
 Private Addresses: Any organization can use an address out of this set
without permission from the Internet authorities.
 They are unique inside the organization, but they are not unique globally.
 No router will forward a packet that has one of these addresses as the
destination address.
 If a packet containing one of the private addresses is accidentally forwarded
onto the global Internet, a router will detect the problem and discard the
packet.
 The site must have only one single connection to the global Internet
through a router that runs the NAT software.

Prefix Lowest Address Highest Address


[Link] / 8 [Link] [Link]
[Link] / 12 [Link] [Link]
[Link] / 16 [Link] [Link]

Table 2-6 Addresses for private networks Slide 2- 42


IPv4 Special Address
 This host address([Link]) is used whenever a host needs to send an IP
packet but it does not know its own address to use as the source address.
 Limited broadcast address is used whenever a router or a host needs to
send a datagram to all devices in a network.
 Directed broadcast packet is sent to all computers on a specific network.
 A subnet broadcast address is used to broadcast on a single network
within a site that uses subnetting.
 A packet with loopback addresses ([Link]/8) as the destination
address never leaves the host; it will remain in the host.

Fig: 2-18 IPv4 Special Addresses Slide 2- 43


IPv6, Header format, Extension headers
 IPv4 has some deficiencies (listed below)
 Despite all short-term solutions, such as subnetting, classless addressing,
and NAT, address depletion is still a long-term problem in the Internet.
 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.
 The Internet must accommodate encryption and authentication of data for
some applications. No encryption or authentication is provided by IPv4.
 IPv6 (Internetworking Protocol, version 6), overcome these deficiencies,
also known as IPng (Internetworking Protocol, next generation).
 The ICMP, ARP and IGMP protocols in version 4 are combined into one
single protocol, ICMPv6.

Fig: 2-19 Comparison of network layer in version 4 and version 6 Slide 2- 44


IPv6, Header format, Extension headers
 IPv6, has some advantages over IPv4 that can be summarized as follows:
 Larger address space: An IPv6 address is 128 bits long, this is a huge
(296) increase in the address space (2128). ( Address space of IPv4 232)
 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.
 Support for more security. The encryption and authentication options in
IPv6 provide confidentiality and integrity of the packet. Slide 2- 45
IPv6, Header format, Extension headers
 IPv6 packet is composed of a mandatory base header (40 byte) followed
by the payload.
 The payload (up to 65,535 bytes) consists of two parts: optional extension
headers and data from an upper layer.
 Version. 2-bit field defines the version of the IP, For IPv6, the value is 6
 Traffic class. The 8-bit (traffic class) field is used to distinguish different
payloads with different delivery requirements.
 It replaces the type-of-service field in IPv4.

Fig: 2-20 Format of an IPv6 datagram

Slide 2- 46
IPv6, Header format, Extension headers
 Flow label. The flow label is a 20-bit field that is designed to provide
special handling for a particular flow of data.
 Payload length. The 2-byte payload length field defines the length of the
IP datagram excluding the base header.
 Next header. The next header is an 8-bit field defining the header that
follows the base header in the datagram. (Similar to protocol field in IPv4)
 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
 Each extension header also contains this field.
 Hop limit. This 8-bit hop limit field serves the same purpose as the TTL
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 identifies the final destination of the datagram.
Slide 2- 47
IPv6, Header format, Extension headers
 Payload. Compared to IPv4, the payload field in IPv6 has a different
format and meaning, as shown in below diagram.
 Each extension header has two mandatory fields, next header and the
length followed by information related to the particular option.
 Note that each next header field value (code) defines the type of the next
header (hop-by-hop option, source routing option, . . .);
 The last next header field defines the protocol (UDP, TCP, . . .) that is
carried by the datagram.

Fig: 2-21 Payload in an IPv6 datagram


Slide 2- 48
IPv6, Header format, Extension headers
 Flow Label
 The IP protocol was originally designed as a connectionless protocol.
 In version 6, the flow label has been directly added to the format of the
IPv6 datagram to allow us to use IPv6 as a connection-oriented protocol.
 To a router, a flow is a sequence of packets that share the same
characteristics, such as traveling the same path, using the same
resources, having the same kind of security, and so on.
 A router that supports the handling of flow labels has a flow label table.
 The table has an entry for each active flow label; each entry defines the
services required by the corresponding flow label.
 When the router receives a packet, it consults its flow label table to find
the corresponding entry for the flow label value defined in the packet.
 It then provides the packet with the services mentioned in the entry.
 The flow label itself does not provide the information for the entries of the
flow label table; the information is provided by other means, such as the
hop-by-hop options or other protocols. Slide 2- 49
IPv6, Header format, Extension headers
 Flow Label
 A flow label can be used to speed up the processing of a packet by a
router.
 When a router receives a packet, instead of consulting the forwarding
table and going through a routing algorithm to define the address of the
next hop, it can easily look in a flow label table for the next hop.
 In its more sophisticated form, a flow label can be used to support the
transmission of real-time audio and video.
 Real-time audio or video, particularly in digital form, requires resources
such as high bandwidth, large buffers, long processing time, and so on.
 A process can make a reservation for these resources beforehand to
guarantee that real-time data will not be delayed due to a lack of
resources.
 The use of real-time data and the reservation of these resources require
other protocols such as Real-Time Transport Protocol (RTP) and
Resource Reservation Protocol (RSVP) in addition to IPv6. Slide 2- 50
IPv6, Header format, Extension headers

Table 2-7: Comparison between IPv4 and IPv6 packet header Slide 2- 51
IPv6 Optional Extensions (Extension Header)
 IPv6 uses the mechanism of extension headers in place of IPv4 options.
 IPV6 base header can be followed by up to six extension headers.

Fig: 2-22. IPv6 Extension Header Types


 Hop-by-Hop Option
 The hop-by-hop option is used when the source needs to pass
information to all routers visited by the datagram.
 For example, perhaps routers must be informed about certain
management, debugging, or control functions.
 So far, only three hop by- hop options have been defined: Pad1, PadN,
and jumbo payload. Slide 2- 52
IPv6 Optional Extensions (Extension Header)
 Hop-by-Hop Option
 Pad1. This option is 1 byte long and is designed for alignment purposes.
 Some options need to start at a specific bit of the 32-bit word.
 If an option falls short of this requirement by exactly 1 byte, Pad1 is added
 PadN. PadN is similar in concept to Pad1.
 The difference is that PadN is used when 2 or more bytes are needed for
alignment.
 Jumbo payload. The length of the payload in the IP datagram can be a
maximum of 65,535 bytes.
 However, if for any reason a longer payload is required, we can use the
jumbo payload option to define this longer length.
 Destination Option
 The destination option is used when the source needs to pass information
to the destination only.
 Intermediate routers are not permitted access to this information. Slide 2- 53
IPv6 Optional Extensions (Extension Header)
 Source Routing
 The source routing extension header combines the concepts of the strict
source route and the loose source route options of IPv4.
 Authentication
 The authentication extension header has a dual purpose: it validates the
message sender and ensures the integrity of data.
 Encrypted Security Payload
 The encrypted security payload (ESP) is an extension that provides
confidentiality and guards against eavesdropping.
 Fragmentation
 In IPv4, the source or a router is required to fragment if the size of the
datagram is larger than the MTU of the network.
 IPv6 datagrams can be fragmented only by the source, not by the routers;
the reassembly takes place at the destination.
Slide 2- 54
IPv6 Fragmentation & Path MTU Discovery(PMTUD)
 A source must use a path MTU discovery technique to find the smallest
MTU supported by any network on the path.
 The fragmentation of packets at routers is not allowed to speed up the
processing of packets in the router.
 The fragmentation of a packet in a router needs a lot of processing. The
packet needs to be fragmented, all fields related to the fragmentation need to
be recalculated.
 In IPv6, the source can check the size of the packet and make the
decision to fragment the packet or not.
 When a router receives the packet, it can check the size of the packet and
drop it if the size is larger than allowed by the MTU of the network ahead.
 The router then sends a packet-too-big ICMPv6 error message to inform the
source.

Slide 2- 55
IPv6 Fragmentation & Path MTU Discovery(PMTUD)
 PMTUD mechanism consists of sending an IPv6 datagram that fits in the
MTU of the directly-connected network.
 If a network along the path has a smaller MTU, a router will send an ICMP
error message to the original source that specifies the smaller MTU.
 The host fragments datagrams according to the new path MTU and tries
again. If a later network along the path has an MTU that is even smaller,
another router will send an error message.
 By repeatedly probing, a host will eventually find the smallest MTU along
the path.
 If the source does not use a Path MTU Discovery technique, it fragments
the datagram to a size of 1280 bytes or smaller.
 This is the minimum size of MTU required for each network connected to
the Internet.
 IPv6 base header does not include fields to specify fragmentation.

Slide 2- 56
IPv6 Fragmentation & Path MTU Discovery(PMTUD)
 When it fragments an IPv6 datagram, a source inserts a Fragment
Extension Header into each fragment. Figure illustrates the format.

 As the figure shows, the extension header includes the required NEXT
HEADER field.
 It also includes two fields that are reserved for future use.
 The remaining three fields have the same meaning as IPv4 fragmentation
control fields.
 A 13-bit FRAGMENT OFFSET field specifies where in the original
datagram this fragment belongs,
 The M bits is a more fragments bit that specifies whether a fragment is
the final (rightmost) fragment of the original datagram.
 The IDENTIFICATION field contains a unique datagram ID that is shared
by all the fragments of a datagram
Slide 2- 57
Datagram Reassembly
 Where should fragments be reassembled ?
 Should a datagram be reassembled when it reaches a network with a
larger MTU or should the datagram remain fragmented and the fragments
be transported to the ultimate destination. ?
 If only one network along the path has a small MTU, sending small
fragments over the other networks is inefficient.
 If any fragments are lost, the datagram can not be reassembled. The
mechanism used to handle fragment loss consists of a reassembly
timer.
 The ultimate destination starts a timer when a fragment arrives for a given
datagram. If the timer expires before all fragments arrive, the receiving
machine discards the surviving fragments.
 The source must retransmit the entire datagram
 Despite the minor disadvantages, performing reassembly at the ultimate
destination works well. (Routers do not need to store fragments or keep
other information about packets.) Slide 2- 58
IPv6, Header format, Extension headers
 Extension Headers

Table 2-8: Comparison between IPv4 options and IPv6 extension headers Slide 2- 59
IPv6 Datagram Format
 Instead of trying to specify all details in a single header, IPv6 uses an
extension capability.
 The general form of an IPv6 datagram with a base header followed by
optional extension headers.

 Each IPv6 header contains a NEXT HEADER field that specifies the type
of the header that follows. The final header uses the NEXT HEADER
field to specify the type of the payload.

Slide 2- 60

Fig: 2-23. Illustration of the NEXT HEADER fields in IPv6 datagrams with (a) only a base header, (b)
a base header and one extension (c) a base header and two extension headers.
IPv6 Datagram Format
 Fixed fields in the datagram header for all mechanisms like fragmentation,
source routing and authentication, is inefficient because most datagrams
do not use all mechanisms; (so we are using extension headers)
 Some of the extension headers are intended for processing by the
ultimate destination and some of the extension headers are used by
intermediate routers along the path.
 Observe that the use of NEXT HEADER fields means extensions are
processed sequentially.
 To speed processing, IPv6 requires extension headers that are used by
intermediate routers to precede extension headers used by the final
destination.
 We use the term hop-by-hop header to refer to an extension header that
an intermediate router must process. Thus, hop-by-hop headers precede
end-to-end headers.

Slide 2- 61
Options Processing During Fragmentation

 Both IPv4 and IPv6 use the same conceptual approach to handle options
during fragmentation.
 When creating fragments, the IP code examines each of the options in
the original datagram.
 If an option must be processed by intermediate routers, the option is
copied into each fragment.
 However, if the option is only used at the ultimate destination, the option
is copied into the header of the first fragment but not the rest.
 Omitting unnecessary options from later fragments reduces the total
number of bits transmitted.

Slide 2- 62
IPv4 Processing Options During Fragmentation
 In IPv4, each option begins with a code octet.
 Each code octet contains a copy bit that specifies whether the option
should be replicated in all fragments or in only one fragment.
 As an example, consider the record route option.
 Because each fragment is treated as an independent datagram, there is no
guarantee that all fragments follow the same path to the destination.
 It may be interesting to learn a set of paths that each of the fragments took
 But the designers decided that a destination will have no way to arbitrate
among multiple paths.
 Therefore, the IP standard specifies that the record route option should
only be copied into one of the fragments.
 Source route options provide an example of options that must be copied
into each fragment.
 If the datagram is fragmented at some point along the path, all fragments
should follow the remainder of the path that the sender specified,
Slide 2- 63
IPv6 Processing Options During Fragmentation

 IPv6 divides a datagram into two conceptual pieces: an initial piece that is
classified as unfragmentable and the remainder, which is classified as
fragmentable.
 The base header lies in the unfragmentable piece and the payload lies in
the fragmentable piece.
 As with IPv4, extension headers that are only processed by the ultimate
destination do not need to be present in each fragment.
 The Hop-By-Hop Header and Route Header are not fragmentable; other
extension headers are fragmentable.
 Therefore, the fragmentable part of the datagram begins after the non-
fragmentable extension headers.
 IPv6 treats the fragmentable piece of the datagram as an array of octets
to be divided into fragments

Slide 2- 64
IPv6 Processing Options During Fragmentation
 Figure, which illustrates the fragmentation of an IPv6 datagram that has a
base header, four extension headers, and 1400 octets of payload.
 Following the unfragmentable piece, a fragment has a Fragment Header
labeled F in the figure.

Fig: 2-24 IPv6 fragmentation with (a) an IPv6 datagram with extension headers divided into
fragmentable and unfragmentable pieces, and (b) a set of fragments. Slide 2- 65
Network Byte Order
 NOT all computers store 32-bit integers in the same way.
 On some (called little endian), the lowest memory address contains the low-
order byte of the integer.
 On others (called big endian), the lowest memory address holds the high-
order byte of the integer.
 Thus, direct copying of bytes from one machine to another may change the
value of the integer.
 To keep internetworking independent of any particular vendor’s machine
architecture or network hardware, we must specify a standard
representation for data.
 The payload field in a packet is exempt from the byte-order standard
because the TCP/IP protocols do not know what data is being carried.
 The Internet protocols define network byte order to be big endian.
 A sender must convert all integer fields in packet headers to network byte
order before sending a packet, and a receiver must convert all integer
fields in packet headers to local byte order before processing a packet.
Slide 2- 66
IPv6, Header format, Extension headers
 An IPv6 address is 128 bits (16 bytes) long.
 IPv6 specifies hexadecimal colon notation, address consists of 32
hexadecimal digits, with every four digits separated by a colon

Fig: 2-25 (a) IPv6 Address

 The leading zeros of a section (4 digits between two colons) can be omitted

Fig: 2-25 (b) Abbreviated address

 If there are consecutive sections consisting of zeros only. We can remove


the zeros altogether and replace them with a double semicolon.
 Note that this type of abbreviation is allowed only once per address.

Fig: 2-25 (c) Abbreviated address


with consecutive zeros Slide 2- 67
IPv6, Header format, Extension headers
 Mixed Notation: A mixed representation of an IPv6 address: colon hex
and dotted decimal notation is allowed.
 This is appropriate during the transition period in which an IPv4 address is
embedded in an IPv6 address.
 E.g: 0:0:0:0:0:0:[Link] or ::[Link]
 IPv6 extends CIDR-like notation by allowing an address to be followed by
a slash and an integer that specifies a number of bits.
 E.g: 12AB::CD30:0:0:0:0/60
 In IPv6, a destination address can belong to one of three categories:
 Unicast Address
 A unicast address defines a single interface (computer or router).
 The packet sent to a unicast address will be routed to the intended
recipient.

Slide 2- 68
IPv6, Header format, Extension headers
 Multicast Address
 In multicasting each member of the group receives a copy.
 IPv6 has designated a block for multicasting from which the same
address is assigned to the members of the group. IPv6 does not define
broadcasting.
 Anycast Address
 Defines a group of computers that all share a single address
 A packet with an anycast address is delivered to only one member of the
group, the most reachable one.
 For example, when there are several servers that can respond to an inquiry.
The request is sent to the one that is most reachable
 The hardware and software generate only one copy of the request; the copy
reaches only one of the servers.
 IPv6 does not designate a block for anycasting; the addresses are
assigned from the unicast block.
Slide 2- 69
IPv6, Header format, Extension headers
 IPv6 permits a multi-level hierarchy or multiple hierarchies.
 Like IPv4, the address space of IPv6 is divided into several blocks of
varying size and each block is allocated for a special purpose.
 Most of the blocks are still unassigned and have been set aside for future
use. (IETF will assign the blocks)
 The first 8 bits of an address are sufficient to identify the basic types.
 The last column shows the fraction each block occupies in the whole address.
 The highorder octet of an address distinguishes between multicast (all 1 bits)
and unicast (a mixture of 0’s and 1’s).
Block prefix CIDR Block Assignment Fraction
Special addresses
0000 0000 0000::/8 (IPv4 compatibility) 1/256
001 2000::/3 Global unicast 1/8
1111 110 FC00::/7 Unique local unicast 1/128
1111 1110 10 FE80::/10 Link local addresses 1/1024
1111 1111 FF00::/8 Multicast addresses 1/256
Table 2-9: Prefixes for assigned IPv6 addresses Slide 2- 70
IPv6, Header format, Extension headers
 Global unicast: A routable address in the IPv6 Internet, similar to a
public IPv4 address.
 An address in this block is divided into three parts: global routing prefix (n
bits), subnet identifier (m bits), and interface identifier (q bits)
 Unique local: Similar to a private address in IPv4 and not intended to be
routable in the IPv6 Internet.
 Link-local: Used only to communicate with devices on the same local link
(subnet) and do not need to be unique beyond the link.
 Therefore, routers do not forward packets with a link-local address
 Unspecified / Special address: Used only as a source address and
indicates the absence of an IPv6 address.
 The unspecified address is a subblock containing only one address, which is
used during bootstrap when a host does not know its own address and wants
to send an inquiry to find it.
 Loopback: An address not assigned to any physical interface that can be
used for a host to send an IPv6 packet to itself.
 0000::1/128 or ::1 Slide 2- 71
Internet Control Message Protocol (ICMP),
 The IP protocol has no error-reporting or error-correcting mechanism.
Slide 2- 72
 The IP protocol also lacks a mechanism for host and management
queries. E.g: A host needs to determine if a router or another host is alive.
 ICMP has been designed to compensate for the above two deficiencies.
 ICMP messages are divided into error-reporting and query messages.
 The error-reporting messages report problems that a router or a host
(destination) may encounter.
 The query messages get specific information from a router or another host.

Fig: 2-26 ICMP Message Types


Internet Control Message Protocol (ICMP),
 ICMP Message Delivery
 Like all other traffic, ICMP messages travel across the internet in the
payload area of IP datagrams.
 Under the assumption that error messages will be delivered.
 When an ICMP message is carried in the payload area of an IPv4
datagram, the PROTOCOL field is set to 1.
 IPv6 uses the NEXT HEADER field to specify the type of the item being
carried.
 ICMP does not correct errors, ICMP always reports error messages to the
original source.
Fig: 2-27 (a) The two levels of encapsulation used
when an ICMP message is sent across a network.

Fig: 2-27 (b) Contents of data field for error


messages Slide 2- 73
Internet Control Message Protocol (ICMP),
 ICMP Messages
 The error-reporting messages report problems that a router or a host
(destination) may encounter when it processes an IP packet.
 The query messages, occur in pairs. (E.g: Request & Reply)
 An ICMP message has an 8-byte header and a variable-size data section.
 Although the general format of the header is different for each message
type, the first 4 bytes are common to all.
 The first field, ICMP type, defines the type of the message.
 Error-reporting messages (ICMP type<128) &
 Query messages. (128 ≤ ICMP type ≤ 255)
 The code field specifies the reason for the particular message type.
 16-bit CHECKSUM that is computed over the entire ICMP message.
 ICMP uses the same 16-bit one’s complement checksum as IP
 The rest of the header is specific for each message type
Slide 2- 74
ICMP Messages
 General format of ICMP messages
 The data section in error messages carries information for finding the
original packet that had the error.
 In query messages, the data section carries extra information based on
the type of query

Fig: 2-28 General format of ICMP Messages

Slide 2- 75
ICMP Messages - Error Reporting Messages
 Note that all error messages contain a data section that includes the IP
header of the original datagram plus the first 8 bytes of data in datagram.
 The original datagram header is added to give the original source, which
receives the error message, information about the datagram itself.
 The 8 bytes of data are included because the first 8 bytes provide
information about the port numbers (UDP &TCP) sequence no. (TCP).
 This information is needed so the source can inform the higher layer
protocols (TCP or UDP) about the error.
 The following are important points about ICMP error messages:
 No ICMP error message will be generated in response to a datagram carrying
an ICMP error message.
 No ICMP error message will be generated for a fragmented datagram that is
not the first fragment.
 No ICMP error message will be generated for a datagram having a multicast
address.
 No ICMP error message will be generated for a datagram having a special
address such as [Link] or [Link]. Slide 2- 76
ICMP Messages - Error Reporting Messages
 Destination Unreachable
 When a router cannot route a datagram or a host cannot deliver a
datagram, the datagram is discarded and they send a destination-
unreachable message back to the source host. (ICMP Type: 3. )
 E.g: Unable to route the packet due to DF bit set in IP Header.
 E.g: Tried to access a web page, but the server is down.

 Source Quench
 Another error message is called the source quench (type 4) message,
which informs the sender that the network has encountered congestion
and the datagram has been dropped;
 The source needs to slow down sending more datagrams.
 ICMP adds a kind of congestion control mechanism to the IP
Slide 2- 77
 Parameter Problem
 A parameter problem message (type 12) can be sent when either there is
a problem in the header of a datagram (code 0) or some options are
missing or cannot be interpreted (code 1). E.g: Invalid no. in protocol field
ICMP Messages - Error
Reporting Messages

Fig: 2-29 Redirection Concept


 Redirection Message
 The redirection message (type 5) is used when the source uses a wrong
router to send out its message.
 The router redirects the message to the appropriate router, but informs
the source that it needs to change its default router in the future.
 The IP address of the default router is sent in the message.

 Time-exceeded message
 When the TTL value becomes 0, the datagram is dropped by the visiting
router and a time exceeded message (type 11) with code 0 is sent to the
source to inform it about the situation.
 The time-exceeded message (with code 1) can also be sent when not all
fragments of a datagram arrive within a predefined period of time.

Slide 2- 78
ICMP Messages – ICMP Packet
IP Header IP Data
Query Messages Fig: 2-30 Encapsulation of ICMP query messages
 Query messages are used to probe or test the liveliness of hosts or
routers in the Internet. Query messages come in pairs: request and reply.
 A query message is encapsulated in an IP packet, which in tum is
encapsulated in a data link layer frame.
 No bytes of the original IP are included in the message.

 Echo Request and Reply Slide 2- 79

 The echo request & the echo reply pair of messages are used by a host
or a router to test the liveliness of another host or router.
 A host or router sends an echo request message to another host or
router; if the latter is alive, it responds with an echo reply message.
 The applications of this pair used in two debugging tools: ping and traceroute.
• IDENTIFIER - identifies an application and SEQUENCE
NUMBER to number successive requests sent by the application

Fig: 2-31 Echo-request and echo-reply messages format


ICMP Messages – Query Messages
 Timestamp Request and Reply
 The timestamp request and the timestamp reply pair of messages are
used to find the round-trip time between two devices or to check whether
the clocks in two devices are synchronized.
 The timestamp request message sends a 32-bit number, which defines
the time the message is sent.
 The timestamp reply resends that number, but also includes two new 32-
bit numbers representing the time the request was received and the time
the response was sent.
 If all timestamps represent Universal time, the sender can calculate the one-
way and round-trip time.

Fig: 2-32 Timestamp Request and Reply messages format Slide 2- 80


ICMP Messages – Query Messages
 Address mask request and reply
 A host may know its IP address, but it may not know the corresponding
mask, it sends a address-mask-request message to the network/router.
 The router receiving the address-mask-request message responds with
an address-mask-reply message, providing the necessary mask for the
host.
 “Address mask request and reply” and “Router solicitation and
advertisement” messages are not used today because their duties are
done by the DHCP.

Fig: 2-33 Mask-request and mask-reply message format Slide 2- 81


ICMP Messages – Query Messages
Router Solicitation and Advertisement
 A host needs to know the address of
routers connected to its own network.
 A host can broadcast (or multicast) a Fig: 2-34 Router-solicitation message format
router-solicitation message.
 The router or routers that receive the
solicitation message broadcast their
routing information using the router-
advertisement message.
 A router can also periodically send
router-advertisement messages even
if no host has solicited.
 In advertisement, it announces not
only its own presence but also the
presence of all routers on the network.
 Life Time: No. of seconds that the
router addresses is considered valid.
 Preference Level: Higher values mean Fig: 2-35 Router-advertisement message format
more preferable. Slide 2- 82
Internet Control Message Protocol version 6
(ICMPv6).
 ICMPv4 has been modified to make it more suitable for IPv6.
 The ICMP, ARP and IGMP protocols in version 4 are combined into one
single protocol, ICMPv6.
 The RARP protocol is dropped from the suite because it was rarely used
and BOOTP has the same functionality.

Fig: 2-36 Comparison of network layer in version 4 and version 6


 Like ICMPv4, we divide the ICMPv6 messages into two categories i.e.
Error Reporting and Query Messages.

Fig: 2-37 ICMPv6 Error reporting messages Slide 2- 83


Internet Control Message Protocol version 6
(ICMPv6).
 ICMPv6 forms an error packet, which is then encapsulated in an IP
datagram. This is delivered to the original source of the failed datagram.
 The source-quench message is eliminated in version 6 because the traffic
class and the flow label fields allow the router to control congestion and
discard the least important messages.
 In this version, there is no need to inform the sender to slow down.

 Packet Too Big


 The packet-too-big message is added in ICMPv6 because fragmentation
is the responsibility of the sender in IPv6.
 If a router receives a datagram that is larger than the maximum
transmission unit (MTU) size of the network through which the datagram
should pass, two things happen.
 First, the router discards the datagram and then an ICMP error packet -
a packet-too-big message-is sent to the source.

Slide 2- 84
Internet Control Message Protocol version 6
(ICMPv6).
 Destination Unreachable, Time Exceeded, Parameter Problem and
Redirection messages are similar to ICMPv4

Table 2-10: Comparison of error-reporting messages in ICMPv4 and ICMPv6

Slide 2- 85
Internet Control Message Protocol version 6
(ICMPv6).
 In addition to error reporting, ICMP can diagnose some network problems
 This is accomplished through the query messages.
Four different groups of messages have been defined:
Fig: 2-38 ICMPv6 Query messages

 Two sets of query messages are eliminated from ICMPv6:


time-stamp request and reply and address-mask request and reply.
 The timestamp request and reply messages are eliminated because they
are implemented in other protocols such as TCP and because they were
rarely used in the past.
 The address-mask request and reply messages are eliminated in IPv6
because it is learned via Router Advertisement, Neighbour discovery and
DHCPv6. Slide 2- 86
Internet Control Message Protocol version 6
(ICMPv6).
 Neighbor Solicitation and Advertisement
 The network layer in version 4 contains an independent protocol called
Address Resolution Protocol (ARP).
 In version 6, this protocol is eliminated, and its duties are included in
ICMPv6.
 The idea is exactly the same, but the format of the message has
changed.
 Group Membership
 The network layer in version 4 contains an independent protocol called
IGMP.
 In version 6, this protocol is eliminated, and its duties are included in
ICMPv6. The purpose is exactly the same.

Slide 2- 87
Internet Control Message Protocol version 6
(ICMPv6).
 The idea behind Echo Request and Reply & Router Solicitation and
Advertisement messages is the same as in version 4.

Table 2-11: Comparison of query messages in ICMPv4 and ICMPv6

Slide 2- 88
ICMP
 The ICMP mechanism is considered a required part of IP and must be
included in every IP implementation.
 ICMP messages are not usually delivered to applications.
 ICMP providies communication between an ICMP module on one
machine and an ICMP module on another.
 ICMP may take further action in response to the incoming message.
 For example, ICMP might inform an application or a higher-level protocol
about an incoming message.
 ICMP is not restricted exclusively to routers, host can also communicate with
ICMP.
 Why restrict ICMP to communication with the original source ?
 A datagram only contains fields that specify the original source and the
ultimate destination;
 It does not contain a complete record of its trip through the internet
 If the router detects a problem, IP cannot know the set of intermediate
machines that processed the datagram, so it cannot inform them of the
problem. Slide 2- 89
Conceptual Layering
 ICMP messages cannot be delivered by a Layer 2 transport
alone. ?
 Each ICMP message is encapsulated in an IP datagram,
 ICMP is not considered a higher-level protocol.
 Instead, ICMP is a required part of IP, which means ICMP is classified as
a Layer 3 (network-layer) protocol.
 We can think of the encapsulation as using the existing IP-based
forwarding scheme
 Rather than creating a parallel forwarding mechanism for ICMP messages.
 ICMP must send error reports to the original source, so an ICMP
message must travel across multiple underlying networks to reach its final
destination.

Slide 2- 90
Testing Destination Reachability & Status (Ping)
 We introduce two tools that use ICMP for debugging: ping and traceroute.
 We can use the ping program to find if a host is alive and responding.
 The source host sends ICMP echo-request messages; the destination, if
alive, responds with ICMP echo-reply messages.
 The ping program sets the identifier field in the echo-request and echo-
reply message and starts the sequence number from 0;
 This number is incremented by 1 each time a new message is sent.
 Echo request and associated reply can be used to test whether a
destination is reachable and responding.
 Note that ping can calculate the round-trip time. It inserts the sending time
in the data section of the message.
 When the packet arrives, it subtracts the arrival time from the departure
time to get the round-trip time (RTT).
 Because both the request and reply travel in IP datagrams
Slide 2- 91
Testing Destination Reachability & Status (Ping)
 Most versions of ping also allow a user to specify the amount of data
being sent in each request.
 Receiving a reply from a remote machine verifies that major pieces of the
IP transport system are working correctly.
1) IP software on the source computer must have an entry in its forwarding
table for the destination.
2) The source computer has created a correct datagram.
3) The source was able to reach a router, which means ARP (IPv4) or
Neighbor Discovery (IPv6) is working.
4) Intermediate routers between the source and destination must be
operating, and must forward datagrams correctly in both directions
between the source and destination.
5) The destination machine must be running, the device driver must be
able to receive and send packets, and both ICMP and IP software
modules must be working.
Slide 2- 92
Testing Destination Reachability & Status (Ping)
 If ping sends a series of requests, it displays statistics about message
loss. The advantage of sending a continuous series of requests arises
from an ability to discover intermittent problems.
 Sending a large ping packet is useful for testing fragmentation and
reassembly.
 Large packets also force IPv6 to engage in path MTU discovery.
C:\Users\Administrator>ping [Link]
Pinging [Link] [[Link]] with 32 bytes of data:
Reply from [Link]: bytes=32 time=588ms TTL=53
Reply from [Link]: bytes=32 time=638ms TTL=53
Reply from [Link]: bytes=32 time=340ms TTL=53
Reply from [Link]: bytes=32 time=300ms TTL=53
Ping statistics for [Link]:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 300ms, Maximum = 638ms, Average = 466ms Slide 2- 93
Traceroute or Tracert
 The traceroute program in UNIX or tracert in Windows can be used to
trace the path of a packet from a source to the destination.
 It can find the IP addresses of all the routers that are visited along the
path. The program is usually set to check for the maximum of 30 hops
(routers) to be visited.
 The traceroute program gets help from two error-reporting messages:
time-exceeded and destination-unreachable. (The ping program gets help
from two query messages)

Fig: 2-39 Use of ICMPv4 in


traceroute

Slide 2- 94
Traceroute or Tracert
C:\Users\Administrator>tracert [Link]
Tracing route to [Link] [[Link]]
over a maximum of 30 hops:
1 12 ms 1 ms 1 ms [Link]
2 * * * Request timed out.
3 417 ms 977 ms 386 ms [Link]
4 739 ms 90 ms 85 ms [Link]
5 86 ms 80 ms 92 ms [Link]
6 90 ms 82 ms 203 ms [Link]
7 124 ms 65 ms 111 ms [Link]
8 * * * Request timed out.
9 397 ms 396 ms 467 ms [Link]
10 876 ms 707 ms 501 ms [Link]
11 695 ms 107 ms 102 ms [Link]
12 188 ms 210 ms 183 ms [Link]
13 98 ms 120 ms 103 ms [Link] [[Link]]
Trace complete.
Slide 2- 95
Older ICMP Messages Used At Startup
 Originally, ICMP defined a set of messages that a host used at startup to
determine its IP address, the address of a router, and the address mask
used on the network.
 Eventually, a protocol known as DHCP was introduced that provides an IPv4
host with all the necessary information in a single exchange.
 In addition, ICMP defined messages that a host or router could use to
obtain the current time.
 Protocols to exchange time information have also been devised, making the
ICMP version obsolete.
 As a consequence, IPv4 no longer uses ICMP messages that were
designed to obtain information at start up.
 At startup, an IPv6 host multicasts an ICMPv6 Router Discovery message
to learn about routers on the local network.

Slide 2- 96
Older ICMP Messages Used At Startup
 There are two conceptual differences between router discovery and
DHCP that make it attractive for IPv6.
 First, because the information is obtained directly from the router itself,
there is never a third-party error.
 With DHCP, such errors are possible because a DHCP server must be
configured with information to hand out.
 If a network manager fails to update the DHCP configuration after a network
changes, hosts may be given out-of-date information.
 Second, ICMP router discovery uses a soft state technique with timers to
prevent hosts from retaining a forwarding table entry.
 After a router crashes — routers advertise their information periodically, and a
host discards a route if the timer for the route expires.

Slide 2- 97

You might also like