How to convert IPV4 to IPV6?
IPv6 is the abbreviation of "Internet Protocol Version 6" (Internet Protocol Version 6) in English. It is the next-generation IP protocol designed by the Internet Engineering Task Force ( IETF ) to replace IPv4 . Grains of sand make up an address
The biggest problem of IPv4 is the lack of network address resources, which seriously restricts the application and development of the Internet. The use of IPv6 can not only solve the problem of the number of network address resources, but also solve the obstacles for various access devices to connect to the Internet
An IPv6 address is 128 bits long, which is four times the length of an IPv4 address. Therefore, the IPv4 dotted decimal format is no longer applicable, and the hexadecimal representation is used. IPv6 has 3 representations.
The format is X:X:X:X:X:X:X:X, where each X represents 16b in the address, in hexadecimal, for example:
In this notation, the leading zeros of each X can be omitted, for example:
In some cases, an IPv6 address may contain a long period of 0 in the middle, and a continuous period of 0 can be compressed into "::". However, in order to ensure the uniqueness of address resolution, "::" in the address can only appear once, for example:
FF01:0:0:0:0:0:0:1101 → FF01::1101
0:0:0:0:0:0:0:1 → ::1
0:0:0:0:0:0:0:0 → ::
In order to realize IPv4-IPv6 interworking, the IPv4 address will be embedded in the IPv6 address. At this time, the address is usually expressed as: X:X:X:X:X:X:dddd, the first 96b is expressed in hexadecimal, and the last 32b The address is represented by IPv4 dotted decimal. For example, ::192.168.0.1 and ::FFFF:192.168.0.1 are two typical examples. Note that in the first 96b, the method of compressing 0 bits is still applicable.
We mentioned above that to communicate with ipv6 addresses, ipv4 addresses need to be converted to ipv6 addresses.
If an IPv4 address is 172.18.7.12, and there is an existing 32-bit address, how to convert it to ipv6?
1. Non-standard conversion:
It is only necessary to add 0 to 6 groups of 96 bits in front of the IP address, that is,
That is ::172.18.7.12 (inline IPv4 notation)
2. Standard conversion
172.18.7.12 is calculated in hexadecimal , namely AC.12.07.22,
However, the AC.12.07.22 string address is still 8 bits, so two sets of v4 addresses are needed to synthesize v6 addresses.
By padding the first 96 bits with zeros, it can be converted to
0000:0000:0000:0000:0000:0000:AC12:0722 or ::AC12:0722.