Internet protocols IPv4, IPv6
Internet Protocol (IP) is a network protocol that is responsible for the transmission and routing of messages between nodes and determines the rules for splitting data into packets.
IPv4 (Internet Protocol version 4) is the fourth version of the Internet Protocol (IP). The first widely used version. The protocol is described in RFC 791 (September 1981).
IPv6 (IP-6), defined in RFC 460, is the latest generation of Internet Protocol (IP), defined by the Internet Engineering Task Force (IETF). While IPv6 is designed to eventually replace IPv4, they are closely interrelated.
Comparison of IPv4 and IPv6. How the header is formed in each version
The length of IPv4 is 32 bits (4 bytes). The address consists of the network address and the host address. The length of these components depends on the address class. Addresses are divided into classes A, B, C, D and E. The address class is defined by several initial bits of the address. The total number of IPv4 addresses is 4,294,967,296. In plain text, the IPv4 address is written as N.N.N.N, where 0 <= N <= 255, and each letter N represents a decimal digit. The maximum address length is 15 characters, without the mask.
The length of IPv6 is 128 bits (16 bytes). Usually the first 64 bits specify the network number, and the second 64 bits the host number. Often, as the host number or its component in the IPv6 address, it is obtained based on the MAC address or other interface identifier.
In subnets with some prefixes, the IPv6 architecture is more complex than the IPv4 architecture. The number of IPv6 addresses is 1028 (79 228 162 514 264 337 593 543 950 336) times the number of IPv4 addresses. In text form, the IPv6 address is written as xxxx: xxxx: xxxx: xxxx: xxxx: xxxx: xxxx: xxxx, where each letter x is a hexadecimal digit representing 4 bits. In text format, instead of any number of zeros in the address, you can specify a double colon (: :). For example, the address :: ffff: 10.120.78.40 is the IPv6 address converted to IPv4.
The figure on the left shows the IPv4 protocol header, in the figure to the right, the IPv6 protocol header
Advantages and disadvantages of both versions
The main difference between IPv4 and IPv6 is the address space, which is much larger for IPv6.
The ipv4 protocol is old and at the time of its creation many aspects of its security were not taken into account.
The IPv6 protocol is designed to provide end-to-end encryption for maximum connection security. The IPSec extension includes cryptographic protocols to provide secure data transmission.
The IPv6 package header does not contain extra fields. It uses only 8 fields, compared to 13 in the case of IPv4. Additional fields are now optional headers extensions. The header size is 40 bytes, which is twice as large as that of IPv4.
The number of IPv4 addresses is limited, but they still need to be used for billions of Internet devices. Therefore, the term Network Address Translation or NAT. With this technology, you can assign one IP address to multiple devices.
IPv6 has such a range of addresses, which allows each device to assign an external IP address, a unique identifier on the Internet. This will make NAT unnecessary.
IPv6 has a built-in feature known as neighbor discovery. This will allow machines and routers to find each other and exchange information. With this technology, devices can obtain an IPv6 address and communicate it to other devices. This eliminates the need for a DHCP server.
IPv6 and IPv4 are incompatible with each other. But they can work together in a dual-stack mode.
Choosing which protocol to use IPv6 or IPv4, it is necessary to understand that IPv6 has existed for more than ten years, its deployment has not led the protocol to dominance, even considering that the address space is coming to an end. During this time, improvements were introduced to the IPv4 protocol, for example, NAT and CIDR. Over time, replacing IPv4 with IPv6 is inevitable.