An IPv6 address is 128 bits long but is usually written in the form of 8 groups of four hexadecimal numbers. For example:
2001:0db8:85a3:08d3:1319:8a2e:0370:7344
is a valid IPv6 address.
If all four digits are zero, they can be omitted. For example:
2001:0db8:85a3:0000:1319:8a2e:0370:7344
is equivalent to
2001:0db8:85a3::1319:8a2e:0370:7344
Following these rules, if the omission results in more than two colons appearing, it can be compressed to one, but this zero compression can only appear once in an address. Therefore:
2001:0DB8:0000:0000:0000:0000:1428:57ab
2001:0DB8:0000:0000:0000::1428:57ab
2001:0DB8:0:0:0:1428:57ab
2001:0DB8:0::0:1428:57ab
2001:0DB8::1428:57ab
are all valid addresses and are equivalent. However,
2001::25de::cade
is illegal. (This makes it unclear how many packets of all-zero are in each compression.)
Leading zeros can also be omitted. Thus:
2001:0DB8:02de::0e13
is equivalent to
2001:DB8:2de::e13
If this address is actually an IPv4 address, the last 32 bits can be expressed in decimal; thus:
ffff:192.168.89.9 is equivalent to: :ffff:c0a8:5909 but is not equivalent to: :192.168.89.9 and: :c0a8:5909.
The ffff:1.2.3.4 format is called an IPv4-mapped address, which is not recommended for use. In contrast, the :1.2.3.4 format is called an IPv4-compatible address.
IPv4 addresses can easily be converted to IPv6 format. For example, if an IPv4 address is 135.75.43.52 (in hexadecimal, 0x874B2B34), it can be converted to 0000:0000:0000:0000:0000:0000:874B:2B34 or: :874B:2B34. Additionally, a mixed notation (IPv4-compatible address) can be used, resulting in: :135.75.43.52.
蘊藏許多助人的知識與智慧。