Ipv6 Protocol packet format 1. ipv6 basic format ipv6 packet format from the perspective of simplicity, it is simpler than ipv4, and the length of the ipv6 basic header is fixed. Compared with ipv4, ipv6 removes some headers and gets all of these headers to the end of the extended projection. The ipv6 packet format is as follows: version: 4 bits version number ipv6 is 6 Traffic Class: 8 bits, transmission type, it can be used to identify the source node or forwarding router and distinguish different types or priorities in IPV6 packets. It is similar to implementing the TOS/DIFF Flow Label of IPV4: 20 bits Flow Label, a Data Stream is a data packet sequence sent from a specific source node to a specific destination node. When the source node wants the intermediate router to perform some special processing on the data packet, you can use the data stream label. If the data stream label is not supported, the value 0 can be assigned; Payload Length: 16 bits unsigned integer, the length of the ipv6 load, outside the Header (including the extension Header) Next Header: 8 bits indicates the type of the Next Header following the IP Header Hop Limit: 8 bits unsigned integer, if the number of hops is reduced to 0, the packet Source Address: 128 bit Source Address Destnation Address: 128 bit destination Address is discarded. 2. Extended Header Format: 1. The following is an example of several extensions: + --------------------- + ---------------------------------------------- | ipv6 header | tcp header + Data | next header = tcp | + ----------------------- + response | ipv6 header | routing header | tcp header + data | next header = | next header = tcp | routing | + ------------------------- + ------------------------ + ------------------------- generally (the first exception of the hop-by-hop option ), expansion During packet transmission, no node in the middle is detected and processed until the node identified by the destination address in the ipv6 Header. Exception: the hop-by-hop option header carries the information that must be detected and processed by each node in the Transfer Path of the packet. Including the source and target nodes. If the HOP-BY-HOP option header exists, it must be followed BY the ipv6 Header. 2. the sequence in which the extension header appears. When multiple extension headers are used in the same package, we recommend that you sort the extension headers in the following order: ipv6 headerhop-by-hop options header (HOP-BY-HOP header) destionaion options header (Destination Address option header) routing header (Route header) fragment header (partition header) authentication header (authentication header) encapsulating security payload header encapsulate the security load header destination options header (destination Address option header) upper-layer header upper-layer protocol header 3. options are in the hop-by-hop and destination address option headers, which contain several encoding options in the type-length-value format. The format is as follows: +-+ ------------------ | Option type | opt data len | options data +-+ -+ ---------------- Option type: 8 bit: indicates the Option type; Opt data len: 8 bit indicates the length of the Option data field; Option data indicates the variable length, which varies with the Option type; Option data indicates the maximum two bits of the Option type, indicates the processing method when the IPV6 node cannot identify this option: 00: Skip this option and continue to process the first 01: discard this package 10: discard this package, and send a "parameter error" icmp to the source address, and the Pointer Points to the unrecognized option Type 11: discard this packet, and if the target address is not a multicast address, send a parameter error icmp to the source address, and the Pointer Points to the third bit of the unrecognized option type option: 0: Option data will not change routing 1: Option data may Change Route 4 and Hop-by-Hop option headers to be identified by "next Header" of IPV6 Header 0 (0x00, this option header is used to send optional information that each node must detect in the Transfer Path of the data packet. The format is as follows: +- +-+ | next header | hdr ext len |... options... | +- +-+ Next header: 8 bits, followed by the length of the header type Hdr Ext len: 8 bits hop-by-hop option after the hop-by-hop option header, does not include the start eight-bit group options: Variable Length, contains one or more TLV options 5, the Route header next header = 43 identifier; the IPV6 source node lists one or more intermediate nodes that should be "accessed" in the path to the target node. The format is as follows: +-+ -+ -+ | Next header | Hdr Ext Len | Routing Type | Segments Left | +- +- + |... type-specific data... | +- +-+ Next header: 8 bits follow the length of the first Route Header Type Hdr Ext Len: 8bit Route Header, excluding the first eight-bit group Routing Type: 8 bits identify Route Header Type Segements left: still Number of intermediate nodes to be accessed type-specific data: variable length, the format is determined by the routing type (routing type) 6. The next header of the Shard is 44. In ipv6, only Source nodes can be sharded, and intermediate routers cannot be sharded. when the length of the sent data packet is greater than MTU, the Shard is required. The format of the shard header is as follows: +- +-+ | next header | reserved | fragment offset | Res | m | +- +-+ | Identification | +- +- +-+ Next header: 8bit same as reserved: 3bit, fragment offset: 13 bit, part offset. The offset Res: 2bit of the data after the header relative to the start position of the fragment part in the original package. It is retained and filled with 0. M flag is ignored during receiving: identifies whether there are shards (1: parts; 0: last part) Identification: 32 bit, identifier example: 7. The first of the destination option is the next header = 60 identifier, which carries the optional information that only needs to be detected by the target node. The format is as follows: +- +-+ | next header | hdr ext len |... options... | +- +-+ next header: the length of the 8-bit option is the same as that of the Hdr Ext Len: 8-bit option header, excluding the 8-bit options: variable length. One or more TLV format options 8. No header: next header = 59 (0x3b)