Gentoo Archives: gentoo-commits

From: "Le Zhang (r0bertz)" <r0bertz@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo commit in xml/htdocs/doc/zh_cn: ipv6.xml metadoc.xml
Date: Mon, 04 Apr 2011 04:48:08
Message-Id: 20110404044755.C549320054@flycatcher.gentoo.org
1 r0bertz 11/04/04 04:47:55
2
3 Modified: metadoc.xml
4 Added: ipv6.xml
5 Log:
6 [zh_cn] added ipv6.xml
7
8 Revision Changes Path
9 1.69 xml/htdocs/doc/zh_cn/metadoc.xml
10
11 file : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/zh_cn/metadoc.xml?rev=1.69&view=markup
12 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/zh_cn/metadoc.xml?rev=1.69&content-type=text/plain
13 diff : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/zh_cn/metadoc.xml?r1=1.68&r2=1.69
14
15 Index: metadoc.xml
16 ===================================================================
17 RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/zh_cn/metadoc.xml,v
18 retrieving revision 1.68
19 retrieving revision 1.69
20 diff -u -r1.68 -r1.69
21 --- metadoc.xml 17 Oct 2010 16:43:46 -0000 1.68
22 +++ metadoc.xml 4 Apr 2011 04:47:55 -0000 1.69
23 @@ -1,6 +1,6 @@
24 <?xml version="1.0" encoding="UTF-8"?>
25 <!DOCTYPE metadoc SYSTEM "/dtd/metadoc.dtd">
26 -<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/zh_cn/metadoc.xml,v 1.68 2010/10/17 16:43:46 r0bertz Exp $ -->
27 +<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/zh_cn/metadoc.xml,v 1.69 2011/04/04 04:47:55 r0bertz Exp $ -->
28 <!-- English CVS version: 1.228 -->
29 <metadoc lang="zh_cn" parent="/doc/en/metadoc.xml">
30 <version>1.150</version>
31 @@ -207,7 +207,7 @@
32 <file id="ltsp">/doc/en/ltsp.xml</file>
33 <file id="gentoolkit">/doc/zh_cn/gentoolkit.xml</file>
34 <file id="gnupg-user">/doc/zh_cn/gnupg-user.xml</file>
35 - <file id="ipv6">/doc/en/ipv6.xml</file>
36 + <file id="ipv6">/doc/zh_cn/ipv6.xml</file>
37 <file id="guide-localization">/doc/zh_cn/guide-localization.xml</file>
38 <file id="guide-to-mutt">/doc/zh_cn/guide-to-mutt.xml</file>
39 <file id="uml">/doc/en/uml.xml</file>
40 @@ -370,6 +370,7 @@
41 <file id="multipath">/doc/en/multipath.xml</file>
42 <file id="bind-guide">/doc/zh_cn/bind-guide.xml</file>
43 <file id="devmanual">/proj/en/qa/devmanual.xml</file>
44 + <file id="git-howto">/doc/zh_cn/git-howto.xml</file>
45 </files>
46 <docs>
47 <doc fileid="devmanual">
48
49
50
51 1.1 xml/htdocs/doc/zh_cn/ipv6.xml
52
53 file : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/zh_cn/ipv6.xml?rev=1.1&view=markup
54 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/zh_cn/ipv6.xml?rev=1.1&content-type=text/plain
55
56 Index: ipv6.xml
57 ===================================================================
58 <?xml version="1.0" encoding="UTF-8"?>
59 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
60 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/zh_cn/ipv6.xml,v 1.1 2011/04/04 04:47:55 r0bertz Exp $ -->
61 <!-- English CVS version: 1.37 -->
62 <guide link="/doc/zh_cn/ipv6.xml" lang="zh_cn">
63 <title>Gentoo IPv6路由指南</title>
64
65 <author title="开发者">
66 <mail link="latexer@g.o">Peter Johanson</mail>
67 </author>
68 <author title="编辑">
69 <mail link="peesh@g.o">Jorge Paulo</mail>
70 </author>
71 <author title="编辑, 校对">
72 <mail link="swift@g.o">Sven Vermeulen</mail>
73 </author>
74 <author title="编辑">
75 <mail link="cam@g.o">Camille Huot</mail>
76 </author>
77 <author title="编辑">
78 <mail link="okun@××××.fi">Pasi Valminen</mail>
79 </author>
80 <author title="编辑">
81 <mail link="nightmorph"/>
82 </author>
83 <author title="译者">
84 <mail link="geraint0923@×××××.com">杨扬</mail>
85 </author>
86
87 <abstract>
88 这篇文章将指导你在Gentoo系统上安装配置IPv6。内容包括使用隧道代理来建立隧道, 一些基本的DNS设置以及配置客户端使得系统能够连接IPv6的地址。
89 </abstract>
90
91 <!-- The content of this document is licensed under the CC-BY-SA license -->
92 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
93 <license/>
94
95 <version>4</version>
96 <date>2011-03-02</date>
97
98 <chapter>
99 <title>准备工作</title>
100 <section>
101 <title>基本的内核配置</title>
102 <body>
103
104 <p>
105 Gentoo里任何一个2.6系列的内核版本都可以很容易地支持IPv6连接。自从2.6.0版本以来,新版USAGI IPv6协议栈已经被集成到了内核里面。
106 </p>
107
108 <pre caption="安装内核">
109 # <i>emerge gentoo-sources</i>
110 </pre>
111
112 <p>
113 现在我们准备进入内核源代码的目录,并且开始我们实际的内核配置
114 </p>
115
116 <pre caption="配置Linux内核">
117 # <i>cd /usr/src/linux</i>
118 # <i>make menuconfig</i>
119 </pre>
120
121 <note>
122 这里假设 <path>/usr/src/linux</path> 已经指向你将要使用的内核。
123 </note>
124
125 <pre caption="'make menuconfig' 选项">
126 Device Drivers ---&gt;
127 Networking support ---&gt;
128 Networking options ---&gt;
129 &lt;*&gt; The IPv6 protocol (EXPERIMENTAL)
130 <comment>(这个选项下面的IPv6子选项对于很多其他的应用程序有用,</comment>
131 <comment>但是对于基本的安装来说这不是必要的)</comment>
132
133 <comment>(这个选项只有在你想使用ptrtd来进行6to4转换时才需要)</comment>
134 [*] Network device support
135 &lt;*&gt; Universal TUN/TAP device driver support
136 </pre>
137
138 </body>
139 </section>
140 <section>
141 <title>测试IPv6支持</title>
142 <body>
143
144 <p>
145 在开启了推荐的选项之后,重新编译您的内核并且重新启动,进入到您已经开启了IPv6支持的内核中。
146 </p>
147
148 <p>
149 如果您还没有安装<b>iproute2</b>,我们建议您现在就安装。
150 iproute2是一款的网络套件,其中包含了著名的<c>ip</c>,它可以替代<c>ifconfig</c>, <c>route</c>, <c>iptunnel</c> ...
151 </p>
152
153 <pre caption="安装iproute2">
154 # <i>emerge sys-apps/iproute2</i>
155 </pre>
156
157 <warn>
158 如果您拥有多个隧道设备,那么使用ifconfig会引发严重的问题。您必须按倒序移除隧道,也就是说最新的隧道首先被移除。您已经被警告。
159 </warn>
160
161 <p>
162 如果IPv6正在工作,回环设备将会显示一个IPv6的地址:
163 </p>
164
165 <pre caption="检查回环设备">
166 # <i>ip -6 addr show lo</i>
167 1: lo: &lt;LOOPBACK,UP&gt; mtu 16436
168 inet6 ::1/128 scope host
169 valid_lft forever preferred_lft forever
170 <comment>(上面的这一行表明一切正常)</comment>
171 </pre>
172
173 <p>
174 在进行下一步的操作之前,请确保您已经将<e>ipv6</e>添加到您<path>make.conf</path>的USE变量列表中,这样在将来安装的软件包才会包含IPv6支持。
175 </p>
176
177 </body>
178 </section>
179 </chapter>
180
181 <chapter>
182 <title>隧道配置</title>
183 <section>
184 <title>基本的配置</title>
185 <body>
186
187 <p>
188 很多ISP(互联网服务供应商)仍旧不提供任何原生IPv6的连接。为了避开这一限制,全球有几家“隧道代理”提供免费的IPv6隧道。这将允许您在IPv4连接中使用隧道来完成你您所有的IPv6连接。
189 </p>
190
191 <table>
192 <tr><th>Broker</th><th>Location</th></tr>
193 <tr>
194 <ti><uri link="http://tunnelbroker.net/">Hurricane Electric</uri></ti>
195 <ti>North America, Europe, Asia</ti>
196 </tr>
197 <tr>
198 <ti><uri link="http://gogonet.gogo6.com/">Freenet6</uri></ti>
199 <ti>US</ti>
200 </tr>
201 <tr>
202 <ti><uri link="http://www.sixxs.net/">Sixxs</uri></ti>
203 <ti>Europe</ti>
204 </tr>
205 <tr>
206 <ti><uri link="http://tunnel-broker.singnet.com.sg/">Singnet</uri></ti>
207 <ti>Singapore</ti>
208 </tr>
209 <tr>
210 <ti><uri link="http://broker.aarnet.net.au/">Aarnet</uri></ti>
211 <ti>Australia/South Pacific</ti>
212 </tr>
213 </table>
214
215 <p>
216 下面是两个利用Hurricane Electric(也可以从sixxs.net获取隧道)和Freenet6这两个北美的隧道进行设置的例子。
217 </p>
218
219 </body>
220 </section>
221 <section>
222 <title>Hurricane Electric</title>
223 <body>
224
225 <p>
226 Hurricane Electric(简称HE)提供免费的IPv6隧道,同时为您提供一个/64的地址块。它还允许您设置反向DNS。从HE获取一个隧道是很容易的,只需要到<uri>http://www.tunnelbroker.net/</uri>填写一页的表格。
227 </p>
228
229 <note>
230 注册包含一系列的信息,比如您的地址和电话号码。
231 </note>
232
233 <p>
234 当您的隧道得到批准并且被分配了一个/64的地址块之后,您就能够设置您的Gentoo了。HE提供了基于ifconfig和iproute工具的示例。在接下来的两个例子中,假设您拥有下面的设置:
235 </p>
236
237 <table>
238 <tr>
239 <ti>Local IPv4 Address (eth0)</ti><ti>68.36.91.195</ti>
240 </tr>
241 <tr>
242 <ti>HE IPv4 Address</ti><ti>64.71.128.82</ti>
243 </tr>
244 <tr>
245 <ti>Local IPv6 tunnel Address</ti><ti>2001:470:1F00:FFFF::189</ti>
246 </tr>
247 <tr>
248 <ti>IPv6 Block</ti><ti>2001:470:1F00:296::/64</ti>
249 </tr>
250 </table>
251
252 <p>
253 使用iproute2包和<c>ip</c>命令,您可以按下面那样做:
254 </p>
255
256 <pre caption="配置一个IPv6隧道">
257 <comment>(在本地(eth0)IPv4和HE的远程IPv4地址(HE's remote IPv4 address)之间创建一个隧道)</comment>
258 # <i>ip tunnel add sixbone mode sit remote 64.71.128.82 local 68.36.91.195 ttl 64 dev eth0</i>
259 <comment>(从MTU中抽取使用隧道的开销)</comment>
260 # <i>ip link set sixbone mtu 1280</i>
261 <comment>(启动隧道)</comment>
262 # <i>ip link set sixbone up</i>
263 <comment>(为它分配IPv6地址)</comment>
264 # <i>ip addr add 2001:470:1F00:FFFF::189 dev sixbone</i>
265 <comment>(让所有的全球单播IPv6地址都通过我们的‘sixbone’隧道设备路由)</comment>
266 # <i>ip route add 2000::/3 dev sixbone</i>
267 </pre>
268
269 </body>
270 </section>
271
272 <section>
273 <title>Freenet6</title>
274 <body>
275
276 <p>
277 <uri link="http://gogonet.gogo6.com/">Freenet6</uri>是另一个免费的隧道代理。可选注册只需要一个用户名和一个合法的电子邮件地址。他们已经选择将隧道的管理变成了客户/服务器模式,并且已经开发出了一款叫做<c>gateway6</c>的客户端软件。这个客户端在Portage中是可用的。安装它需要做:
278 </p>
279
280 <pre caption="安装Freenet6客户端">
281 # <i>emerge gateway6</i>
282 </pre>
283
284 <p>
285 现在如果您选择带认证的连接,你需要配置<c>gateway6</c> 通过编辑<path>/etc/gateway6/gw6c.conf</path>。您只需修改<e>userid</e>和<e>passwd</e>部分成为Freenet6分配给您的那些,并且改变网关服务器。下面是一个配置文件的例子。
286 </p>
287
288 <pre caption="gw6c.conf例子">
289 auth_method=any
290 <i>userid=anonymous</i>
291 <i>passwd=foobar</i>
292 template=linux
293 server=broker.freenet6.net
294 </pre>
295
296 </body>
297 </section>
298
299 <section>
300 <title>测试您的连接</title>
301 <body>
302
303 <p>
304 既然您的隧道已经配置好了,那么您就可以测试您的连接了。最简单的方法就是使用
305 <c>ping6</c>软件包并试着ping
306 一个IPv6主机。
307 </p>
308
309 <pre caption="测试连接">
310 # <i>emerge iputils</i>
311 # <i>ping6 www.kame.net</i>
312 PING www.kame.net(orange.kame.net) 56 data bytes
313 64 bytes from orange.kame.net: icmp_seq=1 ttl=52 time=290 ms
314 64 bytes from orange.kame.net: icmp_seq=2 ttl=52 time=277 ms
315 64 bytes from orange.kame.net: icmp_seq=3 ttl=52 time=280 ms
316 64 bytes from orange.kame.net: icmp_seq=4 ttl=52 time=279 ms
317 64 bytes from orange.kame.net: icmp_seq=5 ttl=52 time=277 ms
318
319 --- www.kame.net ping statistics ---
320 5 packets transmitted, 5 received, 0% packet loss, time 4038ms
321 rtt min/avg/max/mdev = 277.040/281.041/290.046/4.699 ms
322 </pre>
323
324 <p>
325 正在进行的下一步工作是将更好的IPv6支持添加到网络初始化脚本中。如果您像了解这项工作的进展,并且(或者)想要帮忙,那么发邮件到<mail link="latexer@g.o">latexer@g.o</mail>.
326 </p>
327
328 </body>
329 </section>
330
331 </chapter>
332 <chapter>
333
334 <title>应用程序里的IPv6支持</title>
335
336 <section>
337 <title>Re-emerging软件包</title>
338 <body>
339
340 <p>
341 除非您以前已经将<e>USE="ipv6"</e>添加到您的<path>/etc/make.conf</path>
342 中去了,否则您可能需要re-emerge(重新安装)一堆软家包并把IPv6支持编译进去。要像知道所有已经安装的软家包中有哪些因为USE标记的改变而受到影响,可以使用Portage的<c>--newuse</c> (<c>-N</c>)选项
343 </p>
344
345 <pre caption="需要re-emerging的候选软件包">
346 # <i>emerge -uDNav world</i>
347 </pre>
348
349 <p>
350 如果您已经改变了很多的USE标记,那么列表将会很长。我们建议将您的系统保持最新,如果您重新编译所有受影响的软件包的话,系统将不会受到损坏。
351 </p>
352
353 <note>
354 一些软件包会自动检测IPv6支持,因此没有IPv6的USE标记。因此,并不是所有应该支持IPv6的软件包都会支持IPv6,如果您编译它的时候并没有一个支持IPv6的内核。
355 </note>
356
357 </body>
358 </section>
359
360 <section>
361 <title>IPv6具体软件包</title>
362 <body>
363
364 <p>
365 有几个软件包解决具体的IPv6问题,它们中的大部分都在<path>/usr/portage/net-misc</path>中。
366 </p>
367
368 <table>
369 <tr><th>软件包</th><th>描述</th></tr>
370 <tr>
371 <ti>net-misc/ipv6calc</ti>
372 <ti>将一个IPv6地址转换成压缩格式</ti>
373 </tr>
374 <tr>
375 <ti>net-misc/netcat6</ti>
376 <ti>支持IPv6和IPv4的netcat版本</ti>
377 </tr>
378 <tr>
379 <ti>dev-perl/Socket6</ti>
380 <ti>C socket.h的定义和机构操作中与IPv6相关的部分</ti>
381 </tr>
382 </table>
383
384 </body>
385 </section>
386 </chapter>
387
388
389 <chapter>
390 <title>DNS设置</title>
391 <section>
392 <title>IPv6和DNS</title>
393 <body>
394
395 <p>
396 正如IPv4的DNS使用A记录那样,IPv6的DNS使用AAAA记录。(这是因为IPv4是一个2^32的地址空间,而IPv6是一个2^128的地址空间)对于反向DNS,INT已经过时,但是仍旧被广泛支持。ARPA 是最新的标准。这里将描述支持ARPA的格式。
397 </p>
398
399 </body>
400 </section>
401
402 <section>
403 <title>BIND配置</title>
404 <body>
405
406 <p>
407 最新的BIND版本包含优秀的IPv6支持。这一部分将假设您至少已经有了配置和使用BIND的最基本知识。我们将假设您并不是在chroot中运行bind。如果您使用了chroot,那么只需简单地追加chroot前缀到接下来那一部分的大多数路径中。
408 </p>
409
410 <p>
411 首先您需要向<path>/etc/bind/named.conf</path>区域文件中的添加转发和反向的DNS条目。
412 </p>
413
414 <pre caption="named.conf条目">
415 <comment>(我们允许bind在IPv6地址上监听。</comment>
416 <comment>对于bind-9.3之前的版本,使用'any'是实现它的唯一方法)</comment>
417 options {
418 [...]
419 listen-on-v6 { any; }
420 [...]
421 };
422 <comment>(这将会为域名'ipv6-rules.com'提供DNS转发:)</comment>
423 zone "ipv6-rules.com" IN {
424 type master;
425 file "pri/ipv6-rules.com";
426 };
427 <comment>(对反向DNS来说,这样的格式是“按位”进行的。它将通过使用IPv6前缀,</comment>
428 <comment>反转数字的顺序,并且在数字之间放一个段)</comment>
429 zone "6.9.2.0.0.0.f.1.0.7.4.0.1.0.0.2.ip6.arpa" {
430 type master;
431 file "pri/rev-ipv6-rules.com.arpa";
432 };
433 </pre>
434
435 <p>
436 现在我们必须创建区域文件并为我们所有的主机添加相应的条目:
437 </p>
438
439 <pre caption="pri/ipv6-rules.com">
440 $TTL 2h
441 @ IN SOA ipv6-rules.com. webmaster.ipv6-rules.com. (
442 2003052501 ; Serial
443 28800 ; Refresh
444 14400 ; Retry
445 3600000 ; Expire
446 86400 ) ; Minimum
447 NS ns1.ipv6-rules.com
448
449 IN AAAA 2001:470:1f00:296::1 ; address for ipv6-rules.com
450 host1 IN AAAA 2001:470:1f00:296::2 ; address for host1.ipv6-rules.com
451 host2 IN AAAA 2001:470:1f00:296::3:3 ; address for host2.ipv6-rules.com
452 </pre>
453
454 <pre caption="pri/rev-ipv6-rules.com.arpa">
455 $TTL 3d ; Default TTL (bind 8 needs this, bind 9 ignores it)
456 @ IN SOA ipv6-rules.com. webmaster.ipv6-rules.com. (
457 2003052501 ; Serial number (YYYYMMdd)
458 24h ; Refresh time
459 30m ; Retry time
460 2d ; Expire time
461 3d ) ; Default TTL
462 IN NS ns1.ipv6-rules.com.
463 ; IPv6 PTR entries
464 $ORIGIN 6.9.2.0.0.0.f.1.0.7.4.0.1.0.0.2.ip6.arpa.
465
466 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 IN PTR ipv6-rules.com.
467 2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 IN PTR host1.ipv6-rules.com.
468 3.0.0.0.3.0.0.0.0.0.0.0.0.0.0.0 IN PTR host2.ipv6-rules.com.
469 </pre>
470
471 </body>
472 </section>
473
474 <section>
475 <title>DJBDNS配置</title>
476 <body>
477
478 <p>
479 目前,存在一些可用于DJBDNS的第三方补丁,可以在<uri>http://www.fefe.de/dns/</uri>上面找到,这些补丁可以让DJBDNS进行IPv6名字服务。设置<e>ipv6</e>的USE标记来安装(emerge)DJBDNS会自动安装这些补丁。
480 </p>
481
482 <warn>
483 这些补丁并不支持所有的记录类型。特别是NS和MX记录不被支持。
484 </warn>
485
486 <pre caption="安装djbdns">
487 # <i>emerge djbdns</i>
488 </pre>
489
490 <p>
491 在安装djbdns之后,可以通过运行<c>tinydns-setup</c>并回答一些问题来进行设置,这些问题是关于哪些IP地址将被绑定,在哪里安装tinydns,等等。
492 </p>
493
494 <pre caption="设置tinydns">
495 # <i>tinydns-setup</i>
496 </pre>
497
498 <p>
499 假设我们已经将<c>tinydns</c>安装到了<path>/var/tinydns</path>里,
500 现在我们可以编辑<path>/var/tinydns/root/data</path>。这个文件将包含让tinydns为您的IPv6委托处理DNS所需要的所有数据。
501 </p>
502
503 <pre caption="数据文件例子">
504 <comment>(192.168.0.1将权威地处理*.ipv6-rules.com)</comment>
505 .ipv6-rules.com:192.168.0.1:a:259200
506 <comment>(2001:470:1f00:296::/64的权威反向DNS)</comment>
507 .6.9.2.0.0.0.f.1.0.7.4.0.1.0.0.2.ip6.arpa:192.168.0.1:a
508 <comment>(为host1和host2指定IP)</comment>
509 6host1.ipv6-rules.com:200104701f0002960000000000000001:86400
510 6host2.ipv6-rules.com:200104701f0002960000000000000002:86400
511 <comment>(将www指向host1)</comment>
512 3www.ipv6-rules.com:200104701f0002960000000000000002:86400
513 </pre>
514
515 <p>
516 前缀有一个<c>6</c>的那些行将同时创建一个AAAA和一个PTR记录。那些前缀有一个<c>3</c>的行将只创建一个AAAA记录。除了手动编辑<path>data</path>文件之外,您可以使用<c>add-host6</c>脚本和<c>add-alias6</c>脚本来添加新的条目。
517 在修改<path>data</path>文件之后,您需要简单地从<path>/var/tinydns/root</path>运行<c>make</c>。这将会创建<path>/var/tinydns/root/data.cfb</path>,tinydns将会使用这个文件作为它的信息源来处理DNS请求。
518 </p>
519
520 </body>
521 </section>
522 </chapter>
523
524
525 <chapter>
526 <title>IPv6路由</title>
527 <section>
528 <title>设置路由</title>
529 <body>
530
531 <p>
532 如果我们想要让我们的系统成为一个路由以便其他客户端能够通过IPv6连接外部的世界的话,那么需要进一步的设置。我们需要开启IPv6的包转发功能。我们可以通过下面两种方式中的一种做到这一点。
533 </p>
534
535 <pre caption="开启转发功能">
536 # <i>echo 1 > /proc/sys/net/ipv6/conf/all/forwarding</i>
537 or
538 # <i>sysctl -w net.ipv6.conf.all.forwarding=1</i>
539 </pre>
540
541 <warn>
542 在下一章中将会解释的<c>radvd</c>初始化脚本能够开启(和关闭)转发功能, 这将使下一步骤成为不必要的步骤。
543 </warn>
544
545 <p>
546 为了在开机的时候开启转发,您将需要编辑<path>/etc/sysctl.conf</path>并且添加下面这一行。
547 </p>
548
549 <pre caption="sysctl.conf附加部分">
550 <comment>(如果你将要使用radvd,这一步不是必要的)</comment>
551 net.ipv6.conf.default.forwarding=1
552 </pre>
553
554 <p>
555 数据流量现在将会从这台机子被转发出去,转发的道路就是利用我们的代理所建立的隧道。
556 </p>
557
558 <p>
559 要给客户端分配IPv6地址,IPv6规范允许无状态和有状态两种IP分配方式。无状态分配使用一个叫做路由广告的进程,并且可以让客户端做到,只要简单地把设备接口(interface)启动就可以获得一个IP和一个默认路由。这种方式被称为“无状态”,这是因为没有记录分配的IP和主机。有状态分配是通过DHCPv6进行处理的。这种方式之所以被称为”有状态“,是由于服务器保存了请求和获取IP的客户端的状态。
560 </p>
561
562 </body>
563 </section>
564
565 <section>
566 <title>无状态设置</title>
567 <body>
568
569 <p>
570 通过路由广告守护进程或者<c>radvd</c>,无状态设置将会很容易完成。
571 </p>
572
573 <pre caption="配置radvd">
574 # <i>emerge radvd</i>
575 </pre>
576
577 <p>
578 在安装了<c>radvd</c>之后,我们需要创建<path>/etc/radvd/radvd.conf</path>,这个文件包含了我们应该从哪个地址块分配IP这样的信息。这是一个<path>radvd.conf</path>文件的例子,这里面使用了我们的隧道代理分配给我们的前缀。
579 </p>
580
581 <pre caption="radvd.conf例子">
582 interface eth1
583 {
584 <comment>(将广告信息发送到其他的主机)</comment>
585 AdvSendAdvert on;
586 <comment>(分片大小并不好(tm))</comment>
587 AdvLinkMTU 1280;
588 MaxRtrAdvInterval 300;
589 <comment>(我们的PoP分配给我们的子网前缀)</comment>
590 prefix 2001:470:1F00:296::/64
591 {
592 AdvOnLink on;
593 AdvAutonomous on;
594 };
595 };
596 </pre>
597
598 <warn>
599 请确保第一行中的设备接口是正确的,这样您就可以将路由广告广播到您的内部网而不是您的ISP那里!
600 </warn>
601
602 <p>
603 通过<c>man radvd.conf</c>可以得到更多的信息。我们现在能够启动<c>radvd</c>并将它设置为开机时启动。
604 </p>
605
606 <pre caption="开启radvd">
607 # <i>/etc/init.d/radvd start</i>
608 # <i>rc-update add radvd default</i>
609 </pre>
610
611 </body>
612 </section>
613
614 <section>
615 <title>有状态设置</title>
616 <body>
617
618 <p>
619 如果您想要使用有状态设置,您将需要安装并且配置dhcpv6。
620 </p>
621
622 <pre caption="安装dhcpv6">
623 # <i>emerge dhcpv6</i>
624 </pre>
625
626 <p>
627 接下来我们必须编辑<path>/etc/dhcp6s.conf</path>来配置DHCPv6服务器。
628 </p>
629
630 <pre caption="dhcp6s.conf例子">
631 prefer-life-time 10000;
632 valid-life-time 20000;
633 renew-time 5000;
634 rebind-time 8000;
635 interface eth1 {
636 link AAA {
637 allow unicast;
638 send unicast;
639 allow rapid-commit;
640 send server-preference 5;
641 renew-time 1000;
642 rebind-time 2400;
643 prefer-life-time 2000;
644 valid-life-time 3000;
645 pool{
646 range 2001:470:1f00:296::10 to 2001:470:1f00:296::110/64;
647 prefix 2001:470:1f00:296::/64;
648 };
649 };
650 };
651 </pre>
652
653 <p>
654 我们现在可以开启dhcp6s,并且将它设置为在开机时启动。
655 </p>
656
657 <pre caption="开启dhcp6s">
658 # <i>/etc/init.d/dhcp6s start</i>
659 # <i>rc-update add dhcp6s default</i>
660 </pre>
661
662 </body>
663 </section>
664 </chapter>
665
666 <chapter>
667 <title>IPv6客户端</title>
668 <section>
669 <title>使用radvd</title>
670 <body>
671
672 <p>
673 在这个路由之后的客户端现在应该能够通过IPv6连接其余的网络了。如果使用radvd,设置主机应该就像将设备启动一样简单。(您的net.ethX初始化脚本可能已经帮您做好了这项工作)。
674 </p>
675
676 <pre caption="通过IPv6连接">
677 # <i>ip link set eth0 up</i>
678 # <i>ip addr show eth0</i>
679 1: eth0: &lt;BROADCAST,MULTICAST,UP&gt; mtu 1400 qdisc pfifo_fast qlen 1000
680 link/ether 00:01:03:2f:27:89 brd ff:ff:ff:ff:ff:ff
681 inet6 2001:470:1f00:296:209:6bff:fe06:b7b4/128 scope global
682 valid_lft forever preferred_lft forever
683 inet6 fe80::209:6bff:fe06:b7b4/64 scope link
684 valid_lft forever preferred_lft forever
685 inet6 ff02::1/128 scope global
686 valid_lft forever preferred_lft forever
687 </pre>
688
689 </body>
690 </section>
691
692 <section>
693 <title>使用DHCPv6</title>
694 <body>
695
696 <p>
697 如果您的路由被设置成使用DHCPv6,那么您的客户端将同样需要安装<c>net-misc/dhcpv6</c> 软件包。在做完这些之后,您需要编辑<path>/etc/dhcp6c.conf</path>来配置您的客户端。
698 </p>
699
700 <pre caption="dhcp6c.conf例子">
701 interface eth0 {
702 send rapid-commit;
703 request domain-name-servers;
704 iaid 11111;
705 renew-time 11000;
706 };
707 </pre>
708
709 </body>
710 </section>
711 </chapter>
712
713 <chapter>
714 <title>其他资源</title>
715 <section>
716 <body>
717
718 <p>
719 这里有很多关于IPv6的在线资源。
720 </p>
721
722 <table>
723 <tr><th>网站</th><th>资源</th></tr>
724 <tr>
725 <ti><uri link="http://www.ipv6.org/">www.ipv6.org</uri></ti>
726 <ti>General IPv6 Information</ti>
727 </tr>
728 <tr>
729 <ti><uri link="http://www.linux-ipv6.org/">www.linux-ipv6.org/</uri></ti>
730 <ti>USAGI Project</ti>
731 </tr>
732 <tr>
733 <ti><uri link="http://www.deepspace6.net/">www.deepspace6.net</uri></ti>
734 <ti>Linux/IPv6 site</ti>
735 </tr>
736 <!-- dead, was hacked<tr>
737 <ti><uri link="http://www.hs247.com/">www.hs247.com</uri></ti>
738 <ti>All things IPv6</ti>
739 </tr>-->
740 <!-- dead, not responding<tr>
741 <ti><uri link="http://www.ipv6-net.org/">www.ipv6-net.org</uri></ti>
742 <ti>German IPv6 site</ti>
743 </tr>-->
744 <tr>
745 <ti><uri link="http://www.kame.net/">www.kame.net</uri></ti>
746 <ti>*BSD implementation</ti>
747 </tr>
748 </table>
749
750 <p>
751 在IRC上,您可以试试<uri link="http://www.freenode.net/">Freenode</uri>上的 <c>#ipv6</c>。您可以使用一个支持IPv6的客户端来连接<b>irc.ipv6.freenode.net</b>以便连接到Freenode服务器。
752 </p>
753
754 </body>
755 </section>
756 </chapter>
757 </guide>