Basic knowledge of IPV6 addresses

IPV6 address format:

(1) Preferred format
The colon is divided into 8 sections, each section is 16bit, and each section is expressed in hexadecimal.
Expressed in the form of "IPv6 address/mask length".
For example: 2001:0DB8:0000:0001:0000:0000:0000:45ff/64.
(2) Compression format
The leading 0 of each segment can be omitted, but if the segment is all 0, at least one "0" character should be reserved; the trailing 0 cannot be omitted.
When one or more consecutive segments are all 0, it can be represented by "::", and only one "::" is allowed in the entire IPv6 address abbreviation.
For example: 2001:DB8:0:1::45ff/64.

(3) Format of embedded IPv4 address
The first 96 bits of the address are in IPv6 address format, and the last 32 bits are in IPv4 address format.
The IPv6 part can be in preferred or compressed format, and the IPv4 part can be in dotted decimal format.
For example: 0:0:0:0:0:0:166.168.1.2/64.

IPV6 address structure:

An IPv6 address can be divided into the following two parts:
Network prefix: nbit, which is equivalent to the network ID in the IPv4 address.
Interface ID: (128-n) bits, equivalent to the host ID in the IPv4 address.
 

IPV6 address type:

(1) Unicast address

 Unspecified address
The unspecified address in IPv6 is 0:0:0:0:0:0:0:0/128 or ::/128. This address can indicate that an interface or node does not yet have an IP address, and can be used as the source IP address of some packets (for example, it will appear in the duplicate address detection of NS packets). The packets whose source IP address is :: will not be forwarded by the routing device.


 Loopback address
The loopback address in IPv6 is 0:0:0:0:0:0:0:1/128 or ::1/128. The function of loopback is the same as that of 127.0.0.1 in IPv4, and it is mainly used for the device to send packets to itself. This address is usually used as the address of a virtual interface (such as a loopback interface). The loopback address cannot be used as the source IP address or destination IP address in the actually sent data packet.


Global unicast address
A global unicast address is an IPv6 address with a global unicast prefix, and its function is similar to that of a public network address in IPv4. This type of address allows the aggregation of routing prefixes, thereby limiting the number of global routing table entries.
The global unicast address consists of a global routing prefix (Global routing prefix), a subnet ID (Subnet ID) and an interface identifier (Interface ID)

Link-local address
Link-local address is an address type with limited application scope in IPv6, which can only be used between nodes connected to the same local link. It uses the specific link-local prefix FE80::/10 (highest 10-bit value 1111111010), and appends the interface ID as the lower 64 bits of the address.
Each interface of the node will be automatically configured with a link-local address (its fixed prefix + interface identifier formed by the EUI-64 rule) at startup.

unique local address

 ULA (Unique Local Address, unique local address) is an IPv6 private network address, which can only be used in the internal network. This address space cannot be routed in the IPv6 public network, so it cannot directly access the public network.
The unique local address uses the FC00::/7 address block, and currently only uses the FD00::/8 address block. FC00::/8 is reserved for future expansion.

 

IPv6 multicast address

The multicast of IPv6 is the same as that of IPv4, it is used to identify a group of interfaces, generally these interfaces belong to different nodes. A node may belong to 0 or more multicast groups. Packets sent to a multicast address are received by all interfaces identified by the multicast address. For example, the multicast address FF02::1 indicates all nodes in the link-local scope, and the multicast address FF02::2 indicates all routers in the link-local scope.

Requested node multicast address 

The multicast address of the requested node is generated from the unicast or anycast address of the node. When a node has a unicast or anycast address, it will generate a corresponding multicast address for the requested node and join the multicast group. A unicast address or an anycast address corresponds to a solicited node multicast address. This address is mainly used for neighbor discovery mechanism and address duplication detection function.
There are no broadcast addresses in IPv6, and ARP is not used. But the ability to resolve from IP address to MAC address is still required. In IPv6, this function is implemented through Neighbor Solicitation (NS) messages. When a node needs to resolve the MAC address corresponding to an IPv6 address, it will send an NS message. The destination IP of the message is the multicast address of the requested node corresponding to the IPv6 address that needs to be resolved; only nodes with this multicast address Will check the processing.
The solicited node multicast address consists of the prefix FF02::1:FF00:0/104 and the last 24 bits of the unicast address.

IPv6 anycast address

Anycast addresses identify a group of network interfaces (often belonging to different nodes). A packet whose destination address is an anycast address will be sent to the closest network interface in the routing sense.
(The anycast address cannot be actively used as the source of the data packet, because other devices will reply to the nearest device after receiving the packet, and the anycast address will not perform duplicate address detection)

IPV6 address packet structure

The IPv6 basic header is also called a fixed header. The fixed header contains 8 fields with a total length of 40Byte. The eight fields are: Version (Version), Traffic Type (Traffic Class), Flow Label (Flow Label), Payload Length (Payload Length), Next Header (Next Header), Hop Limit (Hop Limit), Source IPv6 address, destination IPv6 address.
Version (Version) This field specifies the version of the IP protocol, and its value is 6. The length is 4 bits.

  1. Traffic Class (Traffic Class) The function of this field is similar to that of the service type in IPv4, indicating the class or priority of IPv6 data packets. The length is 8 bits.
  2. Flow Label (Flow Label) Compared with IPv4, this field is new. It is used to identify that this datagram belongs to a specific datagram sequence between the source node and the destination node, and it needs special processing by the intermediate IPv6 router. The length of this field is 20bit. Generally, a flow can be identified by source/destination IPv6 address and flow label.
  3. Payload Length (Payload Length) This field indicates the length of the IPv6 datagram payload. Payload refers to the rest of the datagram immediately following the IPv6 header (ie, extension headers and upper-layer protocol data units). The length of this field is 16 bits, which can represent a payload with a maximum length of 65535 Byte. If the length of the payload exceeds this value, this field will be set to 0, and the length of the payload is indicated by the Oversized Payload option in the Hop-by-Hop Options Extension header.
  4. Next Header (Next Header) This field defines the type of the first extension header immediately following the IPv6 header (if present), or the protocol type in the upper layer protocol data unit. The length of this field is 8bit.
  5. Hop Limit This field is similar to the TTL (Time to Live) field in IPv4. It defines the maximum number of hops an IP datagram can travel through. Every time a router passes through, the value is subtracted by 1. When the value of this field is 0, the datagram will be discarded. The length of this field is 8bit.
  6. Source Address (Source Address) indicates the address of the sender, with a length of 128 bits.
  7. The destination address (Destination Address) indicates the address of the receiver, and the length is 128bit.

Improvements of the ipv6 header over the ipv4 header
 

Cancellation of the three-layer verification: the second and fourth layers of the protocol stack have provided verification, so IPv6 directly cancels the third-layer verification of IP, saving router processing resources.
Cancel the fragmentation function of the intermediate node: the intermediate router no longer processes the fragmentation, but only processes it at the source node that generates the data, saving a lot of CPU resources consumed by the intermediate router to process the fragmentation.
Define a fixed-length IPv6 header: it is conducive to the rapid processing of the hardware and improves the forwarding efficiency of the router.
Support for security options: IPv6 provides perfect support for IPSec, so the upper layer protocol can save many security options.
Add flow tags: improve QoS efficiency.

next-header in ipv6 header

·

IPv6 Extension Header Specification

When more than one extension header is used in the same packet, the headers MUST appear in the following order:

  • IPv6 Basic Header
  • Hop-by-Hop Options Extension Header
  • Destination Options Extension Header
  • Routing Extension Header
  • Fragmentation Extension Header
  • Authentication Extension Header
  • Encapsulating Security Payload Extension Header
  • Destination Options Extension Header
  • upper layer protocol datagram

When forwarding, the routing device decides whether to process the extension header according to the Next Header value in the basic header. Not all extension headers need to be viewed and processed by the forwarding routing device.

Except that the destination option extension header may appear once or twice (one time before the routing extension header, and the other time before the upper layer protocol data packet), the rest of the extension headers can only appear once.

Guess you like

Origin blog.csdn.net/2301_76769137/article/details/129746353