samedi 8 juin 2013

IPV6 intro


Background on IPv6 Addresses


There are different types of IPv6 addresses: Unicast, Anycast and Multicast.
Unicast addresses are the well known addresses. A packet sent to a unicast address arrives exactly at the interface belonging to the address.
Anycast addresses are syntactically indistinguishable from unicast addresses but they address a group of interfaces. The packet destined for an anycast address will arrive at the nearest (in router metric) interface. Anycast addresses may only be used by routers.
Multicast addresses identify a group of interfaces. A packet destined for a multicast address will arrive at all interfaces belonging to the multicast group.
Note: The IPv4 broadcast address (usually xxx.xxx.xxx.255) is expressed by multicast addresses in IPv6.

Reading IPv6 Addresses


The full form is represented as 8 hexquad parcels of 16 bits each written in lower case hexadecimal, separated by colons (:). For example2001:0db8:382b:23c1:aa49:4592:4efe:9982.
Often an address will have long substrings of all zeros; the longest and first run of all zero hexquads is abbreviated as a double colon (“::”). Since :: is variable length, it can only be used once per address. Leading “0”s are also omitted, up to three per hexquad. For example, fe80::1 is the canonical formof fe80:0000:0000:0000:0000:0000:0000:0001 and 2001:db8:b:23c1:49:4592:efe:9982 is the canonical form of2001:0db8:000b:23c1:0049:4592:0efe:9982.
A third form is to write the last 32 bits in the well known dotted decimal IPv4 style. For example 2002::10.0.0.1 corresponds to the (hexadecimal) long representation 2002:0000:0000:0000:0000:0000:0a00:0001 with canonical form 2002::a00:1.
By now the reader should be able to understand the following:
# ip addr
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:25:ad:2c:af:17 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.2/24 scope global eth0
    inet6 fe80::225:adff:fe2c:af17/64 scope link 
       valid_lft forever preferred_lft forever

fe80::225:adff:fe2c:af17 of interface eth0 is an autoconfigured link-local address. It is generated as an IEEE EUI-64 style identifier from the device's hardware IEEE EUI-48(MAC) address as part of the autoconfiguration.
For further information on the structure of IPv6 addresses see RFC3513.

Special IPv6 address ranges


Address ranges are specified using a prefix. This is similar to the IPv4 concept of a network prefix and netmask, but in IPv6 we always use CIDR notation to specify the number of bits at the start of the mask that are 1. For example, the address range fe80::/10 includes all addresses that are the same as the address fe80:: in the first 10 bits, i.e. all beginning with the bit pattern 1111 1110 10. One hex digit corresponds to four bits: 1111 is f1110 is e10 is the most significant two bits of 1000 which is 8 in hex, but since this length is not a multiple of 4, the range also includes addresses with this digit set to 9(1001), a (1010) and b (1011). Obviously a network prefix of length 128 specifies an individual address.
IPv6 address
Prefix length (bits)
Description
Notes

::
128
unspecified
Used for default route and router solicitations. cf. 0.0.0.0 in IPv4

::1
128
loopback address
cf. 127.0.0.1 in IPv4

::ffff:a.b.c.d
96
IPv4 mapped IPv6 address
The lower 32 bits are the IPv4 address. Used in socket API's to represent IPv4 hosts.

fe80::
10
link-local
Unroutable autoconfigured addresses used on a LAN, e.g. for DHCPv6

fc00::
7
unique local
Addresses used only within an autonomous system, unroutable globally. Cf. RFC 1918 addresses such as used in NAT.

ff00::
8
multicast

2000::
3
global unicast
All global unicast addresses currently begin with 2.

Some IPv6 address prefixes have been deprecated, and should no longer be used.
deprecated IPv6 address
Prefix length (bits)
Description
Notes

3ffe::
16
6bone prefix
Used 1998-2006.

::a.b.c.d
96
embedded IPv4
96 zero bits followed by 32 IPv4 bits. Also called “IPv4 compatible IPv6 address”. Replaced by mapped addresses.

fec0::
10
site-local
Replaced by Unique Local Addresses

Some address prefixes are special use:
special IPv6 address
Prefix length (bits)
Description
Notes

2001:db8::
32
documentation examples
Not to be routed.

2001:0::
32
Teredo tunnels
the remaining bits come from a Teredo server and the client NAT device.

2002::
16
6to4 tunnels
the next 32 bits are the client IPv4 address