IPv6绝妙之处在于它的头。 IPv6地址比IPv4大4倍,但IPv6报头比IPv4的大只有2倍。 IPv6报文头有一个固定的页眉和零个或多个可选(续期)头。这是一台路由器必备的所有必要信息保存在固定的头部。扩展报头中包含的可选信息,有助于路由器了解如何处理数据包/流。
固定报头
IPv6的报头固定为40字节长,包含以下信息。
S.N. | 字段&描述 |
---|---|
1 |
Version (4-bits): This represents the version of Internet Protocol, i.e. 0110. |
2 |
Traffic Class (8-bits): These 8 bits are divided into two parts. Most significant 6 bits are used for Type of Service, which tells the Router what services should be provided to this packet. Least significant 2 bits are used for Explicit Congestion Notification (ECN). |
3 |
Flow Label (20-bits): This label is used to maintain the sequential flow of the packets belonging to a communication. The source labels the sequence which helps the router to identify that this packet belongs to a specific flow of information. This field helps to avoid re-ordering of data packets. It is designed for streaming/real-time media. |
4 |
Payload Length (16-bits): This field is used to tell the routers how much information this packet contains in its payload. Payload is composed of Extension Headers and Upper Layer data. With 16 bits, up to 65535 bytes can be indicated but if Extension Headers contain Hop-by-Hop Extension Header than payload may exceed 65535 bytes and this field is set to 0. |
5 |
Next Header (8-bits): This field is used to indicate either the type of Extension Header, or if Extension Header is not present then it indicates the Upper Layer PDU. The values for the type of Upper Layer PDU is same as IPv4’s. |
6 |
Hop Limit (8-bits): This field is used to stop packet to loop in the network infinitely. This is same as TTL in IPv4. The value of Hop Limit field is decremented by 1 as it passes a link (router/hop). When the field reaches 0 the packet is discarded. |
7 |
Source Address (128-bits): This field indicates the address of originator of the packet. |
8 |
Destination Address (128-bits): This field provides the address of intended recipient of the packet. |
扩展报头
在IPv6中,在固定头包含的是这是不是不需要或很少使用必要的,避免信息仅供参考。所有这些信息,就是把固定头和上层报头之间的扩展报头的形式。每一个扩展报头是由一个不同的值。
当扩展报头使用,固定的IPv6头的下一个头字段指向的第一个扩展头。如果有一个以上的扩展报头,那么首先扩展报头的“下一标头”字段指向第二个,依此类推。最后一个扩展头的“下一标头”字段指向上层报头。因此,所有从点到标题中的下一个链表的方式。
如果Next Header字段包含值59,则表明没有头这个头之后,甚至没有上层报头。
下面的扩展报头必须支持按RFC 2460:
扩展头的顺序应该是:
这些头文件:
-
1. 应该由第一和随后的目的地进行处理。
-
2. 应该由最终目的地处理。
扩展报头被安排了一个又一个的链接列表的方式,如下图中所示: