The loopback IP address in IPv6 format is: 0000:0000: 0000:0000: 0000:0000: 0000:0001
which is shortened to: 0:0: 0:0: 0:0: 0:1
which is then shortened to (keep last 2 words, ie. 4 bytes, to match IPv4): :0:1 (But I still don't know why it's double colons instead of single colon before 1, maybe for implying that there are 4 bytes here)
and simplified as: ::1
Expand ::1 into IPv4 format, it is: 0.0.0.1
But this is not the same as 127.0.0.1, where's the number 127?
First, :0:1
is not a valid IPv6 address. I'll explain why:
IPv6 address are 128 bit addresses written as eight hexadecimal parts separated by colons. Because this can be quite tedious to write, and because many IPv6 address (like 0:0:0:0:0:0:0:1
) contain many parts that are zero, it's allowed to replace one sequence of zeroes with two colons. The full address is still the same. It's just easier to write ::
than 0:0:0:etc
.
IPv4 and IPv6 are two different protocols. You cannot compare the IPv4 loopback address 127.0.0.1
with the IPv6 loopback address ::1
. They are completely unrelated. Both of them just happen to end with the same digit.