Wednesday 15 August 2012

IPv6 Address Representation


General

Some of the following is from the Cisco Networking Academy CCNA Discovery course (Semester 4 - Designing and Supporting Computer Networks, Chapter 6). This is the course we followed in College but it is probably too expensive for private study!

An IPv6 address is 128 bits or 16 bytes long : 4 times the bits of IPv4

The IPv6 address is displayed as 32 Hexadecimal digits - divided into 8 blocks of 4 digits each.

The format is
X:X:X:X::X:X:X:X where each X is a 16-bit hexadecimal field.

Note that:
Hexadecimal A, B, C, D, E, F can be written as a, b, c, d, e, f.
Leading zeros in a field are optional AND
Successive fields of zeros can be displayed as a double-colon  ::  - but only once for each address

EXAMPLES:
2031:0000:130F:0000:0000:09C0:876A:130B
can be represented as 2031:0:130f::9c0:876a:130b. (This is a UNICAST address - the main type of IPv6 address)

FF01:0:0:0:0:0:0:1  can be represented as FF01::1 (This is a MULTICAST address.)
0:0:0:0:0:0:0:1      = =        ::1   (this is the IPv6 LOOPBACK address)
0:0:0:0:0:0:0:0      = =         ::    (UNSPECIFIED address e.g. used by a device before it gets its first proper IPv6 address)

UNICAST sends packets to one specific device with one specific address. This is the main type of IPv6 address.

Format of Global Unicast Address:
All Global unicast addresses begin with 2000::/3.  What does this mean? It means that the first 3 Binary Bits (out of 128 bits) are the most significant AND that the first 3 bits must match the value in hex 2000.
Hex 2 = Binary 0010
Hex 0 = Binary 0000
Therefore the Hex field 2000 is the equivalent of Binary 0010 0000 0000 0000
The first 3 bits MUST be 001. Therefore the first 4 bits can be either 0010 OR 0011
Thus a Global Unicast address can start with Hex digit 2 OR Hex digit 3.

Therefore the entire global-unicast IPv6 address range begins at
2000:0000:0000:0000:0000:0000:0000:0000/128 (or 2000::/128 for short)
and ends at
3FFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF/128

Almost all the Global IPv6 address that I have seen mentioned in books, begin with Hex 2. Perhaps the Hex 3s have not yet been issued?

Multicast and Anycast but NO Broadcast
There are NO Broadcast address in IPv6. Their role has been taken over by Multicast addresses and - to a lesser extent - by Anycast addresses:

  • MULTICAST sends a packet to every member of a group. It is a One-to-Many type of address.
  • ANYCAST  addresses send a packet to any one member of the group of devices that has an anycast address assigned. For efficiency, a packet that is sent to an anycast address is delivered to the closest interface. For that reason, anycast can also be thought of as a One-to-Nearest type of address. (Anycast addresses can be used for things like the nearest DNS server or the  nearest DHCP server etc. The address is allocated to a group of servers but the packet is only delivered to the nearest one.)        

Global and Reserved Addresses

The basic types of IPv6 unicast addresses are:
  • Global
  • Reserved (private, loopback, unspecified)   
 The IPv6 Global Unicast Address is the equivalent of an IPv4 registered public address i.e. one that can be used on the Internet.   An example is
2001:99:ab:1:99:2:1:9/64   (leading zeros have been dropped).

Unicast and anycast addresses are typically composed of two logical parts: a 64-bit network prefix used for routing, and a 64-bit interface identifier used to identify a host's network interface.

One method for IPv6 global unicast address assignment is that
  • The Internet Corporation for Assigned Network Numbers (ICANN) allocates large address blocks to Regional Internet Registries (RIRs), 
  • RIRs assign smaller address blocks to Internet Service Providers (ISPs) and 
  • ISPs assign even smaller address blocks to their customers.               
The 64 bit  prefix consists of a  Routing Prefix which comes from the address elements assigned by ICANN, the RIR and the ISP plus a Subnet Prefix assigned by the enterprise that requested the IPv6 address. Typically
  • ICANN assigns the first 12 bits of the Routing prefix
  • the Regional Internet Registry assigns the next 20 bits
  • the ISP assigns the next 16 bits.
This gives a total of 48 bits for the Routing Prefix. Therefore the enterprise can use the next 16 bits as the Subnet Prefix giving a total prefix length of 64 bits. This allows for 2 to the power of 16 subnets - a huge number.

General unicast address format (routing prefix size varies)
bits
48 (or more)
16 (or fewer)
64
field
routing prefix
subnet id
interface identifier
(illustration from the Wikipedia article "IPv6 Address")
http://en.wikipedia.org/wiki/IPv6_address

The allocation of prefix bits may be different from the above e.g. the ISP may take extra bits which means that the enterprise will have less bits for subnetting purposes. However the prefix for a Global Unicast address is almost always 64. Thus the number of bits for the interface ID will also be 64.
NOTE: For one exception see Question C-6 of my "IPv6 Questions and Answers for CCNA Exam"
http://ccnaexam4dummies.blogspot.ie/2012/08/ipv6-questions-and-answers-for-ccna-exam_2435.html

Note re Anycast Address: The format of the Anycast address is the same as that for the  Global Unicast Address. The difference is that the same  Anycast address can be used for a number of different devices!

Reserved Unicast Addresses:

Like IPv4, a block of IPv6 addresses is set aside for private addresses.

Below is the list of common kinds of IPv6 Reserved addresses:
Unspecified address::0 This is used before the interface receives its first
normal IPv6 address
Loopback address::1 This is the equivalent of the IPv4 address 127.0.0.1
It is used to check if the network interface is working
(Ping ::1 to check)
Link Local AddressAssigned with FE80::/64 prefix. Intended for communication within a segment of the local network or for point to point communication. Closest equivalent in IPv4 is 169.254.0.0/16 (this is used in IPv4 when a PC cannot get IP address because DHCP server is out of order.) Every IPv6 devise MUST have a Link Local address.
Unique Local AddressAssigned with FD00::/8 prefix . It is the approximate IPv6 equivalent of the IPv4 Private Addresses (10.0.0.0/8, 172.16.0.0/16 etc). Intended for use in private networks e.g. within a single site or organisation or spanning a limited number of sites/organisations. Not routable on the Internet. This replaces the obsolete Site Local Address.
Site Local Address (obsolete)The site local prefix FEC0::/10 was originally allocated for addresses within the site network of an organisation i.e. it was intended to be the equivalent of IPv4 Private addresses. However problems arose with its use and it has been replaced by the Unique Local Address system.

NOTE: What does FD00::/8 mean? Well the prefix is 8 which means that the first 8 binary bits (out of 128 binary bits) are the most significant AND the first 8 bits must match the value in Hex FD00
Hex F = Binary 1111   (the decimal equivalent is 15)
Hex D = Binary 1101  (the decimal equivalent is 13)
Therefore the first 8 binary bits of a Unique Local Address are
1111 1101

EUI-64 Format for IPv6 addresses

One of IPv6's key benefits over IPv4 is its capability for automatic interface addressing. By implementing the IEEE's 64-bit Extended Unique Identifier (EUI-64) format, a host can automatically assign itself a unique 64-bit IPv6 interface identifier without the need for manual configuration or DHCP. This is done by using  the already unique 48-bit MAC address, and adding inserting a further 16 bits in order to arrive at the 64 bits needed for  the interface part of the 128-bit IPv6 address.

The main step is to convert the 48-bit MAC address to a 64-bit value. To do this, we break the MAC address into its two 24-bit halves: the Organizationally Unique Identifier (OUI) and the NIC specific part. The 16-bit hex value FFFE is then inserted between these two halves to form a 64-bit address.
For example take a MAC address 00:12:7F:EB:6B:40 which can also be written as 0012:7FEB:6B40 . The first 6 Hexadecimal digits of the MAC are the OUI and the second six are the NIC specific part. The MAC address is turned into a 64-bit EUI-64 by inserting FFFE in the middle. Thus we get 0012:7FFF:FEEB:6B40 as the interface portion of the IPv6 address. This is typically done both for the Link-Local address and the Global Unicast address for a specific interface. (Of course the Prefix for the two addresses will be completely different.)

Thus based on the above example you can have an interface that has
(a) a Link Local Address of FE80::0012:7FFF:FEEB:6B40/64 (prefix is FE80:: or FE80:0000:0000:0000 AND
(b) a Global Unique Address of say 2001:99:ab:1:0012:7FFF:FEEB:6B40/64 (Prefix is 2001:99:ab:1 )

The following illustration is from an article by Jeremy Stretch of PacketLife.net
EUI-64 in IPv6 You will note from his article that the EUI-64 process is slightly more complex than I have set out above. However for CCNA exam purposes, it should be enough for you to recognise an EUI-64 address and understand how it relates to the MAC address.

eui64_step1.png

Multicast Addresses


Multicast Addresses in IPv6 have the prefix FF00::/8
What does this mean? Well the prefix is 8 which means that the first 8 binary bits (out of 128 binary bits) are the most significant and must match the value in Hex FF00
Hex F = Binary 1111
Hex 0 = Binary 0000
Therefore the first 8 bits of every IPv6 Multicast address are
1111 1111


Some Important IPv6 Multicast Addresses
FF02::1All Nodes on the local network segment. This is the closest IPv6 equivalent to the IPv4 Broadcast address and is NOT recommended as it uses up a lot of network resources.
FF02::2All Routers on the local network segment
FF02::9RIPng Routers. This is the IPv6 equivalent to the IPv4 Multicast address 224.0.0.9 that is used to send routing information to all RIPv2 Routers in a network segment. (Note the use of "9" in both multicast addresses.)

Note: It is often stated that the Broadcasts of IPv4 have been replaced by the Multicasts AND Anycasts of IPv6. Therefore you would think that an Anycast address should resemble a Multicast one. In fact the Anycast Addresses has the same format as the Glabal Unicast one.


Summary and Reminder for CCNA Exam

The following helped me to remember the differences between the various IPv6 addresses:

(i) An IPv6 Multicast Address begins with FF - the prefix is FF00::/8.
This should be easy to remember.Hex  FF is Binary 1111 1111. In IPv4 the binary number 11111111 translates into decimal 255 - a number that is often associated with Broadcast addresses.

Moving down the alphabet we come to FE.

(ii) An IPv6 Link Local Address begins with FE - the prefix is FE80::/64
The Link Local address is the most important IPv6 Private address. Every IPv6 enabled interface has one and it is automatically created by Stateless Autoconfiguration.

The name Link Local can explain the function of this address. It LINKS the IPv6 device to the LOCAL (in this case the NEXT) device only in one segment of a network  - for example it is used for  point to point communication between two Routers or between a Router and a PC.

Again moving down the alphabet we come to FD.

(iii) The Unique Local Address begins with FD - the prefix is FD::/8.
This is the next most important Private address. Not every IPv6 device has a Unique Local but it has the widest scope of any private address. It spans a single site or organisation or a number of related sites - but it is not routable on the Internet. (I compare this in my mind to the Global Unicast address that spans the entire Internet and ALSO has the letters "Uni" in its name! Well if it helps me to remember why not?)

(iv) Remember that the addresses :: (the unspecified address) and ::1(the loopback address ) are local to their own IPv6 device only. You can think of them as the opposite of the Unique Local address!



1 comment:

  1. One mistake in EUI64 - 7th-bit from left size of OUI have to be inverted (usually from 0 to 1). In effect correct interface ID is 0212:7FFF:FEEB:6B40, not 0012:7FFF:FEEB:6B40

    ReplyDelete