ArticleDirectory
- IPv6 Message format
- Comparison between IPv4 and IPv6 Headers
IPv6 Message format
- Version (4-bit): IP version. The value of this field is 6.
- Traffic class (8-bit): traffic classification, similar to the TOS of IPv4 Headers
- Flow Label (20-bit): Flow Label, used to mark a stream of IPv6 Packets
- Payload length (16-bit): the length of the payload. The extended header is also included in the payload length.
- Next header (8-bit): processing option fields, segmentation, security, mobility, Loose Source routing, record routing, and other new methods
- Hop limit: (8-bit): defines the maximum number of hops that an IP packet can pass through. This value is reduced by 1 per hop.
- Source Address (128-bit): the source address of the IP data packet
- Destination Address (128-bit): Destination Address of the IP data packet
- Possible extension header (s): Extended Header
Extended header (rfc2460)
Value |
Type of Header |
0 |
Hop-by-hop Options Header |
6 |
TCP (upper layer) |
17 |
UDP (upper layer) |
41 |
Encapsulated IPv6 Header |
43 |
Routing Header |
44 |
Fragment Header |
50 |
Encapsulating Security Payload |
51 |
Authentication Header |
58 |
ICMPv6 (upper layer) |
59 |
No next Header |
60 |
Destination options |
The sequence of extension headers recommended by rfc2460 is as follows:
- IPv6 main Header
- Hop-by-hop Options Header (if present, it must be the first one following the main/regular header)
- Destination Options Header (with routing options)
- Routing Header
- Fragment Header
- Authentication Header
- Encapsulating Security Payload Header
- Destination Options Header
- Upper-layer Header
Note: Except for the hop-by-hop Options Header, other extension headers are not processed by intermediate nodes during transmission. nodes that process the extension headers are processed in the order of the extension headers, you cannot select a header.
Combination of extension headers:
+ --------------- + ---------------------- | IPv6 Header | TCP Header + Data | next header = | 6 (TCP) | + --------------- + response + --------------- + ---------------- + ---------------------- | IPv6 Header | Routing Header | TCP Header + Data | next header = | 43 (Routing) | 6 (TCP) | + --------------- + ---------------- + response + --------------- + -------------- + accept | IPv6 Header | Routing Header | fragment header | fragment of TCP | header + Data | next header = | next header = | next header = | 43 (Routing) | 5 (fragment) | 6 (TCP) | + --------------- + ---------------- + -----------------
Hop-by-hop extension header (type = 0 ):
Description: This field is read and processed by each node and vro on the transfer path. Currently, only one option is defined: jumbogram (rfc2675), which must support data packets exceeding 64 KB ).
Usage: Mainly used for giant data packets (rfc2675) and router alarms (RFC 2711), e. g: RSVP, MLD report etc)
Use pad1 or padn
+- +-+ | Next header | HDR ext Len | +- +-+ |... options... | +- +-+
Routing Header (type = 43)
Description: when a data packet is sent to the destination, the packet header can be used by the IPv6 source node to force the data packet to pass through a specific router. When the route type field is set to 0, you can specify the intermediate router list in the Route Header, similar to the loose source routing option of IPv4.
Purpose: Mainly used for Mobile IP addresses
+- +-+ | Next header | HDR ext Len | routing type | segments left | + -+ -+ |... type-specific data... | +- +-+
- HDR ext Len (8-bit): the length of the extended header. The first byte is not counted.
- Routing type (8-bit): identifies the type of the Route Header
- Segment left (8-bit): number of remaining seg
- Type-specific data (extended): determined by the routing type. When the routing type is set to 0, the first 4 bytes are retained, followed by the address-list
Use pad1 or padn
How to use it? For example, if the source s sends a data packet to the target node D, specify that the data packet is sent to I1, I2, and I3:
As the packet travels from S to I1: source Address = s HDR ext Len = 6 Destination Address = I1 segments left = 3 Address [1] = I2 Address [2] = I3 Address [3] = D as the packet travels from i1 to I2: source Address = s HDR ext Len = 6 Destination Address = I2 segments left = 2 address [1] = I1 Address [2] = I3 Address [3] = D as the packet travels from i2 to I3: source Address = s HDR ext Len = 6 Destination Address = I3 segments left = 1 Address [1] = I1 Address [2] = I2 Address [3] = D as the packet travels from i3 to D: source Address = s HDR ext Len = 6 Destination Address = D segments left = 0 Address [1] = I1 Address [2] = I2 Address [3] = I3
Fragment header (type = 44)
Introduction: only energy nodes are used to segment packets larger than the transmission path PMTU. Different from IPv4, IPv6 segments are performed on the source node, but cannot be segmented in the middle node (MTU with the smallest detection path using the PMTU mechanism)
+- +-+ | Next header | reserved | Fragment Offset | res | M | +- +- +-+ | identification | +- +- +-+
- Reserved (8-bit): the initial value is 0.
- Fragment offset (13-bit): the offset of the part message.
- Res (2-bits): 0
- M: 1 indicates more frag (and fragment), 0 indicates last frag (I am the last one)
- Identification: Id generated by a shard. For different shard messages sent to the same destination, the ID is different.
Packet sharding:
Reorganization:
Destination Options Header (type = 60)
Description: optional information required for the destination node of the data packet. It is explained and used by the host machine. Currently, this option is blank.
Purpose: IETF currently recommends that you use this extension header to exchange registration information between mobile nodes and home agents.
+- +-+ | Next header | HDR ext Len | +- +-+ |... options... | +- +-+
- HDR ext Len (8-bit): the header length. The first byte is not counted.
- Options (variable length): contains one or more TLV (TAG, length, value) triplet
- Pad1, padn: used to fill the remaining part of the message options
No next header (type = 59)
Description: It indicates that no extension header is followed by the extension header.
Authentication Header (type = 51)
Description: used by IPSec to provide authentication, data integrity, and replay protection to ensure protection of some fields in the basic IPv6 packet header.
Encapsulating Security Payload header (type = 50)
Description: used by IPSec to provide authentication data integrity and replay protection and IPv6 packet confidentiality
Comparison between IPv4 and IPv6 Headers
Reference:
1. Courseware of the network architecture course of Southeast University
2. IPv6 learning Summary