⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 network-ipv6.html

📁 这是很好的学习嵌入式LINUX的文章
💻 HTML
📖 第 1 页 / 共 2 页
字号:
class="HOSTID">fe80::200:21ff:fe03:8e1%rl0</tt>是一个自动配置的链路环回地址。它作为自动配置的一部分由MAC生成。</p><p>关于IPv6地址的结构的更多信息,请参看<a href="http://www.ietf.org/rfc/rfc3513.txt"target="_top">RFC3513</a>。</p></div><div class="SECT2"><h2 class="SECT2"><a id="AEN37568" name="AEN37568">24.10.3. 进行连接</a></h2><p>目前,有四种方式可以连接到其它IPv6主机和网络:</p><ul><li><p>加入试验性的6bone(骨干)</p></li><li><p>从你的上一级提供商那里获得IPv6网络。与你的互联网提供商讨论以求指导。</p></li><li><p>使用 6-to-4 通道 (<a href="http://www.ietf.org/rfc/rfc3068.txt"target="_top">RFC3068</a>)</p></li><li><p>如果你是括号连接(dial-up connection),请使用<ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/net/freenet6/pkg-descr"><ttclass="FILENAME">net/freenet6</tt></a> port。</p></li></ul><p>这里我们就讨论如何连接到6bone,因为它目前看来是最流行的一种方式。</p><p>首先看一下<a href="http://www.6bone.net/"target="_top">6bone</a>网站,并找出离你最近的6bone连接。给某位值得信赖的人写信过去,如果运气好,你就会得到关于如何设置你的连接的指导。通常这包括了设置GRE(gif) 通道。</p><p>这里有一个典型的关于设置<span class="CITEREFENTRY"><spanclass="REFENTRYTITLE">gif</span>(4)</span>通道的例子。</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">ifconfig gif0 create</kbd> <sampclass="PROMPT">#</samp> <kbdclass="USERINPUT">ifconfig gif0</kbd> gif0: flags=8010&lt;POINTOPOINT,MULTICAST&#62; mtu 1280 <samp class="PROMPT">#</samp> <kbd class="USERINPUT">ifconfig gif0 tunnel <varclass="REPLACEABLE">MY_IPv4_ADDR</var>  <varclass="REPLACEABLE">HIS_IPv4_ADDR</var></kbd> <samp class="PROMPT">#</samp> <kbdclass="USERINPUT">ifconfig gif0 inet6 alias <varclass="REPLACEABLE">MY_ASSIGNED_IPv6_TUNNEL_ENDPOINT_ADDR</var></kbd></pre><p>把大写字母换成你从上一级6bone节点收到的信息。</p><p>这样就建立了通道。通过<span class="CITEREFENTRY"><spanclass="REFENTRYTITLE">ping6</span>(8)</span> <ttclass="HOSTID">ff02::1%gif0</tt>,检查通道是否工作。你应该会收到两个ping回应。</p><div class="NOTE"><blockquote class="NOTE"><p><b>注:</b> 或许你会对地址<ttclass="HOSTID">ff02:1%gif0</tt>感上兴趣,它是一个multicast地址。<varclass="LITERAL">%gif0</var>表明在网络接口<ttclass="DEVICENAME">gif0</tt>上的multicast地址已经用上了。因为我们<ttclass="COMMAND">ping</tt>一个multicast地址的时候,通道的另一端也应该会回应。</p></blockquote></div><p>到现在,设置一个到6bone上级连接的路由应该是相当简单了。</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">route add -inet6 default -interface gif0</kbd> <sampclass="PROMPT">#</samp> <kbd class="USERINPUT">ping6 -n <varclass="REPLACEABLE">MY_UPLINK</var></kbd></pre><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">traceroute6 www.jp.FreeBSD.org</kbd> (3ffe:505:2008:1:2a0:24ff:fe57:e561) from 3ffe:8060:100::40:2, 30 hops max, 12 byte packets 1  atnet-meta6  14.147 ms  15.499 ms  24.319 ms 2  6bone-gw2-ATNET-NT.ipv6.tilab.com  103.408 ms  95.072 ms * 3  3ffe:1831:0:ffff::4  138.645 ms  134.437 ms  144.257 ms 4  3ffe:1810:0:6:290:27ff:fe79:7677  282.975 ms  278.666 ms  292.811 ms 5  3ffe:1800:0:ff00::4  400.131 ms  396.324 ms  394.769 ms 6  3ffe:1800:0:3:290:27ff:fe14:cdee  394.712 ms  397.19 ms  394.102 ms</pre><p>这个输出可能随机器而不同。到现在,你应该可以到达 IPv6 站点<ahref="http://www.kame.net" target="_top">www.kame.net</a>,并看到那只正跳舞的乌龟 --如果你有一个支持IPv6的浏览器,如<ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/www/mozilla/pkg-descr"><ttclass="FILENAME">www/mozilla</tt></a>, <b class="APPLICATION">Konqueror</b>(<ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/x11/kdebase3/pkg-descr"><ttclass="FILENAME">x11/kdebase3</tt></a>的一部分)或<ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/www/epiphany/pkg-descr"><ttclass="FILENAME">www/epiphany</tt></a>。</p></div><div class="SECT2"><h2 class="SECT2"><a id="AEN37629" name="AEN37629">24.10.4. IPv6世界里的DNS</a></h2><p>对于IPv6有两种类型的DNS记录:IETF已经宣布A6是过时标准;现行的标准是AAAA记录。</p><p>使用AAAA记录是很简单的。通过增加下面内容,给你的主机分配置你刚才接收到的新的IPv6地址:</p><pre class="PROGRAMLISTING">MYHOSTNAME           AAAA    MYIPv6ADDR</pre><p>到你的主域DNS文件里,就可以完成。要是你自已没有<acronymclass="ACRONYM">DNS</acronym>域服务,你可以询问你的<acronymclass="ACRONYM">DNS</acronym>提供商。目前的<b class="APPLICATION">bind</b>版本(version8.3 与 9)和<a href="http://www.FreeBSD.org/cgi/url.cgi?ports/dns/djbdns/pkg-descr"><ttclass="FILENAME">dns/djbdns</tt></a>(含IPv6补丁)支持AAAA记录。</p></div><div class="SECT2"><h2 class="SECT2"><a id="AEN37639" name="AEN37639">24.10.5. Applying the needed changesto <tt class="FILENAME">/etc/rc.conf</tt></a></h2><div class="SECT3"><h3 class="SECT3"><a id="AEN37642" name="AEN37642">24.10.5.1. IPv6 ClientSettings</a></h3><p>These settings will help you configure a machine that will be on your LAN and act as aclient, not a router. To have <span class="CITEREFENTRY"><spanclass="REFENTRYTITLE">rtsol</span>(8)</span> autoconfigure your interface on boot all youneed to add is:</p><pre class="PROGRAMLISTING">ipv6_enable="YES"</pre><p>To statically assign an IP address such as <ttclass="HOSTID">2001:471:1f11:251:290:27ff:fee0:2093</tt>, to your <ttclass="DEVICENAME">fxp0</tt> interface, add:</p><pre class="PROGRAMLISTING">ipv6_ifconfig_fxp0="2001:471:1f11:251:290:27ff:fee0:2093"</pre><p>To assign a default router of <tt class="HOSTID">2001:471:1f11:251::1</tt> add thefollowing to <tt class="FILENAME">/etc/rc.conf</tt>:</p><pre class="PROGRAMLISTING">ipv6_defaultrouter="2001:471:1f11:251::1"</pre></div><div class="SECT3"><h3 class="SECT3"><a id="AEN37657" name="AEN37657">24.10.5.2. IPv6 Router/GatewaySettings</a></h3><p>This will help you take the directions that your tunnel provider, such as the <ahref="http://www.6bone.net/" target="_top">6bone</a>, has given you and convert it intosettings that will persist through reboots. To restore your tunnel on startup usesomething like the following in <tt class="FILENAME">/etc/rc.conf</tt>:</p><p>List the Generic Tunneling interfaces that will be configured, for example <ttclass="DEVICENAME">gif0</tt>:</p><pre class="PROGRAMLISTING">gif_interfaces="gif0"</pre><p>To configure the interface with a local endpoint of <varclass="REPLACEABLE">MY_IPv4_ADDR</var> to a remote endpoint of <varclass="REPLACEABLE">REMOTE_IPv4_ADDR</var>:</p><pre class="PROGRAMLISTING">gif_config_gif0="<var class="REPLACEABLE">MY_IPv4_ADDR REMOTE_IPv4_ADDR</var>"</pre><p>To apply the IPv6 address you have been assigned for use as your IPv6 tunnel endpoint,add:</p><pre class="PROGRAMLISTING">ipv6_ifconfig_gif0="<var class="REPLACEABLE">MY_ASSIGNED_IPv6_TUNNEL_ENDPOINT_ADDR</var>"</pre><p>Then all you have to do is set the default route for IPv6. This is the other side ofthe IPv6 tunnel:</p><pre class="PROGRAMLISTING">ipv6_defaultrouter="<var class="REPLACEABLE">MY_IPv6_REMOTE_TUNNEL_ENDPOINT_ADDR</var>"</pre></div></div><div class="SECT2"><h2 class="SECT2"><a id="AEN37676" name="AEN37676">24.10.6. Router Advertisement and HostAuto Configuration</a></h2><p>This section will help you setup <span class="CITEREFENTRY"><spanclass="REFENTRYTITLE">rtadvd</span>(8)</span> to advertise the IPv6 default route.</p><p>To enable <span class="CITEREFENTRY"><spanclass="REFENTRYTITLE">rtadvd</span>(8)</span> you will need the following in your <ttclass="FILENAME">/etc/rc.conf</tt>:</p><pre class="PROGRAMLISTING">rtadvd_enable="YES"</pre><p>It is important that you specify the interface on which to do IPv6 routersolicitation. For example to tell <span class="CITEREFENTRY"><spanclass="REFENTRYTITLE">rtadvd</span>(8)</span> to use <ttclass="DEVICENAME">fxp0</tt>:</p><pre class="PROGRAMLISTING">rtadvd_interfaces="fxp0"</pre><p>Now we must create the configuration file, <tt class="FILENAME">/etc/rtadvd.conf</tt>.Here is an example:</p><pre class="PROGRAMLISTING">fxp0:\    :addrs#1:addr="2001:471:1f11:246::":prefixlen#64:tc=ether:</pre><p>Replace <tt class="DEVICENAME">fxp0</tt> with the interface you are going to beusing.</p><p>Next, replace <tt class="HOSTID">2001:471:1f11:246::</tt> with the prefix of yourallocation.</p><p>If you are dedicated a <tt class="HOSTID">/64</tt> subnet you will not need to changeanything else. Otherwise, you will need to change the <varclass="LITERAL">prefixlen#</var> to the correct value.</p></div></div><div class="NAVFOOTER"><hr align="LEFT" width="100%" /><table summary="Footer navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="network-plip.html"accesskey="P">后退</a></td><td width="34%" align="center" valign="top"><a href="index.html"accesskey="H">起点</a></td><td width="33%" align="right" valign="top"><a href="network-atm.html"accesskey="N">前进</a></td></tr><tr><td width="33%" align="left" valign="top">平行线IP(PLIP)</td><td width="34%" align="center" valign="top"><a href="advanced-networking.html"accesskey="U">上一级</a></td><td width="33%" align="right" valign="top">FreeBSD 5.X上的ATM</td></tr></table></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -