0

I would like to know how IPv6 address is represent in computer memory? It's really obvious for me that IPv4 has reversed bytes in memory. But I want to figure out how computer stores all 128 bits of IPv6 address. Thanks in advance :)


Thank you very much for your replies. But I have another question. What are the reasons that producents of web domain use many of IP addresses for their website? Possibility of failure of one IP address? Or maybe something else?

Kev
  • 118,037
  • 53
  • 300
  • 385
caro
  • 381
  • 3
  • 5
  • 20

3 Answers3

1

There is no requirement for an address to be stored in any particular order, because it doesn't matter.

Of course, when sent out on the wire as part of an IP packet, there is indeed a specific ordering; see http://en.wikipedia.org/wiki/IPv6_packet.

Oliver Charlesworth
  • 267,707
  • 33
  • 569
  • 680
1

They are usually stored as an array of octets in big endian order (most significant octet first) See i.e. http://www.ucs.cam.ac.uk/docs/course-notes/unix-courses/earlier/ipv6-basics/x13

Sander Steffann
  • 9,509
  • 35
  • 40
1

The usual way is either a byte[16] in network order, or a struct sockaddr_in6 if you're writing in C. In Java you'd use an Inet6Addr. (I have never seen anyone use host byte order to store any of the words in an IPv6 address.)

mpontillo
  • 13,559
  • 7
  • 62
  • 90