## Understand IPv6 address theory ##

[Author](authors.html): Brett Mahar brett.maharATgmailDOTcom OpenBSD

[Reviewer](technical_reviewers.html): _name_ _[[contact]]_ _[[BSD_flavour]]_

[Reviewer](technical_reviewers.html): _name_ _[[contact]]_ _[[BSD_flavour]]_

----



### Concept ###

Be able to recognize basic IPv6 addressing
theory including: the components of an IPv6(((IPv6))) address;
the support for multiple addresses (link, local, global) per interface;
address and prefix representation (aaaa:bbbb::dddd/17) and the address
format (48bit prefix, 16bit subnet, 64 hostbits). In addition,
understand the autoconfiguration(((autoconfiguration, IPv6)))
process where the router sends its prefix or gets queried and the
host adds its 64 host-bits which are derived from its MAC(((MAC)))
address. Finally, be able to troubleshoot basic
IPv6 connectivity.


### Introduction ###

RFC (Request For Comment) 1884 describes the format of IPv6 addresses. Their preferred form is 8 fields of 16-bit addresses (x:x:x:x:x:x:x:x), expressed in hexadecimal notation. The delimiters in IPv6 are colons (unlike IPv4, which uses decimal points as delimiters, as in 127.0.0.1).

The standard specifies that leading zeros in each field can be left off, and a continious series of fields containing all zeros can be compressed to ::.
For example, the above addresses can be written (and read) more easily as: 
        ::13.1.68.3 
        ::FFFF:129.144.52.38 

As there will be a long period of time where IPv4 and IPv6 addresses coexist, addresses can also be written in a combination form x:x:x:x:x:x:d.d.d.d. This could be used for example, where IPv4 addresses are in use on desktop terminals in a company using an IPv6 network. For example:

        0:0:0:0:0:0:13.1.68.3 
        0:0:0:0:0:FFFF:129.144.52.38  

Unicast addresses are those that refer to a single interface on a host (eg network card on a desktop computer). These addresses are unique and enable packets sent over the IPv6 network to reach that particular host. 

Anycast addresses can be shared by multiple interfaces. When a switch or router receives a packet whose next destination is an anycast address, it sends it to the nearest one (in network terms). For example, this type of address could be useful to identify the set of routers that mark the entry/exit point of a corporate network. 

An IPv6 address is 128 bits long. For unicast and anycast addresses, the least significant (last) 64 bits is used to identify the particular interface, and most commonly is derived from the interface's 48-bit-long MAC address, though can be assigned manually. The most significant 64 bits represent the network prefix, and can be further divided amongst particular ISPs, geographic areas, etc.

A multicast address signifies a group of interfaces. All multicast address begin with 0xff (in binary 11111111). Well-known multicast addresses include ff02::1 (all nodes on the local network), ff02::2 (all routers on the network), and ff0x::101 (Network Time Protocol).

Address ranges are written in the same format as IPv4 CIDR notation. Commonly seen ranges are /48 and /64.

On BSD systems, the startup process involves a node automatically creating a link-local address on each interface. This is in addition to any globally routable addresses. This address has the prefix fe80::/64.

In IPv4 interfaces, addresses are typically obtained via DHCP. IPv6 hosts normally use the Neighbor Discovery Protocol to ask for an address assignment via router solicitation, the IPv6 router sends back a globally routable (unique) unicast address.


### Examples ###


1080::8:800:200C:417A             a unicast address 

FF01::43                                     a multicast address 

::1                                              the loopback address 

::                                                the unspecified addresses 

### Practice Exercises ###


### More information ###

ifconfig(8), ping6(8), rtsol(8), inet6(4), icmp6(4)


