TCP/IP Protocol Suite 1 Chapter 9 Upon completion you will be able to: Internet Control Message...
-
Upload
poppy-cook -
Category
Documents
-
view
220 -
download
3
Transcript of TCP/IP Protocol Suite 1 Chapter 9 Upon completion you will be able to: Internet Control Message...
TCP/IP Protocol Suite 1
Chapter 9Chapter 9
Upon completion you will be able to:
Internet Control Message Internet Control Message ProtocolProtocol
• Be familiar with the ICMP message format• Know the types of error reporting messages• Know the types of query messages• Be able to calculate the ICMP checksum• Know how to use the ping and traceroute commands• Understand the modules and interactions of an ICMP package
Objectives
TCP/IP Protocol Suite 2
Figure 9.1 Position of ICMP in the network layer
TCP/IP Protocol Suite 3
Figure 9.2 ICMP encapsulation
Note that ICMP messages are encapsulated withinIP datagrams.
TCP/IP Protocol Suite 4
Table 9.1 Table 9.1 ICMP messagesICMP messages
ICMP messages are divided into error-ICMP messages are divided into error-reporting messages and query messages. reporting messages and query messages. The error-reporting messages report The error-reporting messages report problems that a router or a host problems that a router or a host (destination) may encounter. The query (destination) may encounter. The query messages get specific information from a messages get specific information from a router or another host.router or another host.
TCP/IP Protocol Suite 5
Figure 9.4 General format of ICMP messages
All the ICMP messages are different. The only thing that iscommon amongst all is the first 4 bytes.
Type field tells what type of message (as we saw on the previous slide); Code field gives further information on the type of message.
TCP/IP Protocol Suite 6
9.3 ERROR REPORTING
IP, as an unreliable protocol, is not concerned with error checking and IP, as an unreliable protocol, is not concerned with error checking and error control. ICMP was designed, in part, to compensate for this error control. ICMP was designed, in part, to compensate for this shortcoming. shortcoming.
ICMP does not correct errors, it simply reports them.ICMP does not correct errors, it simply reports them.
ICMP always reports the message back to the source.ICMP always reports the message back to the source.
The topics discussed in this section include:The topics discussed in this section include:
Destination UnreachableDestination UnreachableSource QuenchSource QuenchTime ExceededTime ExceededParameter ProblemParameter ProblemRedirectionRedirection
TCP/IP Protocol Suite 7
Figure 9.5 Error-reporting messages
TCP/IP Protocol Suite 8
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 127.0.0.0 or 0.0.0.0.
Note:Note:
TCP/IP Protocol Suite 9
Figure 9.6 Contents of data field for the error messages
Destination Unreachable
When a router cannot route a datagram or a host cannotdeliver a datagram, the datagram is discarded and the routeror host sends a destination-unreachable ICMP message.
There are 15 different codes:network unreachable(0); host unreachable(1); protocol unreachable(2); port unreachable(3); fragmentation requiredbut DF bit set(4); source routing cannot be accomplished (5); destination network unknown(6); destination host unknown(7);source host isolated(8); communication with destination networkis prohibited(9); and six more
TCP/IP Protocol Suite 10
Figure 9.7 Destination-unreachable format
TCP/IP Protocol Suite 11
Destination-unreachable messages with codes 2 or 3 can be created only
by the destination host.
Other destination-unreachable messages can be created only by
routers.
Note:Note:
TCP/IP Protocol Suite 12
Figure 9.7 Destination-unreachable format
Example. The following IP packet has just been received.What is it telling us?
45 00 00 38 F2 3A 01 30 3F 01 01 3E 43 2A 04 CD
23 9A BC FE 03 03 1C 4F 00 00 00 00 ……..
TCP/IP Protocol Suite 13
Figure 9.7 Destination-unreachable format
Answer. The following IP packet has just been received.What is it telling us?
45 00 00 38 F2 3A 01 30 3F 01 01 3E 43 2A 04 CD
23 9A BC FE 03 03 1C 4F 00 00 00 00 ……..
IP: Ver=4; hlen=20; total len=56; …
ICMP: type=3; code=3; …
TCP/IP Protocol Suite 14
Figure 9.8 Source-quench format
There is no flow control mechanism in IP, so ICMP allows a router to tell a source to slow down (wejust discarded one of your datagrams because ourbuffers are full). This is source quench.
One source quench message is sent for each datagramdiscarded.
TCP/IP Protocol Suite 15
Figure 9.9 Time-exceeded message format
When a router decrements a Time-to-Live counter to zero,the datagram is tossed and a time-exceeded message isreturned to the source.
Likewise if a destination does not receive all the fragmentsin a set amount of time.
TCP/IP Protocol Suite 16
In a time-exceeded message, code 0 is used only by routers to show that the value of the time-to-live field is zero.
Code 1 is used only by the destination host to show that not all of the
fragments have arrived within a set time.
Note:Note:
TCP/IP Protocol Suite 17
Figure 9.9 Time-exceeded message format
Example. An IP packet was sent to a site that is unreachable.What is the IP packet that will be returned to the source?
TCP/IP Protocol Suite 18
Figure 9.10 Parameter-problem message format
A parameter problem message can be created by a routeror the destination host.
Code 0 - there is an error or ambiguity in one of the headerfields. Code 1 - the required part of an option is missing.
TCP/IP Protocol Suite 19
Figure 9.11 Redirection concept
Routers are constantly updating themselves with new routing information.
Not so with hosts. A host has to know where the nextrouter is too, but its table is usually static (for efficiency).
Host routing tables start off small, usually with only oneentry - the default router.
When the host sends a datagram to the wrong router(because its routing table is incomplete), the router thatreceives the datagram sends the datagram to the correct router AND sends a redirection message to the host.
The host uses this info to update its routing table.
TCP/IP Protocol Suite 20
Figure 9.11 Redirection concept
TCP/IP Protocol Suite 21
Figure 9.12 Redirection message format
TCP/IP Protocol Suite 22
9.4 QUERY
ICMP can also diagnose some network problems through the query ICMP can also diagnose some network problems through the query messages, a group of four different pairs of messages. In this type of messages, a group of four different pairs of messages. In this type of ICMP message, a node sends a message that is answered in a specific ICMP message, a node sends a message that is answered in a specific format by the destination node. format by the destination node.
The four different types of request and reply are:The four different types of request and reply are:
Echo Request and ReplyEcho Request and ReplyTimestamp Request and ReplyTimestamp Request and ReplyAddress-Mask Request and ReplyAddress-Mask Request and ReplyRouter Solicitation and AdvertisementRouter Solicitation and Advertisement
TCP/IP Protocol Suite 23
An echo-request message can be sent by a host or router. An echo-reply
message is sent by the host or router which receives an echo-request
message.
Note:Note:
TCP/IP Protocol Suite 24
Echo-request and echo-reply messages can be used by network managers to
check the operation of the IP protocol.
If a router returns a reply, then it and IP are working.
Note:Note:
TCP/IP Protocol Suite 25
Echo-request and echo-reply messages can test the reachability of a host. This
is usually done by invoking the ping command.
Note:Note:
TCP/IP Protocol Suite 26
Figure 9.14 Echo-request and echo-reply messages
Identifier field and Sequence number field are not usedand can be arbitrarily set by the sender.Identifier field is often the same as the process ID.
TCP/IP Protocol Suite 27
Timestamp-request and timestamp-reply messages can be used to
calculate the round-trip time between a source and a destination machine
even if their clocks are not synchronized.
Note:Note:
TCP/IP Protocol Suite 28
The timestamp-request and timestamp-reply messages can be used to synchronize two clocks in two
machines if the exact one-way time duration is known.
Note:Note:
TCP/IP Protocol Suite 29
Figure 9.15 Timestamp-request and timestamp-reply message format
Sending time = receive timestamp - original timestampReceiving time = returned time - transmit timeRound-trip time = sending time + receiving time
TCP/IP Protocol Suite 30
Figure 9.15 Timestamp-request and timestamp-reply message format
Example - An IP and ICMP packet comes back with thefollowing information:
Original timestamp = 46Receive timestamp = 59Transmit timestamp = 60Return time = 67
What is:Sending time =
Receiving time =
Round-trip time =
TCP/IP Protocol Suite 31
Figure 9.16 Address-mask-request and address-mask-reply message format
If a thin-client host does not know its IP mask, it mayissue an address-mask-request. Can also use BOOTP or DHCP to obtain this information.
Address mask is 0 in request message.
Identifier and Sequence number fields are not used.
TCP/IP Protocol Suite 32
Figure 9.17 Router-solicitation message format
How does a host find out what routers are connected to itsown network? Or if those routers are functioning? It can send out a router-solicitation message.
This can be broadcast on current network.
Identifier and Sequence number fields are not used.
TCP/IP Protocol Suite 33
Figure 9.18 Router-advertisement message format
If address preference = 0, then this should be the default router.
This is the reply that comes back from the previous request.Lifetime field shows the number of seconds that the entriesare considered to be valid.
TCP/IP Protocol Suite 34
Figure 9.18 Ping and Traceroute
Ping and Traceroute (in Unix) and Ping and Tracert in Microsoftboth use ICMP and its various options to perform.
For the Ping command, the source host sends ICMP echo requestmessages (type 8, code 0); the destination,if alive, respondswith ICMP echo reply messages.
TCP/IP Protocol Suite 35
9.7 ICMP PACKAGE
To give an idea of how ICMP can handle the sending and receiving of To give an idea of how ICMP can handle the sending and receiving of ICMP messages, we present our version of an ICMP package made of ICMP messages, we present our version of an ICMP package made of two modules: an input module and an output module. two modules: an input module and an output module.
The topics discussed in this section include:The topics discussed in this section include:
Input ModuleInput ModuleOutput ModuleOutput Module
TCP/IP Protocol Suite 36
Figure 9.21 ICMP package