RFC792翻译(ICMP主要内容)

一、介绍

连接网络的设备称为gateway。这些gateway在彼此之间沟通控制信息时使用Gateway to Gateway Protocol(GGP)[3,4]。偶尔一个gateway或目的主机会和一个源主机进行沟通,例如汇报数据报处理时的一个错误。为了满足协议中的这个目的引入了Internet Control Message Protocol(ICMP)。ICMP利用了IP的各种基础支持,表现的好像是高层协议的一部分,但实际上,ICMP是IP的一部分,需要被每个IP模块实现。

ICMP报文在几种情况下被发送。如,当一个数据报无法到达终点时,当gateway没有足够的缓存能力来发送数据报时,以及gateway可以引导主机在更短的路线上进行通信。

IP被设计成不可靠的模式。这些控制信息的目的是对交流过程中的问题提供反馈,但并不是为了使得IP可靠。IP并不保证一个数据报会被成功送达或者一个控制信息可以成功返回。一些数据报可能在没有任何汇报的情况下丢失。使用IP的高层次信息必须实现他们自己的可靠传输过程。

ICMP数据报通常被用来汇报处理数据报时发生的错误。为了避免无穷无尽的递归汇报过程,我们不会对ICMP信息发送ICMP。同样ICMP只汇报段分片中偏移为0的片(fragment 0)的错误信息。

二、信息格式

ICMP信息在发送时使用基本的IP头部。数据部分的第一个字节是ICMP type域;这个值决定了其余数据的格式。标为“unused”的域需要保留下来作为后续的拓展,并且在发送时值要设置为0,同时接收方也不能使用这些域(除非在checksum中进行检查)。除非在下面各个不同用处中的特殊声明,ICMP中的IP首部各个值如下所示:


Version

4


IHL

32位字衡量的网络首部长度


Type of Service

0


Total Length

用字节衡量的IP首部以及数据长度。


Identification, Flags, Fragment Offset

在数据分片中用到的信息,参考RFC 791


Time to Live

用秒衡量的存活时间;这个域在数据报经过的每个处理它的机器上都会减少,因此这个值最少要大于这个数据报要经过的gateway的数量。


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

生成ICMP信息的gateway或host的地址。除非特意声明,这可以是任意一个gateway的地址。


Destination Address

这个信息需要发送到的gateway或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      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

3.1 IP域


Destination Address

从初始数据报数据中提取出的源网络地址。

3.2 ICMP域


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

IP首部加上初始数据报数据的前64位。这个数据被host用来匹配对应的进程。如果一个高层协议使用了端口号,那么这个端口号被认为在数据报的前64位中。


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.

四、Time Exceeded Message

五、Parameter Problem Message

六、Source Quench Message

七、Redirect Message

八、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 ...
   +-+-+-+-+-

3.1 IP域


Addresses

echo信息中的源地址会成为echo reply信息中的目的地址。为了生成一个echo reply信息,源地址和目的地址会简单的进行调换,type更改为0并重新计算checksum的值。

3.2 ICMP域


Type

对于echo信息来说是8
对于echo reply信息来说是0


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

如果code=0,那么Identifier用来帮助匹配echo和reply,这个值可能为0。


Sequence Number

如果code=0,那么sequence number会被用来帮助匹配echo和reply,这个值可能为0。


Description

echo信息中收到的信息必须在echo reply信息中进行返回。

identifier以及sequence number可能被echo发送者用来帮助匹配reply信息。例如,可能使用TCP或UDP中的端口号作为identifier来辨认一个session,sequence number可能在每个发送的echo request都增加。echoer在echo reply中返回同样的信息。

可以从gateway或host中收到Code 0。

参考

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值