Notes:IPv6

From Maths
Jump to: navigation, search

Important things

  • 128 bits long =16 bytes.[1]
  • Left-most bytes are "high order" rightmost are low order[2] - as expected.

String representation

IPv6 addresses are represented by 8 blocks of 2 bytes = 8 blocks of 4 hex digits[2], separated by colons (:)[2], subject to the following rules:

  1. Leading 0s can be left out. There must be at least 1 digit in every field except for a special case[2]
  2. :: may occur 0 or 1 time in an address. It means "the missing blocks (where this symbol is) consist of all 0s"[2] so:
    • 1234::5678 consists of 1234 then 6 blocks of 0000 then 5678
  3. The last 2 blocks / 4 bytes of data may be specified in w.x.y.z form, where w,x,y and [ilmath]z[/ilmath] are numbers in the range 0 to 255 inclusive. This is an IPv4 address format.
    • ::1.2.3.4 is 6 blocks of 0000 followed by 102, followed by 304

Address prefixes

  • Format: ipv6-address "/" prefix-length[2] where:
    • ipv6-address is a valid address in any of the above notations and
    • the prefix-length field is a decimal number of the number of leftmost bits that comprise the prefix.

Example

the node address      2001:0DB8:0:CD30:123:4567:89AB:CDEF
and its subnet number 2001:0DB8:0:CD30::/60

can be abbreviated as 2001:0DB8:0:CD30:123:4567:89AB:CDEF/60
Straight from[2] notice that 60 bits are ignored. 2001:0DB8:0:CD30 is 64 bits, so 4 bits (half of the 0 in CD30) are NOT a part of the subnet identification.

Note in the example you cannot turn 2001:0DB8:0:CD30::/60 into 2001:0DB8:0:CD3::/60 as a block called "CD3" represents 0CD3 - which is not what we want here.

If the bits of the prefix is divisible exactly by 16, it's nice amount of blocks, otherwise we'll need one more block which will contain up to 15 extra bits of information.

Question: is there a standard form? Should the "extra" bits be 0? For example FFFF::/8 is the same as FF00::/8, does it matter? If we have F000::/7 that's the same as E000::/7 right? Letters can be deceptive.

Special addresses

  • :: -"unspecified" address[2] (all blocks 0)
    • Indicates "absence of address"[2]
    • May be used as a source address by hosts yet to learn their address[2]
    • Never used as destination address[2]
    • Packets are not to be forwarded by routers if they have this as a source address[2]
  • ::1 - loopback address[2]
    • Used to for a host to send packets to itself[2]
    • Not assigned to a physical interface[2]
      Corollary: never used as source address for packet leaving node.
    • if destination, must never be forwarded by router, must be dropped if received on an interface[2]
    • Link-local scope[2]

Special address ranges

Range Name Binary prefix Comment
::/128[2] unspecified 00...0 A part of the subset :: (128 bits - all 0)
::1/128[2] loopback 00...01 Localhost. this is apart of the subnet ::1 - 128 bit subnet
FF00::/8 Multicast 1111 1111 High order byte is all 1s.
FE80::/10 Link-local unicast 1111 1110 10 We only require the hi 2 bits of the 2nd 16 bits of FE80[Note 1]
(remainder) Global unicast

Deprecated ranges

Range Name Binary prefix Comment
::/96[2] IPv4-Compatible IPv6 addresses 00...0 Deprecated now[2].
FEC0::/10[2] site-local unicast 1111 1110 11 Deprecated[2] - treat as global unicast

Embedding IPv4 in IPv6 space

There are 2 types of IPv6 address designed to carry an IPv4 address. They both carry the IPv4 address in their lower bits[2]. The types are:

  1. IPv4-Compabile IPv6 address[2] - ::/96
  2. IPv4-mapped IPv6 address[2] - ::FFFF:0/96

IPv4-Compatible IPv6 address

These are all 0s except for the last 32 bits, which are the bits of the IPv4 address. That is ::w.x.y.z for an IPv4 address: w.x.y.z[2].

  • Deprecated - new implementations need not support this[2].
    • Was deprecated due to lack of usage.

IPv4-Mapped IPv6 address

This represents IPv4 nodes as IPv6 addresses. The format is ::FFFF:w.x.y.z for an IPv4 w.x.y.z[2]

Notes

  1. That means if we have the hex string XY it doesn't matter what X is (as long as the upper two bits are 10) and Y can take any value.

References

  1. https://tools.ietf.org/html/rfc2460
  2. 2.00 2.01 2.02 2.03 2.04 2.05 2.06 2.07 2.08 2.09 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.17 2.18 2.19 2.20 2.21 2.22 2.23 2.24 2.25 2.26 2.27 2.28 https://tools.ietf.org/html/rfc4291