Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question

2 Answers 2

up vote 6 down vote accepted

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:

aaa.bbb.ccc.ddd

IPv6:

XXXX::AABB:CCDD

So, with an input of 10.0.0.1, the bytes are 0a, 00, 00, 01; leading to:

::0a00:0001

(which shortens to ::a00:1)

For another example, let's take 192.168.50.254:

::c0a8:32fe
share|improve this answer
    
Okay so in ipv6 you have a hexquad, and in ipv4 you have a octet... a hexquad represents 16 bits... an octet represents 4 bits? –  leeand00 Oct 6 '11 at 19:19
2  
Right, except 8 bits per IPv4 octet. IPv4 has 4 octets of 8 for a total of 32 bits, while IPv6 has 8 colon-separated groups of 16 bits for a total of 128 bits. –  Shane Madden Oct 6 '11 at 19:21
    
Okay I think I understand this now, here's a rather verbose explanation of the conversion: leeand00.tiddlyspot.com/… –  leeand00 Oct 6 '11 at 20:24

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.

share|improve this answer
    
Awesome! Thanks man! :) –  leeand00 Oct 12 '11 at 1:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.