+ All Categories
Home > Documents > McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Chapter 9 Internet Control Message Protocol...

McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Chapter 9 Internet Control Message Protocol...

Date post: 17-Dec-2015
Category:
Upload: karen-james
View: 218 times
Download: 2 times
Share this document with a friend
32
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 Chapter 9 Internet Control Message Protocol (ICMP)
Transcript

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Chapter 9

Internet ControlMessage Protocol

(ICMP)

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

ICMP(Internet Control Protocol)

About ICMP(Internet Control Message Protocol)

: RFC 792[ Postel 1981b]

• The IP provides an unreliable and connectionless datagram delivery.

• The IP protocol is a best-effort delivery service that deliverers a datagram from its original source to its final destination.

• The IP protocol has no error-reporting or error-correcting mechanism.

• It has two deficiencies: lake of error control, and lake of assistance mechanism.

• The Internet Control Message Protocol(ICMP) has been designed to compensate for the above two deficiencies.

• It is a companion to the IP protocol.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 9-1 Position of ICMP in the network layer

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 9-2 ICMP encapsulation

ICMP itself is a network layer protocol. However, its message are not passed directly to the data link layer as would be expected. Instead, the message are first encapsulated inside IP datagram before going to the lower layer.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 9-3 ICMP messages

9.1 TYPE OF MESSAGE

ICMP messages are divided into two broad categories: error-reporting message and query messages.

•The error-reporting messages report problems that a router or host(destination) may encounter when it processes an IP packet.

•The query messages help a host or a network manager get specific information from a router or another host.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

ICMP(Internet Control Protocol)

9.1 TYPE OF MESSAGE..

Category Type Message

Error-reporting

Messages

3 Destination unreachable

4 Source quench

11 Time exceeded

12 Parameter problem

5 Redirection

Category Type Message

Query

Messages

8 or 0 Echo request or reply

13 or 14 Timestamp request and reply

17 or 18 Address mask request and reply

10 or 9 Router solicitation and advertisement

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

ICMP(Internet Control Protocol)

9.2 MESSAGE FORMAT

• An ICMP message has an 8-byte header and a variable-size data section.

• The first four bytes are common to all.

• General format of the header is different for each message type.

• The code field specifies the reason for the particular message type.

• The last common field is the checksum field.

• The rest of the header is specific for each message type.

• The data section in err message carries information for finding the original packet which caused the error.

• In query messages, the data section carries extra information based on the type of the query.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 9-4 General format of ICMP messages

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

ICMP(Internet Control Protocol)

9.3 ERROR REPORTING• ICMP always reports error message to the original source.

• Five types of errors are handled:

– destination unreachable

– Source quench

– Time exceeded

– Parameter problem

– Redirection Figure 9-5 Error-reporting messages

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

ICMP(Internet Control Protocol)

9.3 ERROR REPORTING..

The following are important point 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.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 9-6 Contents of data field for the error messages.

All error messages contain a data section that include the IP header original datagram plus the first eight bytes of data in that datagram.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 9-7 Destination unreachable format

Destination Unreachable

When a router cannot route a datagram or a host cannot deliver a datagram, the datagram is discarded and the router or the host sends a destination unreachable message back to the source host that initiated the datagram.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

ICMP(Internet Control Protocol)

Destination Unreachable

The code field for this for this type specifies the reason for discarding the datagram:

• Code 0: The network is unreachable.

• Code 1: The host is unreachable.

• Code 2: The protocol is unreachable.

• Code 3: The port is unreachable.

• Code 4: Fragmentation is required, but the DF(do not fragment)field of the datagram ha been set.

• Code 5: Source routing cannot be accomplished.

• Code 6: The destination network is unknown.

• Code 7: The destination host is unknown.

• Code 8: The source host is isolated.

• Code 9: Communication with the destination network is administratively prohibited.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

ICMP(Internet Control Protocol)

Destination Unreachable

• Code 10: Communication with the destination host is administratively prohibited.

• Code 11: The network is unreachable for the specified type of service.

• Code 12: The host is unreachable for the specified type of service.

• Code 13: The host is unreachable because the administration has put a filter on it.

• Code 14: The host is unreachable because the host precedence is violated.

• Code 15: The host is unreachable because its precedence was cut off.

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.

A router cannot detect all problems that prevent the delivery of a packet.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

ICMP(Internet Control Protocol)

Source Quench

• IP does not have a flow-control mechanism embedded in the protocol.

• The lake of flow control can create a major problem in the operation. Of IP: congestion.

• A source-quench message informs the source that a datagram has been discarded due to congestion in a router or the destination host. The source must slow down the sending of datagrams until the congestions is relieved.

• One source-quench message should be sent for each datagram is discarded due to congestion.

Figure 9-8 Source-quench format

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 9-9 Time-exceeded message format

ICMP(Internet Control Protocol)

Time Exceeded

The time-exceeded message is generated in two cases; • First: Whenever a router receives a datagram whose time-to-live field has the value of zero, it

discards the datagram and sends a time-exceeded message to the original source.

• Second: When the final destination does not receive all of the fragments in a set time, it discards

the received fragments and send a time-exceeded message to the original source.

• In a time-exceeded message,

• Code 0 : It is used only by routers to show that the value of the time-to-live field is zero.

• Code 1: It is used only by the destination host to show that not all of the fragments have

arrived within a set time.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 9-10 Parameter-problem message format.

Parameter Problem Parameter-problem message can be created by a router or the destination host.

The code field in this case specifies the reason for discarding the datagram and shows exactly what has failed: • In a parameter-problem message,

• Code 0 : There is error or ambiguity in one of the header fields. In this case, the value in the

pointer field points to the byte with the problem.

• Code 1: The required part of an option is missing. In this case, the pointer is not used.

ICMP(Internet Control Protocol)

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

RedirectionA host usually starts with a small routing table that is gradually augmented and updated. One of the tools to accomplish this is the redirection message.

A redirection message is sent from a router to a host on the same local network.

ICMP(Internet Control Protocol)

Figure 9-11 Redirection concept

Routing table is updated

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 9-12 Redirection message format.

The code field for redirection message narrows down the redirection:

•Code 0: Redirection for the network-specific route.

• Code 1: Redirection for host-specific route.

• Code 2: Redirection for network-specific route base on the specific type of service.

• Code 3: Redirection for host-specific route base on the specific type of service.

ICMP(Internet Control Protocol)

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

ICMP(Internet Control Protocol)

9.4 QUERY• In addition to error reporting, ICMP can also diagnose some network problem. This is

accomplished through the query message, a group of four different pairs of messages.

• Note that originally two other types of message (information request and information reply) were defined, but they are now obsolete.

• They were designed to allow a host to get its Internet address at startup; RARP, BOOTP

Figure 9-13 Query messages

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

ICMP(Internet Control Protocol)

Echo Request and Reply

• Network manager and user utilize this pair of message to identify network problems.• The combination of echo-request and echo-reply messages determines whether two

systems(hosts or router) can communicate with each other.• An echo-request message can be sent a host or router. An echo-reply message is sent by

the host or router which receives an echo-request message.• Echo-request and echo-reply massage can be used by network managers to check the

operation of the IP protocol.• Echo-request and echo-reply massage can test the reachability of a host. This is usually

done by invoking the ping command.

Figure 9-14 Echo-request and echo-reply messages

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

ICMP(Internet Control Protocol)

Timestamp Request and Reply

• Two machines (host or routers) can use the timestamp-request and timestamp-reply message to determine the round-trip time need for an IP datagram to travel between them.

• It can also be used to synchronize the clock in two machines.

• The source creates a timestamp-request message.

– The source fills the original timestamp field with the Universal Time shown by its clock at departure time.

– The other two timestamp fields are filled zeros.

• The destination creates a timestamp-reply message.

– The destination copies the original timestamp value from the request message into the same field its reply message.

– It fills the receive timestamp field with the Universal Time shown by its clock at the time the request was received.

– It fills the transmit timestamp field with the Universal Time shown by its clock at the time the reply message departs.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

ICMP(Internet Control Protocol)

Timestamp Request and Reply..

Sending time = value of receive timestamp – value of original timestamp

Receiving time = time the packet returned – value of transmit timestamp

Round-trip time = sending time + receiving time

• Timestamp-request and timestamp-reply messages can be used to measure the round-trip time

between a source and a destination machine even if there clocks are not synchronized.

• 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.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 9-15 Timestamp-request and timestamp-reply message format

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

ICMP(Internet Control Protocol)

Address Mask Request and Reply• To obtain mask, a host sends an address-mask-request message to a router on the LAN.

– If the host knows the address of the router It sends the request directly to the router.

– If it does not know Broadcasts the message.

• The address-mask field is filled with zeros in the request message.

• When the router sends the address-mask reply back to the host, this field contains the actual mask.

• Another way to get subnet mask information is through the use of the BOOTP protocol.

Figure 9-16 Mask-request and mask-reply message format.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

ICMP(Internet Control Protocol)

Router Solicitation and Advertisement

Router Solicitation message• A host can broadcast (or multicast) a router-solicitation message.

• The router or routers that receive the solicitation message broadcast their routing information using the router-advertisement message.

Figure 9-17 Router-solicitation message format

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

ICMP(Internet Control Protocol)

Router Solicitation and Advertisement ..

Router Advertisement message• Each router entry in the advertisement contains at least two fields:

– The router address

– The address preference level.: It is zero That router is considered the default router.

Figure 9-18 Router-advertisement message format

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

ICMP(Internet Control Protocol)

9.5 CHECKSUM• In ICMP the checksum is calculated over the entire message (header and data).

Checksum CalculationThe sender follows these steps using one’s complement arithmetic:

1. The checksum field is set zero.

2. The sum of all the 16-bit words(header and data) is calculated.

3. The sum is complemented to get the checksum.

4. The checksum is stored in the checksum field.

Checksum TestingThe sender follows these steps using one’s complement arithmetic:

1. The sum of all word (header and data) is calculated.

2. The sum is complemented.

3. If the result obtained in step 2 is 10 0s, the message is accepted; otherwise, it is rejected.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 9-19 Example of checksum calculation

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

ICMP(Internet Control Protocol)

9.6 ICMP DESIGN In this design, the ICMP package is made of two modules: an input module and an output

module.Figure 9-20 ICMP design

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

ICMP(Internet Control Protocol)

Input Module

Receive: an ICMP packet from the IP layer.

1. If (the type is any of the three request types)1. Create a reply2. Send the reply.

2. If (the type is a router solicitation)1. If (station is a router)

1. Create a router advertisement.2. Send the advertisement.

3. If (the type is one of the three reply message or router advertisement)1. Extract information in the data section of the packet.2. Deliver extracted information to the process that request it.

4. If (the type defines a redirection)1. Modify the routing table.

5. If (the type defines an error message other than a redirection)1. Inform the appropriate source protocol about the situation.

6. Return.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

ICMP(Internet Control Protocol)

Output ModuleReceive: a demand

1. If (the demand defines an error message)

1. If (the demand is from IP)

1. If (the demand is forbidden)

1. Return

2. If (the type defines a redirection message)

1. If (the station is not a router)

1. Return

3. Create the error message using the type, the code, and the IP packet.

2. If (the demand defines a request or solicitation)

1. Create a request or solicitation message

3. Send the message.

4. Return.


Recommended