(no commit message)
[ikiwiki.git] / docs / handbook / handbook-network-ipv6.mdwn
1 \r
2 \r
3 ## 19.16 IPv6 \r
4 \r
5 ***Originally Written by Aaron Kaplan. ******Restructured and Added by Tom Rhodes. ***\r
6 \r
7 IPv6 (also know as IPng ***IP next generation***) is the new version of the well known IP protocol (also know as IPv4). Like the other current *BSD systems, DragonFly includes the KAME IPv6 reference implementation. So your DragonFly system comes with all you will need to experiment with IPv6. This section focuses on getting IPv6 configured and running.\r
8 \r
9 In the early 1990s, people became aware of the rapidly diminishing address space of IPv4. Given the expansion rate of the Internet there were two major concerns:\r
10 \r
11
12 * Running out of addresses. Today this is not so much of a concern anymore since private address spaces (`10.0.0.0/8`, `192.168.0.0/24`, etc.) and Network Address Translation (NAT) are being employed.\r
13
14 * Router table entries were getting too large. This is still a concern today.\r
15 \r
16 IPv6 deals with these and many other issues:\r
17 \r
18
19 * 128 bit address space. In other words theoretically there are 340,282,366,920,938,463,463,374,607,431,768,211,456 addresses available. This means there are approximately 6.67 * 10^27 IPv6 addresses per square meter on our planet.\r
20
21 * Routers will only store network aggregation addresses in their routing tables thus reducing the average space of a routing table to 8192 entries.\r
22 \r
23 There are also lots of other useful features of IPv6 such as:\r
24 \r
25
26 * Address autoconfiguration ([RFC2462](http://www.ietf.org/rfc/rfc2462.txt))\r
27
28 * Anycast addresses (***one-out-of many***)\r
29
30 * Mandatory multicast addresses\r
31
32 * IPsec (IP security)\r
33
34 * Simplified header structure\r
35
36 * Mobile IP\r
37
38 * IPv4-to-IPv6 transition mechanisms\r
39 \r
40 For more information see:\r
41 \r
42
43 * IPv6 overview at [playground.sun.com](http://playground.sun.com/pub/ipng/html/ipng-main.html)\r
44
45 * [KAME.net](http://www.kame.net)\r
46
47 * [6bone.net](http://www.6bone.net)\r
48 \r
49 ### 19.16.1 Background on IPv6 Addresses \r
50 \r
51 There are different types of IPv6 addresses: Unicast, Anycast and Multicast.\r
52 \r
53 Unicast addresses are the well known addresses. A packet sent to a unicast address arrives exactly at the interface belonging to the address.\r
54 \r
55 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.\r
56 \r
57 Multicast addresses identify a group of interfaces. A packet destined for a multicast address will arrive at all interfaces belonging to the multicast group.\r
58 \r
59  **Note:** The IPv4 broadcast address (usually `xxx.xxx.xxx.255`) is expressed by multicast addresses in IPv6.\r
60 \r
61  **Table 19-2. Reserved IPv6 addresses** \r
62 \r
63 [[!table  data="""
64 | IPv6 address | Prefixlength (Bits) | Description | Notes 
65  `::` | 128 bits | unspecified | cf. `0.0.0.0` in IPv4 
66  `::1` | 128 bits | loopback address | cf. `127.0.0.1` in IPv4 
67  `::00:xx:xx:xx:xx` | 96 bits | embedded IPv4 | The lower 32 bits are the IPv4 address. Also called ***IPv4 compatible IPv6 address*** 
68  `::ff:xx:xx:xx:xx` | 96 bits | IPv4 mapped IPv6 address | The lower 32 bits are the IPv4 address. For hosts which do not support IPv6. 
69  `fe80::` - `feb::` | 10 bits | link-local | cf. loopback address in IPv4 
70  `fec0::` - `fef::` | 10 bits | site-local |  
71  `ff::` | 8 bits | multicast |  
72  `001` (base 2) | 3 bits | global unicast | All global unicast addresses are assigned from this pool. The first 3 bits are ***001***. |\r
73 """]]\r
74 ### 19.16.2 Reading IPv6 Addresses \r
75 \r
76 The canonical form is represented as: `x:x:x:x:x:x:x:x`, each ***x*** being a 16 Bit hex value. For example `FEBC:A574:382B:23C1:AA49:4592:4EFE:9982`\r
77 \r
78 Often an address will have long substrings of all zeros therefore each such substring can be abbreviated by ***::***. For example `fe80::1` corresponds to the canonical form `fe80:0000:0000:0000:0000:0000:0000:0001`.\r
79 \r
80 A third form is to write the last 32 Bit part in the well known (decimal) IPv4 style with dots ***.*** as separators. For example `2002::10.0.0.1` corresponds to the (hexadecimal) canonical representation `2002:0000:0000:0000:0000:0000:0a00:0001` which in turn is equivalent to writing `2002::a00:1`.\r
81 \r
82 By now the reader should be able to understand the following:\r
83 \r
84     \r
85     # ifconfig\r
86 \r
87 \r
88     \r
89     rl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500\r
90              inet 10.0.0.10 netmask 0xffffff00 broadcast 10.0.0.255\r
91              inet6 fe80::200:21ff:fe03:8e1%rl0 prefixlen 64 scopeid 0x1\r
92              ether 00:00:21:03:08:e1\r
93              media: Ethernet autoselect (100baseTX )\r
94              status: active\r
95 \r
96 \r
97 `fe80::200:21ff:fe03:8e1%rl0` is an auto configured link-local address. It includes the scrambled Ethernet MAC as part of the auto configuration.\r
98 \r
99 For further information on the structure of IPv6 addresses see [RFC3513](http://www.ietf.org/rfc/rfc3513.txt).\r
100 \r
101 ### 19.16.3 Getting Connected \r
102 \r
103 Currently there are four ways to connect to other IPv6 hosts and networks:\r
104 \r
105
106 * Join the experimental 6bone\r
107
108 * Getting an IPv6 network from your upstream provider. Talk to your Internet provider for instructions.\r
109
110 * Tunnel via 6-to-4\r
111
112 * Use the [`net/freenet6`](http://pkgsrc.se/net/freenet6) port if you are on a dial-up connection.\r
113 \r
114 Here we will talk on how to connect to the 6bone since it currently seems to be the most popular way.\r
115 \r
116 First take a look at the [6bone](http://www.6bone.net/) site and find a 6bone connection nearest to you. Write to the responsible person and with a little bit of luck you will be given instructions on how to set up your connection. Usually this involves setting up a GRE (gif) tunnel.\r
117 \r
118 Here is a typical example on setting up a [gif(4)](http://leaf.dragonflybsd.org/cgi/web-man?command#gif&section4) tunnel:\r
119 \r
120     \r
121     # ifconfig gif0 create\r
122     # ifconfig gif0\r
123     gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280\r
124     # ifconfig gif0 tunnel `***MY_IPv4_ADDR***`  `***HIS_IPv4_ADDR***`\r
125     # ifconfig gif0 inet6 alias `***MY_ASSIGNED_IPv6_TUNNEL_ENDPOINT_ADDR***`\r
126 \r
127 \r
128 Replace the capitalized words by the information you received from the upstream 6bone node.\r
129 \r
130 This establishes the tunnel. Check if the tunnel is working by [ping6(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#ping6&section8) 'ing `ff02::1%gif0`. You should receive two ping replies.\r
131 \r
132  **Note:** In case you are intrigued by the address `ff02:1%gif0`, this is a multicast address. `%gif0` states that the multicast address at network interface `gif0` is to be used. Since we `ping` a multicast address the other endpoint of the tunnel should reply as well.\r
133 \r
134 By now setting up a route to your 6bone uplink should be rather straightforward:\r
135 \r
136     \r
137     # route add -inet6 default -interface gif0\r
138     # ping6 -n `***MY_UPLINK***`\r
139 \r
140 \r
141     \r
142     # traceroute6 www.jp.FreeBSD.org\r
143     (3ffe:505:2008:1:2a0:24ff:fe57:e561) from 3ffe:8060:100::40:2, 30 hops max, 12 byte packets\r
144          1  atnet-meta6  14.147 ms  15.499 ms  24.319 ms\r
145          2  6bone-gw2-ATNET-NT.ipv6.tilab.com  103.408 ms  95.072 ms *\r
146          3  3ffe:1831:0:ffff::4  138.645 ms  134.437 ms  144.257 ms\r
147          4  3ffe:1810:0:6:290:27ff:fe79:7677  282.975 ms  278.666 ms  292.811 ms\r
148          5  3ffe:1800:0:ff00::4  400.131 ms  396.324 ms  394.769 ms\r
149          6  3ffe:1800:0:3:290:27ff:fe14:cdee  394.712 ms  397.19 ms  394.102 ms\r
150 \r
151 \r
152 This output will differ from machine to machine. By now you should be able to reach the IPv6 site [www.kame.net](http://www.kame.net) and see the dancing tortoise -- that is if you have a IPv6 enabled browser such as [`www/mozilla`](http://pkgsrc.se/www/mozilla).\r
153 \r
154 ### 19.16.4 DNS in the IPv6 World \r
155 \r
156 There are two new types of DNS records for IPv6:\r
157 \r
158
159 * AAAA records,\r
160
161 * A6 records\r
162 \r
163 Using AAAA records is straightforward. Assign your hostname to the new IPv6 address you just got by adding:\r
164 \r
165     \r
166     MYHOSTNAME           AAAA    MYIPv6ADDR\r
167 \r
168 \r
169 To your primary zone DNS file. In case you do not serve your own DNS zones ask your DNS provider. Current versions of  **bind**  (version 8.3 and 9) support AAAA records.\r
170 \r
171 \r
172 \r
173 CategoryHandbook\r
174 CategoryHandbook-advancednetworking\r