I'm reading about how to configure IPv6 on Ubuntu, I've gotten to the section about Reading IPv6 Addresses and though the first two examples make sense to me, the last one escapes my grasp a bit, as it's been a few years since my last networking class:
How does one convert the third form into the long form?
Here is the example I am having trouble with:
- third form: - 2002::10:0.0.1
- long form: - 2002:0000:0000:0000:0000:0000:0a00:0001
- canonicalform: - 2002::a00:1
I understand hex so far as instead of ending up with the number ten when you count beyond nine you end up with A, B, C, D, E, and F before incrementing the digit in the next column.
Can you please show me how this works using math, not just some online JavaScript converter?
Thank you!
In IPv4, each byte is represented by a number, 0 through 255; in IPv6, the hex representation is used instead, 00 through ff. The conversion that's done there is to map the four bytes of the IPv4 address to the last 4 bytes of the IPv6 address:
IPv4:
IPv6:
So, with an input of
10.0.0.1
, the bytes are0a
,00
,00
,01
; leading to:(which shortens to
::a00:1
)For another example, let's take
192.168.50.254
:You can look at the conversion to different formats using v6decode; try hovering over the different parts of the address to see how they relate between the different formats.