RFC 791翻译(IP的主要内容)

三、具体内容

3.1 首部格式

对首部内容的一个大概描述如下:

    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 
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |Version|  IHL  |Type of Service|          Total Length         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |         Identification        |Flags|      Fragment Offset    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |  Time to Live |    Protocol   |         Header Checksum       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                       Source Address                          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                    Destination Address                        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                    Options                    |    Padding    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Version: 4 bits

Version域指示了首部格式。这份文件描述了Version 4


IHL: 4 bits

IHL 是 Internet Header Length 的简写,这个字段指示头部有多少个 32 比特(4 字节)的字长。因此,最小的 IHL 是 5(即 20 字节,这是没有任何选项的 IP 头的大小),最大的 IHL 是 15(即 60 字节)。所以,IHL 字段的主要作用就是告诉接收方如何从 IP 数据包中分离出头部和数据部分。


Type of Service: 8 bits

The Type of Service provides an indication of the abstract parameters of the quality of service desired.These parameters are to be used to guide the selection of the actual service parameters when transmitting a datagram through a particular network. Several networks offer service precedence, which somehow treats high precedence traffic as more important than other traffic (generally by accepting only traffic above a certain precedence at time of high load). The major choice is a three way tradeoff between low-delay, high-reliability, and high-throughput.

      Bits 0-2:  Precedence.
      Bit    3:  0 = Normal Delay,      1 = Low Delay.
      Bits   4:  0 = Normal Throughput, 1 = High Throughput.
      Bits   5:  0 = Normal Relibility, 1 = High Relibility.
      Bit  6-7:  Reserved for Future Use.

         0     1     2     3     4     5     6     7
      +-----+-----+-----+-----+-----+-----+-----+-----+
      |                 |     |     |     |     |     |
      |   PRECEDENCE    |  D  |  T  |  R  |  0  |  0  |
      |                 |     |     |     |     |     |
      +-----+-----+-----+-----+-----+-----+-----+-----+

        Precedence

          111 - Network Control
          110 - Internetwork Control
          101 - CRITIC/ECP
          100 - Flash Override
          011 - Flash
          010 - Immediate
          001 - Priority
          000 - Routine

使用Delay,Throughput以及Reliability可能(某种程度上)增加服务的开销。In many networks better performance for one of these parameters is coupled with worse performance on another. Except for very unusual cases at most two of these three indications should be set.

The type of service is used to specify the treatment of the datagram during its transmission through the internet system. Example mappings of the internet type of service to the actual service provided on networks such as AUTODIN II, ARPANET, SATNET, and PRNET is given in “Service Mappings” [8].

The Network Control precedence designation is intended to be used within a network only. The actual use and control of that designation is up to each network. The Internetwork Control designation is intended for use by gateway control originators only. If the actual use of these precedence designations is of concern to a particular network, it is the responsibility of that network to control the access to, and use of, those precedence designations.


Total Length: 16 bits

总长度指以字节为单位的整个数据报的长度,包括internet首部和数据。此字段允许数据报的长度最多为65535个字节。对于大多数主机和网络来说,这样长的数据报是不切实际的。所有主机都必须准备好接受至多576个字节的数据报(无论它们是完整到达还是以片段形式到达)。RFC建议主机只发送大于576个八位字节的数据报,前提是它们能够保证目的地准备接受较大的数据报。

选择数字576是为了在包含必须的首部信息外,可以传输合理大小的数据块。例如,这个大小允许512个字节的数据加上64字节的首部放入一个数据报中。最大的因特网首部是60个字节,常见的因特网首部是20个字节。


Identification: 16 bits

这个值由发送方指派,用于组装分片的datagram。


Flags: 3 bits

两个控制标志位

      Bit 0: reserved, must be zero
      Bit 1: (DF) 0 = 可以进行分片,  1 = 不可以进行分片.
      Bit 2: (MF) 0 = 指代这是分片后的最后一片, 1 = 不是最后一片.

          0   1   2
        +---+---+---+
        |   | D | M |
        | 0 | F | F |
        +---+---+---+

Fragment Offset: 13 bits

这个域指明了在这个datagram中,目前的片的偏移量,单位是字节。第一个片的偏移为0


Time to Live: 8 bits

这个域指示了datagram允许停留在网络中的最长时间。如果值为0,那么datagram需要被丢弃。它的值在Internet header processing时被修改,其度量单位为秒,但是因为每个处理这个datagram的模块都至少需要将它的值减一(即使是在1s内处理完成)。因此TTL被视为一个datagram可以存在的时间的上界。引入这个值的目的是为了剔除那些无法到达终点的datagram,并且限制datagram的最长存活时间。


Protocol: 8 bits

This field indicates the next level protocol used in the data portion of the internet datagram. The values for various protocols are specified in “Assigned Numbers” [9].


Header Checksum: 16 bits

A checksum on the header only. Since some header fields change (e.g., time to live), this is recomputed and verified at each point that the internet header is processed.

The checksum algorithm is:

The checksum field is the 16 bit one’s complement of the one’s complement sum of all 16 bit words in the header. For purposes of computing the checksum, the value of the checksum field is zero.

This is a simple to compute checksum and experimental evidence indicates it is adequate, but it is provisional and may be replaced by a CRC procedure, depending on further experience.


Source Address: 32 bits

源地址


Destination Address: 32 bits

目的地址


Options: variable

这个变量可能在数据报中出现,也可能不出现。但是需要在所有IP模块中实现(包含host和gateway)。这个选项的可选是指在传输过程中可以选择这些参数,并不是指在IP模块中是否进行实现。


Padding: variable

这个变量用于对齐,确保数据报的头部长度是32的整数(用0进行对齐)。

参考

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值