For a complete IPv6 address, need to write 128 bits, has been divided into 8 paragraphs, 4 characters each, that is, the complete representation of a IPV6 address, need to write 32 letters, which is quite long, and easy to confuse and error, so IPv6 in the representation of the address, is fastidious, so far, IPV6 addresses are represented in three ways, namely:
1. Preferred format
2. Compression representation
3.ipv4 embedded in the IPV6
The following are details of these three IPv6 address representation methods:
1. Preferred format
The preferred format of the presentation method actually does not have any attention, is the IPV6 in the 128-bit, that is, a total of 32 characters complete the whole, one does not leak all write out, such as the following is the preferred format for some IPv6 address form representation:
0000:0000:0000:0000:0000:0000:0000:0000
0000:0000:0000:0000:0000:0000:0000:0001
2001:0410:0000:1234:fb00:1400:5000:45ff
3ffe:0000:0000:0000:1010:2a2a:0000:0001
fe80:0000:0000:0000:0000:0000:0000:0009
FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF
From the above IPV6 address of the preferred format representation can be seen, each address, all 32 characters are written out, even if the address has many 0, or there are many F, also is a non-leaking to write out, this shows that the preferred format only need to address the full write can, without any complex changes, But it's easy to make mistakes.
2. Compression format
From the previous IPV6 address representation method preferred format representation can be seen in a full IPv6 address, there will be a lot of 0, and we know, many times, 0 is meaningless, 0 means no, write, also mean no, do not write, also said no, Then we consider whether we can not affect the address results of 0 to omit the omission, so that can greatly save time, but also convenient for people to read and write, so that the address is omitted 0 representation, called the compression format.
In the compressed format of the representation, in three cases, the following describes three compression formats:
First case:
In IPv6, the address is divided into 8 segments to represent, each segment is 4 characters, but a full IPv6 address will often encounter the entire segment 4 characters are all 0, so we will the entire segment 4 characters are all 0 using a double colon:: To indicate that if a number of consecutive segments are all 0, You can also use a double colon for multiple segments: to indicate that, if it is a plurality of segments, do not need to write double colons multiple times, just write once, such as an address 8 segments, of which three segments are all 0, then we will be 0 of the three segments total 48 bits:: To indicate, and then the other 5 paragraphs as usual write can , when the computer read such a less than 128-bit address, less than the number of 128 bits, in: where the number of 0, such as the above:: Instead of 48-bit, then the computer will be at this address:: Position to fill 48 bits of 0, so that the address is restored back correctly.
Let's look at some of the IPV6 addresses with a total of 4 characters of 0, using a compressed format to represent:
Example 1:
Before compression:
0000:0000:0000:0000:0000:0000:0000:0000
After compression:
::
Note: As can be seen, because the address of the 8 segments are all 0, so only use:: The entire address is expressed, when the computer to get this compressed address, found that compared to the normal 128 bit less 128 bits, then will be in:: Place 128 0, the result is:
0000:0000:0000:0000:0000:0000:0000:0000
As you can see, the address that the computer restores is the real address before compression.
Example 2:
Before compression:
0000:0000:0000:0000:0000:0000:0000:0001
After compression:
:: 0001
Note: It can be seen that the compressed address is 112 bits less than the normal 128 bits, the computer will be in: Place to fill 112 0, the result is:
0000:0000:0000:0000:0000:0000:0000:0001
As you can see, the address that the computer restores is the real address before compression.
Example 3:
Before compression:
2001:0410:0000:0000:fb00:1400:5000:45ff
After compression:
2001:0410:: fb00:1400:5000:45ff
Note: It can be seen that the compressed address is 32 bits less than the normal 128 bits, the computer will be in: Place to fill 32 0, the result is:
2001:0410:0000:0000:fb00:1400:5000:45ff
As you can see, the address that the computer restores is the real address before compression.
Example 4:
Before compression:
3ffe:0000:0000:0000:1010:2a2a:0000:0001
After compression:
3ffe::1010:2a2a::0001
Note: When the computer to get this compressed address, found that compared to the normal 128 bit less 64 bits, the computer will try to: the place to fill the less 64 0, but we can see that the compressed address has two::, and the computer to fill 64 0, so then the result is likely to be the following several:
3ffe:0000:1010:2a2a:0000:0000:0000:0001
Or
3ffe:0000:00001010:2a2a::0000:0000:0001
Or
3ffe:0000:0000:0000:1010:2a2a:0000:0001
From the results can be found, when a IPV6 address is compressed, if the computer appears two or more:: When the computer when the address is restored, there may be a number of conditions, which will cause the computer after the restoration of the address is not the address before compression, will result in an address error, the final communication failure.
Therefore, when compressing the IPv6 address, only one of the addresses can appear::.
Second case:
In the first case of the compressed format, the entire paragraph in the address 4 characters is 0 o'clock, it is compressed to: to represent, but after using the first case of compression, we can still see the address there are still many meaningless 0, such as 0001,0410. We know, 0001, although there are three in front of 0, but if we omit all the preceding 0, write as 1, the result is equal to 0001, and 0410 is the same, we omit the previous 0, written 410, also equal to 0410, so we omit the number in front of the 0 o'clock, Does not affect the result, at this time, the IPV6 address is allowed to omit 0 of the leading part of a segment without affecting the result. However, it should be noted that if 0 is not a leading 0, such as 2001, we can not omit 0 write 21, because 21 is not equal to 2001, so in the middle of 0 can not be omitted, can only omit the first 0. Let's look at some of the address representations that omit the leading 0:
Example 1:
Before compression:
0000:0000:0000:0000:0000:0000:0000:0000
After compression:
0:0:0:0:0:0:0:0
As can be seen from the results, the computer does not need to restore such an address at all, the results of compression and compression before the results are equal.
Example 2:
Before compression:
0000:0000:0000:0000:0000:0000:0000:0001
After compression:
0:0:0:0:0:0:0:1
As can be seen from the results, the computer does not need to restore such an address at all, the results of compression and compression before the results are equal.
Example 3:
Before compression:
2001:0410:0000:1234:fb00:1400:5000:45ff
After compression:
2001:410:0:1234:fb00:1400:5000:45ff
As can be seen from the results, the computer does not need to restore such an address at all, the results of compression and compression before the results are equal.
The third case:
In the previous two kinds of IPv6 address compression representation method, the first is in the whole paragraph 4 characters embox is 0 o'clock, only after it is compressed to write::, and the second is meaningless 0 omit not write, you can find two methods can save time, easy to read. The third compression method is the combination of the first two methods, both the whole paragraph 4 characters embox to 0 of the part written::, also will be meaningless 0 omitted to write, the result can appear the following some of the most convenient representation method:
Example 1:
Before compression:
0000:0000:0000:0000:0000:0000:0000:0001
After compression:
:: 1
As you can see, there are two ways to combine the compression format, but it's easy.
Example 2:
Before compression:
2001:0410:0000:0000:fb00:1400:5000:45ff
After compression:
2001:410:: fb00:1400:5000:45ff
As you can see, there are two ways to combine the compression format, but it's easy.
3.ipv4 embedded in the IPV6
When the network has not all transition from IPv4 to IPV6, there may be some devices that are connected to the IPV4 network, but also connected to the IPV6 network, for this situation, you need an address that can represent the IPV4 address, but also can represent the IPV6 address.
Because a IPV4 address is 32 bits, a IPV6 address is 128 bits, to let a IPv4 address as IPV6 address, obviously has less 96 bits, then a normal IPv4 address by adding 96 bits, the result becomes 128 bits, to communicate with IPV6. In the presentation, is based on the original address of the IPV4, add 96 0, the result becomes 128 bits, the increase of 96 0 combined with the original IPV4 address, represented by
0:0:0:0:0:0:A.B.C.D or:: A.b.c.d., as follows:
0000:0000:0000:0000:0000:0000:a.b.c.d
9 6 x 0 32 bit
Cases:
IPV4 address is 138.1.1.1
Indicates that the IPV6 address is 0:0:0:0:0:0:138.1.1.1
Five, IPv6 address representation method (level three network technology)