User:Stefan00/IPV6 Addresses Introduction

From Gentoo Wiki
Jump to:navigation Jump to:search

DRAFT

Overview

The purpose of this article is to provide a short and simple introduction on IPv6 addresses and mechanisms. It is not intended to be a detailed technical documentation.

It is often claimed that IPv6 is not much different compared to IPv4 - just better and future proof. That's almost true. Yes, it is better and once fully understood it's great. But it is different compared to IPv4.

IPv6 Address basics

1. General Format

Every IPv6 Address is

  • 128 Bit long
  • noted in groups of 8x4 hex groups
  • hex groups divided by colons


Example IPv6 address:

2a02:810a:8240:0a2c:0202:c8ff:feeb:66d0
Note
Shortening: IPv6 addresses can be "shortened" when containing leading Zeros. See examples at the bottom of this page.

2. Prefix and Suffix

IPv6 addresses are always constructed out of 2 parts:

  • The Prefix - left part
  • The Suffix - right part


The Example from above divided into Prefix and Suffix:

2a02:810a:8240:0a2c  :  0202:c8ff:feeb:66d0
      PREFIX                  SUFFIX

Although combined in a single address, the two parts have completely different meanings. In a very simple way, think of it as:

  • Prefix is the network part of an address. If defines which network segment this address belongs to, where it can be routed, where it is valid.
  • Suffix is the interface part of an address. It's the "address" of the actual network interface within a network. It can be thought of as the "local" part of an IPv6. Every network interface (physical or virtual) has its own suffix which must be unique within a network. That's why, the official name of the suffix is "Interface Identifier (IID)".

3. Common Prefixes / Scopes

As written above, the Prefix part is the "network part" of an address. It defines what network it belongs to and where packages can be routed to - the Scope.

For setting up and administering IPv6 networks, it is necessary to clearly understand the meaning of prefixes. For example, the smallest routable "network" is a computer itself. That's why the smallest routable scope is loopback - packages send on this interface can only reach the local machine.

Just like in IPv4, some IPv6 address blocks are reserved for special purposes. To get started with the table below, think of a block as "Prefix begins with..."

Common prefixes used in popular networks
Block Valid Examples Scope Explanation
::1
0000:0000:0000:0000:0000:0000:0000:0001
::1 (^short)
Machine only Local Loopback Address (lo)
  • not a block - just the single address ::1
  • IPv4 counterpart: 127.0.0.1
fe80 - febf
fe80:0000:0000:0000:0202:c9ff:feeb:65d0
fe80::c9ff:feeb:65d0 (^short)
fe80:0000:0000:0000:0000:0000:0000:0020
fe80::20 (^short)
Local Network Link-Local Unicast

The address of an interface in the local network

  • Always created by the kernel.
  • Valid within a local network.
  • No internet connectivity.
  • used basically for status messages only, not for traffic
  • most common auto-created: fe80:
  • theoretical range: fe80: to febf:
fd00 - fdff
fd00:0000:0000:0000:0202:c9ff:feeb:65d0
fd00::0202:c9ff:feeb:65d0 (^short)
fdfa:000a:0000:0000:0202:c9ff:feeb:65d0
fdfa:a::0202:c9ff:feeb:65d0 (^short)
fd00:0000:0000:0000:0000:0000:0000:0001
fd00::1 (^short)
Local Network Unique Local Address (ULA)
  • Similar to fe80 addresses
  • Valid within a local network.
  • No internet connectivity.
  • Prefixes valid from fd00:0000:0000 to fdff:ffff:ffff
  • IPv4 counterpart: e.g. 192.168.0.20
all others
2a02:810a:8240:0a2c:0202:c9ff:feeb:65d0
2a02:810a:8240:0a2c:0000:0000:0000:0001
2a02:810a:8240:0a2c:1 (^short)
2001:4860:4860:0000:0000:0000:0000:8888
2001:4860:4860::8888 (^short)
Global Global Unicast
  • globally Unique
  • Internet connectivity
  • globally routable
  • Range in theory: Valid unless reserved by iana
  • This prefix can not be self-assigned. It must be obtained by an ISP. When on dialup, it's received (and usually advertised) by the router.
Note
Currently, only the blocks 2000: to 3fff: are allocated to organizations. So in practice today, a global unique IPv6 address will start with 2000: - 3fff:
Note
This list is by far not complete. It shows some common prefixes. For detailed information on all special blocks consult the iana website

4. Multiple IPv6 addresses on each interface

IPv6 uses multiple addresses on a single network interface. That's one of the most important aspects of IPv6. Period. Always keep this in mind!

By nature, IPv6 is divided in Scopes as seen above. Already be seeing the prefix of an address, it's clear where the address is valid and so where packages can be routed to. For example:

  • an address starting with fe80: (link local) can not reach the internet.
  • a network package from ::1 (loopback) can not even reach another machine.

IPv6 routing is smart. It always chooses the right IPv6 address to reach the right network segment.

A basic working IPv6 configuration could be:

root #ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.35  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 2a02:810a:8240:a2c:9802:79ff:fe45:ced2  prefixlen 64  scopeid 0x0<global>
        inet6 fd00::9802:79ff:fe45:ced2  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::9802:79ff:fe45:ced2  prefixlen 64  scopeid 0x20<link>
        ether 9a:02:79:45:ce:d2  txqueuelen 1000  (Ethernet)
        ...
IP adress Link Scope Explanation
192.168.0.35
Local Network the IPv4 local network address
2a02:810a:8240:a2c:9802:79ff:fe45:ced2
Global The Global address used to access the internet
  • the Prefix Part 2a02:810a:8240:a2c: is received from by router from the ISP
  • then the Prefix is advertised to all local network clients
  • the Suffix Part is locally constructed by the kernel
  • finally, the kernel puts together PREFIX: and :SUFFIX. The result is a global unique, routable address.
fd00::9802:79ff:fe45:ced2
Local Network Unique Local Address(ULA)
  • the Prefix Part fd00: announced from the router
  • the Suffix Part is locally constructed by the kernel
  • the kernel puts together PREFIX: and :SUFFIX. The result is a local network unique address.
fe80::9802:79ff:fe45:ced2
Local Network Link Local Address
  • auto-generated by the kernel
  • for status messages to local networg neighbours