ipv6 address

I have little knowledge about ipv6 address. All I know is that it is longer than ipv4 address thus can be assigned to more hosts in the world. ipv6 addresses are so ugly that I can hardly write some(in contrast, I can easily recall some ipv4 addresses like,,,…).

The ipv6 address format is quite different from ipv4 address:

  • ipv6 address is 128-bit and ipv4 address is 32-bit
  • ipv6 address is denoted by 8 groups of hex digits, thus each group has 4 hex digits representing 2 bytes(16 bits). The groups are separated by :. Ipv4 address is denoted by 4 decimal numbers. The numbers are separated by ..

There are shorten forms of ipv6 address:

leading 0 in each group can be omitted. For example,1234:5678:9abc:def0:0001:0002:0003:0004 can be shortened as 1234:5678:9abc:def0:1:2:3:4. But 1234:5678:9abc:def0:0000:0001:0002:0003 cannot be shorten as 1234:5678:9abc:def0::0001:0002:0003 because the last 0 in 0000 is not a leading 0 thus should be kept. So the right shorten form is 1234:5678:9abc:def0:0:0001:0002:0003.

You can use :: to shorten consecutive all-zero groups. For example, 1234:5678:9abc:def0:0000:0000:0001:0002 can be shortened as 1234:5678:9abc:def0::0001:0002. If there are multiple consecutive all-zero groups, only the leftmost consecutive all-zero groups can be replaced with ::, for example, 1234:0000:0000:def0:0000:0000:0001:0002 can be written as 1234::def0:0:0:1:2. 1234::def0::1:2 is a wrong representation because of the ambiguity of restoring from the shortened form to the full representation. The  ambiguity  arises from you do not know how many groups are in ::, so 1234::def0::1 may be 1234:0000:0000:def0:0000:0000:0000:0001, or 1234:0000:0000:0000:def0:0000:0000:0001. The expansion from :: needs a little intelligence:

  • If there are no other digits around ::, :: is expanded to 0000:0000:0000:0000:0000:0000:0000:0000.
  • If there are digits only at the left of ::, :: is expanded to :0000:0000…:0000. The number of all-zero groups is 8-#other groups.
  • If there are digits only at the right of ::, :: is expanded to 0000:0000…:0000:. The number of all-zero groups is 8-#other groups.
  • If there are digits both at the left and at the right of ::, :: is expanded to :0000:0000…:0000:.  The number of all-zero groups is 8-#other groups.

There are special ipv6 addresses you need to note:

  • ::1 is the loopback ipv6 address like ipv4
  • :: is the unspecified ipv6 address.
  • fe80::/10 are Link Local IPv6 Addresses. They are not used to configure hosts globally. So if your vps has such kind of ipv6 addresses, do not be excited because nobody outside can communicate with you with those addresses.



If you like my content, please consider buying me a coffee. Buy me a coffeeBuy me a coffee Thank you for your support!

Leave a Reply