You are on page 1of 23

An Error Reporting

Mechanism (ICMP)

BY DR NTALASHA
Best effort semantics and error detection

 IP defines a best-effort communication service in


which datagrams can be lost, duplicated, delayed or
delivered out of order.
 It may seem that a best-effort service does not need
any error detection.
 However, it is important to realise that a best-effort
service is not careless - actually IP attempts to avoid
errors and to report problems when they occur.
Cont..
 The checksum that is used to detect transmission
errors is already an example of error detection in IP.
 Whenever a datagram is received, the checksum is
verified to ensure that the header arrived intact.
 To verify the checksum, the receiver re-computes the
checksum including the value in the checksum field.
 If a bit in the IP header is damaged during
transmission across a physical network, the receiver
will find that the checksum does not result in zero.
 After changing fields in the header (e.g., after
decrementing the TIME TO LIVE field), a router must
re-compute the checksum before forwarding the
datagram to its next hop.
checksum error
 If a checksum error is detected then the datagram must
be discarded without any further processing.
 The receiver cannot trust any fields in the datagram
header because the receiver can not know which bits
were altered.
 In particular, the receiver can not send an error
message back to the computer that sent the datagram
because the receiver can not trust the source address in
the header.
 Further, the receiver can not forward the damaged
datagram because the receiver can not trust the
destination address in the header.
 Thus, the receiver has no option but to discard the
damaged datagram.
Internet Control Message Protocol (ICMP)

 Problems that are less severe than transmission errors


result in error conditions that can be reported.
 The TCP/IP suite includes a protocol that IP uses to
send error messages when errors occur.
 This protocol is known as the Internet Control Message
Protocol (ICMP).
 ICMP is required for a standard implementation of IP.
 The two protocols are co-dependant.
 IP uses ICMP when it sends an error message, and
ICMP uses IP to transport messages.
ICMP encapsulation
Examples of ICMP error messages include
Source Quench

 A router sends a source quench whenever it has


received so many datagrams that it has no more
buffer space available.
 A router that has temporarily run out of buffer space
must discard incoming datagrams.
 When it discards a datagram, the router sends a
source quench message to the host that created the
datagram.
 When it receives a source quench, a host is required
to reduce the rate at which it is transmitting.
Time Exceeded.

 A time exceeded message is sent in two cases.


Whenever a router reduces the TIME TO LIVE field
in a datagram to zero, the router discards the
datagram and sends a time exceeded message.
 In addition, a time exceeded message is sent by a
host if the re-assembly timer expires before all
fragments from a given datagram arrive.
Destination Unreachable
 Whenever a router determines that a datagram can not
be delivered to its final destination, the router sends a
destination unreachable message to the host that created
the datagram.
 The message specifies whether the specific destination
host is unreachable or the network to which the host
attaches is unreachable.
 In other words, the error message distinguishes between
a situation where an entire network is temporarily
disconnected from an internet (e.g., because a router has
failed) and the case where a particular host is
temporarily off-line (e.g., because the host is powered
down).
Redirect.

 When a host creates a datagram destined for a remote


network, the host sends the datagram to a router, which
forwards the datagram to its destination.
 If a router determines that a host has incorrectly sent a
datagram that should be sent to a different router, the
router uses a redirect message to cause the host to
change its route.
 A redirect message can specify either a change for a
specific host or a change for a network; the latter is more
common.
 Parameter Problem. One of the parameters specified in
a datagram is incorrect.
Redirection concept
ICMP defines informational messages

 Echo Request / Reply. An echo request message can


be sent to the ICMP software on any computer. In
response to an incoming echo request message,
ICMP software is required to send an ICMP echo
reply message. The reply carries the same data as the
request.
 Address Mask Request / Reply. A host broadcasts
an address mask request when it boots, and routers
than receive the request send an address mask reply
that contains the correct 32-bit subnet mask being
used on the network.
ICMP message transport

 ICMP uses IP to transport each message.


 When a router has an ICMP message to send, it
creates an IP datagram and encapsulates the ICMP
message in the datagram.
 That is, the ICMP message is placed in the data area
of the IP datagram.
 The datagram is then forwarded as usual, with the
complete datagram being encapsulated in a frame for
transmission.
ICMP messages
 ICMP messages are always created in response to a
datagram.
 Either the datagram has encountered a problem (e.g., a
router finds that the destination specified in the datagram
is unreachable), or the datagram carries an ICMP message
back to the source of the datagram.
 Sending a message back to the source is straightforward
because each datagram carries the IP address of its source
in the header.
 A router extracts the source address from the header of
the incoming datagram and places the address in the
DESTINATION field of the header of the datagram that
carries the ICMP message.
Using ICMP messages to test reachability

 The ping program is one of the most commonly used utilities for
network management on a network.
 The ping program is used to test and see if a given destination can
be reached.
 Ping uses ICMP echo request and echo reply messages.
 When invoked, ping sends an IP datagram that contains an ICMP
echo request message to the specified destination. After sending the
request, it waits a short time for the reply.
 If no reply arrives, ping retransmits the request.
 If no reply arrives for the retransmissions (or if an ICMP destination
unreachable message arrives), ping declares that the remote
machine is not reachable.
 ICMP software on a remote machine replies to the echo request
message. According to the protocol, whenever an echo request
arrives, the ICMP software must send an echo reply.
Using ICMP to trace a route

 The TIME TO LIVE field in a datagram is used to


recover from routing errors.
 To prevent a datagram from following a cycle of
routes forever, each router that handles a datagram
decrements the TIME TO LIVE counter in the
header.
 If the counter reaches zero, the router discards the
datagram and sends an ICMP time exceeded error
message back to the source.
traceroute tool
 ICMP messages are used by the traceroute tool when it
constructs a list of all routers along a path to a given
destination.
 Traceroute is a network management tool which sends a
series of datagrams and waits for a response to each.
 Traceroute sets the TIME TO LIVE in the first datagram to
1 before sending the datagram.
 The first router that receives the datagram decrements the
TIME TO LIVE, discards the datagram and sends back an
ICMP time exceeded message.
 Because the ICMP message travels in an IP datagram,
traceroute can extract the IP source address and announce
the address of the first router along the path to the
destination.
 After it discovers the address of the first router,
traceroute sends a datagram with TIME TO LIVE set
to 2.
 The first router decrements the counter and forwards
the datagram.
 The second router discards the datagram and sends
an error message.
 Similarly, once it has received an error message from
the router that is distance 2, traceroute sends a
datagram with TIME TO LIVE set to 3, and then 4,
and so on.
Using ICMP for path MTU discovery
 In a router, IP software fragments any datagram that is larger
than the MTU of the network over which the datagram is being
transmitted.
 Although fragmentation solves the problem of heterogeneous
networks, fragmentation often impacts performance.
 A router uses memory and CPU time to construct fragments.
 Similarly, a destination host uses memory and CPU time to
collect incoming fragments and reassemble them into a complete
datagram.
 In some applications, fragmentation can be avoided if the
original sender chooses a smaller datagram size.
 For example, a file transfer application can send an arbitrary
amount of data in each datagram.
 If the application chooses a datagram size less than or equal to
the smallest network MTU along the path to the destination, no
router will need to fragment the datagram.
path MTU
 What mechanism can a host use to determine the path
MTU?
 An ICMP error message and a probe that will cause the
error message to be sent will have to be used.
 The error message consists of an ICMP message that
reports fragmentation was required but not permitted,
and the technique for requesting it is a bit in the FLAGS
field of the IP header that specifies the datagram should
not be fragmented.
 When a router determines that a datagram must be
fragmented, the router examines the bit in the header to
verify that fragmentation is allowed.
 If the bit is set, the router does not perform
fragmentation. Instead, the router sends an ICMP
message back to the source, and discards the datagram.
 To determine the path MTU, IP software on a host
sends a sequence of probes, where each probe
consists of a datagram that has the header bit set to
prevent fragmentation.
 If a datagram is larger than the MTU of a network
along the path, the router connected to that network
will discard the datagram and send the appropriate
ICMP message to the host.
 The host can then send a smaller probe until one
succeeds.
 As with traceroute, a host must be prepared to
retransmit probes for which no response is received.

You might also like