Internet Control Message
Protocol (ICMP)
Chapter 9
Position of ICMP in Network Layer
2
ICMP Encapsulation
3
ICMP Messages
Error-reporting messages report problems that
router or host may encounter
Query messages get specific information from
router or another host
4
General Format of ICMP Messages
Type: defines message type
Code: specifies reason for particular message type
Checksum: calculated over entire message (header
and data)
5
Contents of Data Field for Error Message
Data section in ICMP error messages carries
information about original datagram that had error
ICMP data
6
Error-Reporting Messages
ICMP always reports error messages to
original source
No ICMP error message generated for:
Datagram carrying ICMP error message
Datagram fragments except the first
Multicast datagram
Datagram having special IP address ([Link]
or [Link])
7
Error-Reporting Messages
8
Destination-Unreachable Message
Destination-unreachable message sent to source host
when datagram is undeliverable
Code 0: Network unreachable
Code 1: Host unreachable
Code 2: Protocol unreachable
Code 3: Port unreachable
Code 4: Fragmentation required, but “do not fragment” is set
Code 5: Source routing cannot be accomplished
9
Source-Quench Message
Source-quench message informs the source that
datagram has been discarded due to congestion in
router or destination host
Source should slow down (quench) sending of
datagrams until congestion is relieved
*RFC 6633 formally deprecates the use of ICMP Source
Quench messages by transport protocols.
10
Time-Exceeded Message
Time-exceeded message generated when:
Time-to-live value has reached zero
Fragments of message have not arrived in a set time
Code 0: Time to live exceeded
Code 1: Fragment reassembly time exceeded
11
Parameter-Problem Message
Parameter-problem message notifies host that there is
a problem in header field of datagram
Code 0: Error in one of header fields
Pointer: Points to the byte with error
Code 1: Required part of an option is missing
12
Redirection Message
Sent to make routing table of host more efficient
Sent from router to host on the same local network
Router does not discard datagram; it’s sent to
appropriate router
IP packet 1
RM
2
3 4
IP packet IP packet
13
Routing Table
Flags – on/off switches (presence/absence)
U (up): router is up and running
G (gateway): destination is in another network
H (host-specific): entry in network address field is host-specific
address
D (added by redirection): routing info for this destination added
by ICMP redirection message
M (modified by redirection): routing info for this destination
modified by ICMP redirection message
14
Redirection Message
Code 0: Redirection for network-specific route
Code 1: Redirection for host-specific route
Code 2: Redirection for network-specific route based on TOS
Code 3: Redirection for host-specific route based on TOS
15
Query Messages
16
Echo-Request and Echo-Reply Message
Echo-request and echo-reply messages test
connectivity between two systems
17
Timestamp-Request and Timestamp-Reply Message
Timestamp-request and timestamp-reply
messages can:
Determine round-trip time between two machines
Synchronize two clocks in two machines
Originate
18
Calculating Round-trip Time
Originate
Sending time = Receive timestamp - Originate timestamp
Receiving time = Returned time - Transmit timestamp
Round-trip time = Sending time + Receiving time
returned
Sending time Receiving time
19
Synchronizing Clocks in Two Machines
Originate
Time difference = Receive timestamp –
(Originate timestamp + one-way time)
20
Ping Tool
ping program uses ICMP echo request and echo reply
messages to test reachability of host
ICMP data
ICMP packet
IP datagram
(data+header)
21
Ping Tool
We can use ping utility with -R option to implement
record route option.
22
Traceroute Tool
Traceroute program uses ICMP time exceeded and
destination unreachable messages to trace route of
packet from source to destination
Traceroute uses ICMP messages, TTL field in IP packet,
and destination port number field in UDP packet to find
route
20 (IP header) + 8 (UDP header) + 10 (application data)
23
Traceroute Tool
Traceroute program can be used to implement loose
source routing.
-g option allows us to define routers to be visited, from
source to destination.
24
Traceroute Tool
Traceroute program can be used to implement strict
source routing.
-G option forces packet to visit routers defined in
command line.
25