admin管理员组

文章数量:1531218

2024年3月22日发(作者:)

Network Working Group J. Postel

Request for Comments: 792 ISI

September 1981

Updates: RFCs 777, 760

Updates: IENs 109, 128

INTERNET CONTROL MESSAGE PROTOCOL

DARPA INTERNET PROGRAM

PROTOCOL SPECIFICATION

网络工作组

RFC792科学信息研究所(ISI)

1981年9月撰

更新:RFCs 777,760

更新:IENs 109,128

网际消息控制协议(ICMP)

DARPA的网络程序(DARPA美国国防部高等研究计划局)

协议草案

Introduction

The Internet Protocol (IP) [1] is used for host-to-host datagram

service in a system of interconnected networks called the

Catenet [2]. The network connecting devices are called Gateways.

These gateways communicate between themselves for control purposes

via a Gateway to Gateway Protocol (GGP) [3,4]. Occasionally a

gateway or destination host will communicate with a source host, for

example, to report an error in datagram processing. For such

purposes this protocol, the Internet Control Message Protocol (ICMP),

is used. ICMP, uses the basic support of IP as if it were a higher

level protocol, however, ICMP is actually an integral part of IP, and

must be implemented by every IP module.

简介

IP协议[1]被用于一个被叫做Catenet[2]的互联网络系统中的点对点数据报(datagram)服务。

网络的连接设备被叫做网关(Gateways)。这些网关之间通过GGP协议[3,4]进行通信以达到控制的目的。

偶尔一个网关或者目的主机要与源主机进行通信,比如像源主机报告一个处理数据报过程中产生的错误。

为了达到这样的目的,网际消息控制(ICMP)协议被应用。ICMP以IP协议作为底层支持,看上去就想ICMP

是在 IP协议的上层,

但实际上,ICMP是IP协议整体的一部分,而且必须被每个IP模块实现。

ICMP messages are sent in several situations: for example, when a

datagram cannot reach its destination, when the gateway does not have

the buffering capacity to forward a datagram, and when the gateway

can direct the host to send traffic on a shorter route.

ICMP消息在一些情况下被发送:

1.当一个数据报不能到达目的地时;

2.当网关失去缓冲能力时;

3.当网关能够引导主机在更短路由上发送时。

The Internet Protocol is not designed to be absolutely reliable. The

purpose of these control messages is to provide feedback about

problems in the communication environment, not to make IP reliable.

There are still no guarantees that a datagram will be delivered or a

control message will be returned. Some datagrams may still be

undelivered without any report of their loss. The higher level

protocols that use IP must implement their own reliability procedures

if reliable communication is required.

IP协议并不绝对可靠,控制消息也只是对通信环境的问题反馈而已,不能使IP协议可靠。而且

不能保证一条数据报能够被交付或者一条控制消息被返回。一些数据报可能仍然在没有任何的丢

失报告情况下未被交付。如果需要可靠通信的话,就要求那些使用IP协议的高层协议自己来实现

他们自己的可靠性步骤(reliability procedures)。

The ICMP messages typically report errors in the processing of

datagrams. To avoid the infinite regress of messages about messages

etc., no ICMP messages are sent about ICMP messages. Also ICMP

messages are only sent about errors in handling fragment zero of

fragemented datagrams. (Fragment zero has the fragment offeset equal

zero).

ICMP消息一般是用来报告数据报处理过程中的错误的。为了避免消息无休止的返回(消息递归),

对于ICMP消息的错误就不再返回ICMP消息了。而且ICMP消息只在处理数据报偏移量为0时发送。

Message Formats

ICMP messages are sent using the basic IP header. The first octet of

the data portion of the datagram is a ICMP type field; the value of

this field determines the format of the remaining data. Any field

labeled "unused" is reserved for later extensions and must be zero

when sent, but receivers should not use these fields (except to

include them in the checksum). Unless otherwise noted under the

individual format descriptions, the values of the internet header

fields are as follows:

Version

4

IHL

Internet header length in 32-bit words.

Type of Service

0

Total Length

Length of internet header and data in octets.

Identification, Flags, Fragment Offset

Used in fragmentation, see [1].

Time to Live

Time to live in seconds; as this field is decremented at each

machine in which the datagram is processed, the value in this

field should be at least as great as the number of gateways which

this datagram will traverse.

Protocol

ICMP = 1

Header Checksum

The 16 bit one's complement of the one's complement sum of all 16

bit words in the header. For computing the checksum, the checksum

field should be zero. This checksum may be replaced in the

future.

Source Address

The address of the gateway or host that composes the ICMP message.

Unless otherwise noted, this can be any of a gateway's addresses.

Destination Address

The address of the gateway or host to which the message should be

sent.

消息格式

ICMP消息基于IP报头发送,数据报的数据部分的第一个字节是ICMP类型字段;这个字段的值

决定了剩余数据的格式。任何标示为“unused”的字段为保留以后扩展,并且发送前必须置零,

但是接受者不必使用这些字段(除了校验时)。除非另有个别格式说明,IP头部字段的值如下:

version(4bit)

4

IHL

IP报头长度(以32bit为单位)

Type of Service

0

Total Length

IP报头和数据总长度(以字节为单位)

Identification,Flags,Fragment Offset

用于碎片,详看【1】

Time to Live

存活时间(按秒计) ;这个字段在处理数据报的机器上被减小,这个字段的值应该不小于该数据报要通过的网

关数目。

Protocol

协议字段,标示封装的数据部分的协议类型,ICMP=1;

Header Checksum

校验和(计算方法:报头的所有16位二进制数的反码的和的反码)。为了计算校验和,该字段应该清零。这

个校验和可能在将来被取代。

Source Address

构成ICMP消息的网关或主机的地址,除非说明,它可以是任何网关的地址。

Destinations Address

消息要被发送到的网关或主机地址。

Destination Unreachable Message

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Type | Code | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| unused |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Internet Header + 64 bits of Original Data Datagram |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields:

Destination Address

The source network and address from the original datagram's data.

ICMP Fields:

Type

3

Code

0 = net unreachable;

1 = host unreachable;

2 = protocol unreachable;

3 = port unreachable;

4 = fragmentation needed and DF set;

5 = source route failed.

Checksum

The checksum is the 16-bit ones's complement of the one's

complement sum of the ICMP message starting with the ICMP Type.

For computing the checksum , the checksum field should be zero.

This checksum may be replaced in the future.

Internet Header + 64 bits of Data Datagram

The internet header plus the first 64 bits of the original

datagram's data. This data is used by the host to match the

message to the appropriate process. If a higher level protocol

uses port numbers, they are assumed to be in the first 64 data

bits of the original datagram's data.

Description

If, according to the information in the gateway's routing tables,

the network specified in the internet destination field of a

datagram is unreachable, e.g., the distance to the network is

infinity, the gateway may send a destination unreachable message

to the internet source host of the datagram. In addition, in some

networks, the gateway may be able to determine if the internet

destination host is unreachable. Gateways in these networks may

send destination unreachable messages to the source host when the

destination host is unreachable.

If, in the destination host, the IP module cannot deliver the

datagram because the indicated protocol module or process port is

not active, the destination host may send a destination

unreachable message to the source host.

Another case is when a datagram must be fragmented to be forwarded

by a gateway yet the Don't Fragment flag is on. In this case the

gateway must discard the datagram and may return a destination

unreachable message.

Codes 0, 1, 4, and 5 may be received from a gateway. Codes 2 and

3 may be received from a host.

目的不可达消息(DESTINATION UNREACHABLE MESSAGE)格式

格式:

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Type | Code | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| unused |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Internet Header + 64 bits of Original Data Datagram |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP字段:

目的地址

发送原始数据报的网络地址

ICMP字段:

Type :3

Code:

0=网络不可达(net unreachable)

1=主机不可达(hostunreachable

2= 协议不可达(protocolunreachable

3=端口不可达(portunreachable

4=需要分片和DF设置(fragmentationneeded andDF set

5=源路由不失败source route failed

Checksum

校验和(计算方法:报头的所有16位二进制数的反码的和的反码)。为了计算校验和,该

字段应该清零。这个校验和可能在将来被取代。

Internet Header + 64 bits of Data Datagram

Internet报头加上原始数据报数据部分的前64bits。该数据被主机用于匹配消息到相应的

进程中。如果一个上层协议使用端口号,则这个端口号被认为是在这原始数据报数据部分

的前64bits中。

详细描述

根据网关路由表的信息,如果一条网络中的数据报的目的地址字段指定的网络不可到达,

比如说是网络的距离是极远的,网关可能对于这条数据报发送一个目的不可达消息给源主

机,另外,在一些网络中,网关可能会决定是否网络目的主机是否是不可达的。当目的主

机不可到达时,在这些网络中的网关会发送目的不可达消息给源主机。

如果由于指定的协议模块或者进程端口没有激活的原因,目的主机的IP模块无法交付数

据报,目的主机会发送目的主机不可达消息给源主机。

另一种情况是当数据报必须被网关进行分片转发但没有设置分片标志。在这种情况下,

网关会抛弃数据报,并返回目的地不可达消息。

Codes 为0,1,4,5 的消息来自于网关,Codes 为2,3的消息来自于目的主机。

Time Exceeded Message

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Type | Code | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| unused |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Internet Header + 64 bits of Original Data Datagram |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields:

Destination Address

The source network and address from the original datagram's data.

ICMP Fields:

Type

11

Code

0 = time to live exceeded in transit;

1 = fragment reassembly time exceeded.

Checksum

The checksum is the 16-bit ones's complement of the one's

complement sum of the ICMP message starting with the ICMP Type.

For computing the checksum , the checksum field should be zero.

This checksum may be replaced in the future.

Internet Header + 64 bits of Data Datagram

The internet header plus the first 64 bits of the original

datagram's data. This data is used by the host to match the

message to the appropriate process. If a higher level protocol

uses port numbers, they are assumed to be in the first 64 data

bits of the original datagram's data.

Description

If the gateway processing a datagram finds the time to live field

is zero it must discard the datagram. The gateway may also notify

the source host via the time exceeded message.

If a host reassembling a fragmented datagram cannot complete the

reassembly due to missing fragments within its time limit it

discards the datagram, and it may send a time exceeded message.

If fragment zero is not available then no time exceeded need be

sent at all.

Code 0 may be received from a gateway. Code 1 may be received

from a host.

超时消息(TIME EXCEEDED MESSAGE)格式

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Type | Code | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| unused |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Internet Header + 64 bits of Original Data Datagram |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Type(8)Code(8)Checksum(16)

unused(32)

Internet Header + 64 bits of Original Data Datagram(32)

IP Fields:

目的地址

发送原始数据报的网络地址

ICMP FIELDS:

Type

11

Code

0=传送超时

1=分片重组超时

Checksum

校验和(计算方法:报头的所有16位二进制数的反码的和的反码)。为了计算校验和,该

字段应该清零。这个校验和可能在将来被取代。

Internet Header + 64 bits of Data Datagram

Internet报头加上原始数据报数据部分的前64bits。该数据被主机用于匹配消息到相应

的进程中。如果一个上层协议使用端口号,则这个端口号被认为是在这原始数据报数据部

分的前64bits中。

详细描述

如果网关在处理数据报过程中发现TTL值为0,则立刻丢弃这个数据报。网关也会给源主机

发送一条超时消息(Time Exceeded message)。

如果一台主机由于在时间限制下无法丢失分片而无法完成重组一条分片的数据报时,主机

会丢掉数据报并发送超时消息给源主机。

如果分片0不可用,不发送超时消息。

Code 0 来自于网关,Code 1 来自主机。

Parameter Problem Message

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Type | Code | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Pointer | unused |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Internet Header + 64 bits of Original Data Datagram |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields:

Destination Address

The source network and address from the original datagram's data.

ICMP Fields:

Type

12

Code

0 = pointer indicates the error.

Checksum

The checksum is the 16-bit ones's complement of the one's

complement sum of the ICMP message starting with the ICMP Type.

For computing the checksum , the checksum field should be zero.

This checksum may be replaced in the future.

Pointer

If code = 0, identifies the octet where an error was detected.

Internet Header + 64 bits of Data Datagram

The internet header plus the first 64 bits of the original

datagram's data. This data is used by the host to match the

message to the appropriate process. If a higher level protocol

uses port numbers, they are assumed to be in the first 64 data

bits of the original datagram's data.

September 1981

RFC 792

Description

If the gateway or host processing a datagram finds a problem with

the header parameters such that it cannot complete processing the

datagram it must discard the datagram. One potential source of

such a problem is with incorrect arguments in an option. The

gateway or host may also notify the source host via the parameter

problem message. This message is only sent if the error caused

the datagram to be discarded.

The pointer identifies the octet of the original datagram's header

where the error was detected (it may be in the middle of an

option). For example, 1 indicates something is wrong with the

Type of Service, and (if there are options present) 20 indicates

something is wrong with the type code of the first option.

Code 0 may be received from a gateway or a host.

参数错误消息(PARAMETER PROBLEM MESSAGE)

格式如下:

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Type | Code | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Pointer | unused |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Internet Header + 64 bits of Original Data Datagram |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields:

目的地址

发送原始数据报的网络地址

ICMP FIELDS:

Type:

12

Code

0=指针指向错误。

Checksum

校验和(计算方法:报头的所有16位二进制数的反码的和的反码)。为了计算校验和,

该字段应该清零。这个校验和可能在将来被取代。

Pointer

如果code=0,表明检测到字节的一个错误。

Internet Header + 64 bits of Data Datagram

Internet报头加上原始数据报数据部分的前64bits。该数据被主机用于匹配消息到相应

的进程中。如果一个上层协议使用端口号,则这个端口号被认为是在这原始数据报数据部

分的前64bits中。

详细描述

如果正在处理一个数据报的网关或者主机发现一个头部参数的错误,则会无法完成数据报

的处理,必须丢弃该数据报。这种潜在的问题可以是变量的错误。网关或主机将通过参数问

题消息通知源主机,此消息只有在消息被抛弃时才被发送。

指针指向发现错误的数据报包头字节(可能是选项的中间)。例如,1表明服务类型错误,

如果有选项的话,20表示第一个选项的类型有错误。

Code 0 可以来自主机或网关。

Source Quench Message

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Type | Code | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| unused |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Internet Header + 64 bits of Original Data Datagram |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields:

Destination Address

The source network and address of the original datagram's data.

ICMP Fields:

Type

4

Code

0

Checksum

The checksum is the 16-bit ones's complement of the one's

complement sum of the ICMP message starting with the ICMP Type.

For computing the checksum , the checksum field should be zero.

This checksum may be replaced in the future.

Internet Header + 64 bits of Data Datagram

The internet header plus the first 64 bits of the original

datagram's data. This data is used by the host to match the

message to the appropriate process. If a higher level protocol

uses port numbers, they are assumed to be in the first 64 data

bits of the original datagram's data.

Description

A gateway may discard internet datagrams if it does not have the

buffer space needed to queue the datagrams for output to the next

network on the route to the destination network. If a gateway

discards a datagram, it may send a source quench message to the

internet source host of the datagram. A destination host may also

send a source quench message if datagrams arrive too fast to be

processed. The source quench message is a request to the host to

cut back the rate at which it is sending traffic to the internet

destination. The gateway may send a source quench message for

every message that it discards. On receipt of a source quench

message, the source host should cut back the rate at which it is

sending traffic to the specified destination until it no longer

receives source quench messages from the gateway. The source host

can then gradually increase the rate at which it sends traffic to

the destination until it again receives source quench messages.

The gateway or host may send the source quench message when it

approaches its capacity limit rather than waiting until the

capacity is exceeded. This means that the data datagram which

triggered the source quench message may be delivered.

Code 0 may be received from a gateway or a host.

源抑制消息(SOURCE QUENCH MESSAGE)

格式如下:

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Type | Code | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| unused |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Internet Header + 64 bits of Original Data Datagram |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Type(8)Code(8)Checksum(16)

unused(32)

Internet Header + 64 bits of Origninal Data Datagram(32)

IP Fields:

目的地址

发送原始数据报的网络地址

ICMP FIELDS:

Type:

4

Code

0

Checksum

校验和(计算方法:报头的所有16位二进制数的反码的和的反码)。为了计算校验和,

该字段应该清零。这个校验和可能在将来被取代。

Internet Header + 64 bits of Data Datagram

Internet报头加上原始数据报数据部分的前64bits。该数据被主机用于匹配消息到相应

的进程中。如果一个上层协议使用端口号,则这个端口号被认为是在这原始数据报数据部

分的前64bits中。

详细描述

当网关的缓冲队列中没有缓冲空间时它会丢弃该数据报,如果网关丢弃了一个数据报,

它会发送一个源拥塞消息给源主机。如果数据报到达的太快而使得目的主机无法及时处理,

也会发送一个源拥塞消息给源主机。源拥塞消息会要求源主机减慢发送数据报的速率。网

关会为每条丢弃的数据报发送一条源拥塞消息。在接到此消息后,源主机应该减慢发送速

率,直到不再接收到来自该网关的源拥塞消息。源主机逐渐的增长发送速率直到又收到源

拥塞消息。

网关或主机会发送源拥塞消息当它接近其容量极限,而不是等到能力超过。这就意味着那

条触发源拥塞消息的数据报可能被交付了。

Code 0 可能来自于网关或主机。

Redirect Message

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Type | Code | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Gateway Internet Address |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Internet Header + 64 bits of Original Data Datagram |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields:

Destination Address

The source network and address of the original datagram's data.

ICMP Fields:

Type

5

Code

0 = Redirect datagrams for the Network.

1 = Redirect datagrams for the Host.

2 = Redirect datagrams for the Type of Service and Network.

3 = Redirect datagrams for the Type of Service and Host.

Checksum

The checksum is the 16-bit ones's complement of the one's

complement sum of the ICMP message starting with the ICMP Type.

For computing the checksum , the checksum field should be zero.

This checksum may be replaced in the future.

Gateway Internet Address

Address of the gateway to which traffic for the network specified

in the internet destination network field of the original

datagram's data should be sent.

Internet Header + 64 bits of Data Datagram

The internet header plus the first 64 bits of the original

datagram's data. This data is used by the host to match the

message to the appropriate process. If a higher level protocol

uses port numbers, they are assumed to be in the first 64 data

bits of the original datagram's data.

Description

The gateway sends a redirect message to a host in the following

situation. A gateway, G1, receives an internet datagram from a

host on a network to which the gateway is attached. The gateway,

G1, checks its routing table and obtains the address of the next

gateway, G2, on the route to the datagram's internet destination

network, X. If G2 and the host identified by the internet source

address of the datagram are on the same network, a redirect

message is sent to the host. The redirect message advises the

host to send its traffic for network X directly to gateway G2 as

this is a shorter path to the destination. The gateway forwards

the original datagram's data to its internet destination.

For datagrams with the IP source route options and the gateway

address in the destination address field, a redirect message is

not sent even if there is a better route to the ultimate

destination than the next address in the source route.

Codes 0, 1, 2, and 3 may be received from a gateway.

重定向消息(REDIRECT MESSAGE)

格式如下:

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Type | Code | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Gateway Internet Address |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Internet Header + 64 bits of Original Data Datagram |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Type(8)Code(8)Checksum(16)

Gateway Internet Address(32)

Internet Header + 64 bits of Origninal Data Datagram(32)

IP Fields:

目的地址

发送原始数据报的网络地址

ICMP FIELDS:

Type:

5

Code

0 =重定向网络数据报

1=重定向主机数据报

2=重定向网络和服务类型的数据报

3=重定向主机和服务类型的数据报

Checksum

校验和(计算方法:报头的所有16位二进制数的反码的和的反码)。为了计算校验和,

该字段应该清零。这个校验和可能在将来被取代。

Gateway Internet Address

网关的Internet地址在网络中传输的数据报中的目的网络字段被指定,这个网关

Internet地址应该被发送。

Internet Header + 64 bits of Data Datagram

Internet报头加上原始数据报数据部分的前64bits。该数据被主机用于匹配消息到相应

的进程中。如果一个上层协议使用端口号,则这个端口号被认为是在这原始数据报数据部

分的前64bits中。

详细描述

网关在如下情况下会发送重定向消息到一台主机:

1.网关G1收到一条来自其关联网络中的主机的Internet数据报;

2.网关G1检查其路由表获取从路由器上到数据报中指定的目的网络地址的网络X的

下一个网关地址;

3.如果G2和目的主机被网络源地址的数据报指定在同一个网络上,网关会发送一条

重定向消息到目的主机;重定向消息建议这台主机发送直接将数据报发送到网关

G2,因为这样会接近于目的主机。最后这个网关将原始数据报转发给其网络目的

地。

注意:对于那些在目的地址域中携带IP源路由选项和网关地址的数据报来说,网关不会

发送任何重定向消息,即使有更好的路线到达目的地。

Code 0,1,2,和3 可能来自于网关。

Echo or Echo Reply Message

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Type | Code | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Identifier | Sequence Number |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Data ...

+-+-+-+-+-

IP Fields:

Addresses

The address of the source in an echo message will be the

destination of the echo reply message. To form an echo reply

message, the source and destination addresses are simply reversed,

the type code changed to 0, and the checksum recomputed.

IP Fields:

Type

8 for echo message;

0 for echo reply message.

Code

0

Checksum

The checksum is the 16-bit ones's complement of the one's

complement sum of the ICMP message starting with the ICMP Type.

For computing the checksum , the checksum field should be zero.

If the total length is odd, the received data is padded with one

octet of zeros for computing the checksum. This checksum may be

replaced in the future.

Identifier

If code = 0, an identifier to aid in matching echos and replies,

may be zero.

Sequence Number

If code = 0, a sequence number to aid in matching echos and

replies, may be zero.

Description

The data received in the echo message must be returned in the echo

reply message.

The identifier and sequence number may be used by the echo sender

to aid in matching the replies with the echo requests. For

example, the identifier might be used like a port in TCP or UDP to

identify a session, and the sequence number might be incremented

on each echo request sent. The echoer returns these same values

in the echo reply.

Code 0 may be received from a gateway or a host.

回送或回送应答消息

格式如下:

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Type | Code | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Identifier | Sequence Number |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Data ...

+-+-+-+-+-

IP Fields:

目的地址

发送原始数据报的网络地址

ICMP FIELDS:

Type:

0 =回送消息

8=回送应答消息

Code

0

Checksum

校验和(计算方法:报头的所有16位二进制数的反码的和的反码)。为了计算校验和,

该字段应该清零。这个校验和可能在将来被取代。

Gateway Internet Address

网关的Internet地址在网络中传输的数据报中的目的网络字段被指定,这个网关

Internet地址应该被发送。

Identifier标识符

如果 code=0,标识符以帮助匹配回送和应答,可是是0;

Sequence Number序列号

如果code=0,序列号帮助匹配回送和应答,可以是0。

详细描述

从回送消息中接受到的数据必须在回应消息中返回。

标识符和序列号可能被回送发送者应用到来帮助匹配应答回送请求。例如,标识符可能

像在TCP或UDP中的端口那样被用作表示一个会话,序列号可能在每次回显请求中递增。

回显发送者会在回显应答消息中返回这些相同值。

Code 0 可能来自于网关或主机。

Timestamp or Timestamp Reply Message

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Type | Code | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Identifier | Sequence Number |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Originate Timestamp |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Receive Timestamp |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Transmit Timestamp |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields:

Addresses

The address of the source in a timestamp message will be the

destination of the timestamp reply message. To form a timestamp

reply message, the source and destination addresses are simply

reversed, the type code changed to 14, and the checksum

recomputed.

ICMP Fields:

Type

13 for timestamp message;

14 for timestamp reply message.

Code

0

Checksum

The checksum is the 16-bit ones's complement of the one's

complement sum of the ICMP message starting with the ICMP Type.

For computing the checksum , the checksum field should be zero.

This checksum may be replaced in the future.

Identifier

If code = 0, an identifier to aid in matching timestamp and

replies, may be zero.

Sequence Number

If code = 0, a sequence number to aid in matching timestamp and

replies, may be zero.

Description

The data received (a timestamp) in the message is returned in the

reply together with an additional timestamp. The timestamp is 32

bits of milliseconds since midnight UT. One use of these

timestamps is described by Mills [5].

The Originate Timestamp is the time the sender last touched the

message before sending it, the Receive Timestamp is the time the

echoer first touched it on receipt, and the Transmit Timestamp is

the time the echoer last touched the message on sending it.

If the time is not available in miliseconds or cannot be provided

with respect to midnight UT then any time can be inserted in a

timestamp provided the high order bit of the timestamp is also set

to indicate this non-standard value.

The identifier and sequence number may be used by the echo sender

to aid in matching the replies with the requests. For example,

the identifier might be used like a port in TCP or UDP to identify

a session, and the sequence number might be incremented on each

request sent. The destination returns these same values in the

reply.

Code 0 may be received from a gateway or a host.

时间戳和时间戳应答消息(TIMESTAMP OR TIMESTAMP REPLY MESSAGE)

格式如下:

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Type | Code | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Identifier | Sequence Number |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Originate Timestamp |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Receive Timestamp |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Transmit Timestamp |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields:

目的地址

时间戳消息的源地址将是时间戳应答消息的目的地址。为了构建一个时间戳应答消息,

源地址胡目的地址要保留,类型代码修改为14,并且重新计算校验和。

ICMP FIELDS:

Type:

13 =时间戳消息

14=时间戳应答消息

Code

0

Checksum

校验和(计算方法:报头的所有16位二进制数的反码的和的反码)。为了计算校验和,

该字段应该清零。这个校验和可能在将来被取代。

Gateway Internet Address

网关的Internet地址在网络中传输的数据报中的目的网络字段被指定,这个网关

Internet地址应该被发送。

Identifier标识符

如果 code=0,标识符以帮助匹配时间戳和应答,可是是0;

Sequence Number序列号

如果code=0,序列号帮助匹配时间戳和应答,可以是0。

详细描述

从时间戳中接收到的数据将会在应答消息中结合另一个时间戳一起返回。时间戳是一午

夜格林威治时间开始的32位的毫秒数。时间戳的应用之一在Mills【5】中有描述。

起始时间戳是指发送者在发送消息前最有一次接触该消息的时间,接收时间戳是指接收

者第一次接触到该消息的时间,传输时间戳是指回送者发送回显消息之前最后一次接触该

消息的时间。

如果时间是的毫秒值无效或者不能提供可信的午夜的格林威治时间则可以在时间戳的高

字节填充入数据以表示这不是标准数据。

标识符和序列号可能被回显发送者应用到以帮助匹配请求的应答。例如,标识符可能像

在TCP或UDP中的端口那样被用作表示一个会话,序列号可能在每次回显请求中递增。回显

发送者会在回显应答消息中返回这些相同值。

Code 0 可能来自于网关或主机。

Information Request or Information Reply Message

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Type | Code | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Identifier | Sequence Number |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields:

Addresses

The address of the source in a information request message will be

the destination of the information reply message. To form a

information reply message, the source and destination addresses

are simply reversed, the type code changed to 16, and the checksum

recomputed.

IP Fields:

Type

15 for information request message;

16 for information reply message.

Code

0

Checksum

The checksum is the 16-bit ones's complement of the one's

complement sum of the ICMP message starting with the ICMP Type.

For computing the checksum , the checksum field should be zero.

This checksum may be replaced in the future.

Identifier

If code = 0, an identifier to aid in matching request and replies,

may be zero.

Sequence Number

If code = 0, a sequence number to aid in matching request and

replies, may be zero.

Description

This message may be sent with the source network in the IP header

source and destination address fields zero (which means "this"

network). The replying IP module should send the reply with the

addresses fully specified. This message is a way for a host to

find out the number of the network it is on.

The identifier and sequence number may be used by the echo sender

to aid in matching the replies with the requests. For example,

the identifier might be used like a port in TCP or UDP to identify

a session, and the sequence number might be incremented on each

request sent. The destination returns these same values in the

reply.

Code 0 may be received from a gateway or a host.

信息请求和时信息应答消息(INFORMATION REQUEST OR INFORMATION REPLY MESSAGE)

格式如下:

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Type | Code | Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Identifier | Sequence Number |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields:

目的地址

在信息请求消息中的源地址就是信息应答消息的目的地址。为了构建一个信息应答消息,

原地址和目的地址都被保留,类型代码改为16,并且重新计算校验和。

ICMP Fields:

Type:

15= 信息请求消息

16=信息应答消息

Code

0

Checksum

校验和(计算方法:报头的所有16位二进制数的反码的和的反码)。为了计算校验和,

该字段应该清零。这个校验和可能在将来被取代。

Identifier标识符

如果 code=0,标识符以帮助匹配(信息)请求和应答,可是是0;

Sequence Number序列号

如果code=0,序列号帮助匹配(信息)请求和应答,可以是0。

详细描述

这种消息可以在IP包头中以源网络地址发送,同时目的地址域为0(这表示此网络内)。

应答IP模块应该发送完全指定地址的应答消息。发送此消息是主机寻找到自己所在网络号

码的一种方法。

标识符和序列号可能被回显发送者应用到以帮助匹配请求的应答。例如,标识符可能像

在TCP或UDP中的端口那样被用作表示一个会话,序列号可能在每次回显请求中递增。回显

发送者会在回显应答消息中返回这些相同值。

Code 0 可能来自于网关或主机。

Summary of Message Types

0 Echo Reply

3 Destination Unreachable

4 Source Quench

5 Redirect

8 Echo

11 Time Exceeded

12 Parameter Problem

13 Timestamp

14 Timestamp Reply

15 Information Request

16 Information Reply

References

[1] Postel, J. (ed.), "Internet Protocol - DARPA Internet Program

Protocol Specification," RFC 791, USC/Information Sciences

Institute, September 1981.

[2] Cerf, V., "The Catenet Model for Internetworking," IEN 48,

Information Processing Techniques Office, Defense Advanced

Research Projects Agency, July 1978.

[3] Strazisar, V., "Gateway Routing: An Implementation

Specification", IEN 30, Bolt Beranek and Newman, April 1979.

[4] Strazisar, V., "How to Build a Gateway", IEN 109, Bolt Beranek

and Newman, August 1979.

[5] Mills, D., "DCNET Internet Clock Service," RFC 778, COMSAT

Laboratories, April 1981.

消息类型总结

0回显应答

3目的地不可达

4源抑制

5重定向

8回显

11超时

12参数错误

13时间戳

14时间戳应答

15信息请求

16信息应答

参考文献

[1] Postel, J. (ed.), "Internet Protocol - DARPA Internet Program

Protocol Specification," RFC 791, USC/Information Sciences

Institute, September 1981.

[2] Cerf, V., "The Catenet Model for Internetworking," IEN 48,

Information Processing Techniques Office, Defense Advanced

Research Projects Agency, July 1978.

[3] Strazisar, V., "Gateway Routing: An Implementation

Specification", IEN 30, Bolt Beranek and Newman, April 1979.

[4] Strazisar, V., "How to Build a Gateway", IEN 109, Bolt Beranek

and Newman, August 1979.

[5] Mills, D., "DCNET Internet Clock Service," RFC 778, COMSAT

Laboratories, April 1981.

本文标签: 数据消息网关目的发送