aboutsummaryrefslogtreecommitdiff
path: root/zh_CN.GB2312/books
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2005-04-06 11:58:39 +0000
committerXin LI <delphij@FreeBSD.org>2005-04-06 11:58:39 +0000
commitcba270a1a2953cfed20413783f0ae37e359584d6 (patch)
tree80b69bb565c52d98b238a7cc3f5acfbcd357e200 /zh_CN.GB2312/books
parent57ce247befc96ba3944c7faaed6b95cf73669dc2 (diff)
Notes
Diffstat (limited to 'zh_CN.GB2312/books')
-rw-r--r--zh_CN.GB2312/books/handbook/advanced-networking/chapter.sgml355
1 files changed, 242 insertions, 113 deletions
diff --git a/zh_CN.GB2312/books/handbook/advanced-networking/chapter.sgml b/zh_CN.GB2312/books/handbook/advanced-networking/chapter.sgml
index f804ff5718..bbd68a3199 100644
--- a/zh_CN.GB2312/books/handbook/advanced-networking/chapter.sgml
+++ b/zh_CN.GB2312/books/handbook/advanced-networking/chapter.sgml
@@ -2,7 +2,7 @@
The FreeBSD Documentation Project
The FreeBSD Chinese Documentation Project
- Original revision: 1.344
+ Original revision: 1.365
$FreeBSD$
-->
@@ -14,11 +14,11 @@
<para>本章将介绍许多与高级网络有关的话题。</para>
- <para>读完这一章,您将会知道:</para>
+ <para>读完这一章,您将了解:</para>
<itemizedlist>
<listitem>
- <para>网关和路由基础</para>
+ <para>关于网关和路由的基础知识。</para>
</listitem>
<listitem>
@@ -34,7 +34,7 @@
</listitem>
<listitem>
- <para>如何设置网络地址翻译(NAT)。</para>
+ <para>如何设置网络地址转换(NAT)。</para>
</listitem>
<listitem>
@@ -58,7 +58,7 @@
</listitem>
<listitem>
- <para>相关的基本网络术语。</para>
+ <para>知道相关的基本网络术语。</para>
</listitem>
<listitem>
@@ -103,24 +103,25 @@
<indexterm><primary>网关</primary></indexterm>
<indexterm><primary>子网</primary></indexterm>
<para>为了让一台主机在网能找到另一台主机,
- 就必须要有一种机制来描述如何从一台主机连至另一台上。这个就叫做
+ 就必须要有一种机制来描述如何从一台主机连至另一台上。 这一过程就是
<firstterm>路由选择(routing)</firstterm>。
- 一个<quote>路由</quote>是一对预先定义的地址:
- <quote>目的地(destination)</quote>和<quote>网关(gateway)</quote>。
- 这对地址表明如果您想要试着到达这个<emphasis>目的地(destination)</emphasis>,
- 那么就通过这个<emphasis>网关(gateway)</emphasis>进行通信。
- 目的地有三种类型: 单个主机(individual hosts),
- 子网(subnets)和<quote>默认(default)</quote>。
- 如果没有其它路由应用,就使用<quote>默认路由(default route)</quote>。
- 关于默认路由我们以后为讨论多一点。有三种类型的网关:
- 单个主机,接口(也叫<quote>连接(links)</quote>)和以太网硬件地址(MAC addresses)。
+ <quote>路由</quote> 是一对预先定义的地址:
+ <quote>目的地(destination)</quote> 和 <quote>网关(gateway)</quote>。
+ 这对地址说明了, 想要到达 <emphasis>目的地(destination)</emphasis>,
+ 就需要通过 <emphasis>网关(gateway)</emphasis> 进行通信。
+ 目的地址有三种类型: 单个主机,
+ 子网(subnets) 和 <quote>默认(default)</quote>。
+ 如果没有应用其它路由, 就会使用 <quote>默认路由</quote>。
+ 关于默认路由将在后面进行更多的讨论。 网关也有三种类型:
+ 单个主机, 接口 (也叫<quote>连接(links)</quote>)
+ 和以太网硬件地址(MAC addresses)。
</para>
<sect2>
<title>实例</title>
- <para>为了说明路由选择的各个部分,我们使用以用下面这个例子。
- 以下是命令 <command>netstat</command> 的输出:</para>
+ <para>为了说明路由选择的各个部分, 首先来看看下面的例子。
+ 这是 <command>netstat</command> 命令的输出:</para>
<screen>&prompt.user; <userinput>netstat -r</userinput>
Routing tables
@@ -138,26 +139,26 @@ host2.example.com link#1 UC 0 0
224 link#1 UC 0 0</screen>
<indexterm><primary>默认路由</primary></indexterm>
- <para>头两行指定默认路由 (我们会在<link
- linkend="network-routing-default">下一节</link>说明)
- 和<hostid>本地(localhost)</hostid>路由。</para>
+ <para>头两行指定默认路由 (我们会在 <link
+ linkend="network-routing-default">下一节</link> 说明)
+ 和 <hostid>本机(localhost)</hostid> 路由。</para>
<indexterm><primary>回环设备</primary></indexterm>
- <para>这张路由表里指定用于<literal>localhost</literal>的接口
- (<literal>Netif</literal> 列)是<devicename>lo0</devicename>,
- 也就是众所周知的<quote>回环设备(loopback device)</quote>。
- 这就使得所有以此为<quote>目的地</quote>的通信留在了内部,
- 而不是通过LAN发送出去,因为它会在开始的地方就结束返回。</para>
+ <para>这张路由表里指定用于 <literal>localhost</literal> 的接口
+ (<literal>Netif</literal> 列) 是 <devicename>lo0</devicename>,
+ 也就是大家熟知的 <quote>回环设备</quote>。
+ 它使得所有以此为 <quote>目的地</quote> 的通信留在本机,
+ 而不是通过 LAN 发出, 因为它会在开始的地方就结束并返回。</para>
<indexterm>
<primary>以太网</primary> <secondary>MAC 地址</secondary>
</indexterm>
<para>接着出现的是以 <hostid role="mac">0:e0:</hostid>
开头的地址。这些是以太网硬件地址,也称为 MAC 地址。
- FreeBSD 会自动识别在同一个以太网中的任何主机(如
- <hostid>test0</hostid>),并为这个主机新增一个路由,
- 以并通过那个以太网接口——<devicename>ed0</devicename>
- 直接到达它(译者注:那台主机。与这类路由表相关的也有一个超时项
+ FreeBSD 会自动识别在同一个以太网中的任何主机 (如
+ <hostid>test0</hostid>), 并为其新增一个路由,
+ 并通过那个以太网接口 &mdash; <devicename>ed0</devicename>
+ 直接与它通讯 (译者注:那台主机。与这类路由表相关的也有一个超时项
(<literal>Expire</literal>列),当我们在指定时间内没有收到从那个主机发来的信息,
这项就派上用场了。这种情况下,到这个主机的路由就会被自动删除。
这些主机被使用一种叫做RIP(路由信息协议--Routing Information
@@ -195,7 +196,7 @@ host2.example.com link#1 UC 0 0
<para>最后,每个路由的不同属性可以在 <literal>Flags</literal>
列中看到。下边是个关于这些标志和它们的含义的一个简表:</para>
- <informaltable frame="none">
+ <informaltable frame="none" pgwide="1">
<tgroup cols="2">
<colspec colwidth="1*">
<colspec colwidth="4*">
@@ -286,7 +287,7 @@ host2.example.com link#1 UC 0 0
<para>您的每一台机子的默认路由应该是:</para>
- <informaltable frame="none">
+ <informaltable frame="none" pgwide="1">
<tgroup cols="3">
<thead>
<row>
@@ -329,7 +330,7 @@ host2.example.com link#1 UC 0 0
使用的是 <hostid role="ipaddr">10.9.9</hostid>,
那么默认路由表将是:</para>
- <informaltable frame="none">
+ <informaltable frame="none" pgwide="1">
<tgroup cols="2">
<thead>
<row>
@@ -361,8 +362,8 @@ host2.example.com link#1 UC 0 0
<screen>&prompt.root; <userinput>route add default 10.20.30.1</userinput></screen>
- <para>想要了解更多关于手工处理网络路由表的信息,参考
- &man.route.8; 手册页。</para>
+ <para>要了解关于如何手工维护网络路由表的进一步细节, 请参考
+ &man.route.8; 联机手册。</para>
</sect2>
<sect2>
@@ -417,10 +418,6 @@ host2.example.com link#1 UC 0 0
<indexterm><primary>BGP</primary></indexterm>
<indexterm><primary>RIP</primary></indexterm>
<indexterm><primary>OSPF</primary></indexterm>
-
- <para>即使 FreeBSD 按照这种方法进行了配置,
- 它也并不完全符合 Internet 标准对路由器的要求。
- 但对于一般应用已经足够了。</para>
</sect2>
<sect2>
@@ -524,7 +521,7 @@ default 10.0.0.1 UGS 0 49378 xl0
</sect3>
<sect3>
- <title>永久的配置</title>
+ <title>永久配置</title>
<para>上面的实例对于运行着的系统来说配置静态路由是相当不错了。
只是,有一个问题——如果您重启您的 &os; 机子,路由信息就会消失。
@@ -548,12 +545,13 @@ route_internalnet2="-net 192.168.2.0/24 192.168.1.2"</programlisting>
<para>因此,我们需要的是 <literal>"-net 192.168.2.0/24 192.168.1.2"</literal>。</para>
- <para>前边已经说了,我们可以有不只一个字符串的
+ <para>前边已经提到, 可以把多个静态路由的名称, 放到
<literal>static_routes</literal> 里边。
- 下面我们就建立多个静态路由。下面几行显示了一个为 <hostid
+ 接着我们就来建立多个静态路由。 下面几行所展示的,
+ 是在一个假想的路由器上增加 <hostid
role="ipaddr">192.168.0.0/24</hostid> 和 <hostid
role="ipaddr">192.168.1.0/24</hostid>
- 网络在一个假想的路由器上增加静态路由的例子:</para>
+ 之间静态路由的例子:</para>
<programlisting>static_routes="net1 net2"
route_net1="-net 192.168.0.0/24 192.168.0.1"
@@ -610,7 +608,11 @@ route_net2="-net 192.168.1.0/24 192.168.1.1"</programlisting>
<sect2>
<title>多播路由</title>
<indexterm>
- <primary>多播</primary> <secondary>MROUTING 选项</secondary>
+ <primary>多播路由</primary>
+ </indexterm>
+ <indexterm>
+ <primary>内核选项</primary>
+ <secondary>MROUTING</secondary>
</indexterm>
<para>FreeBSD 一开始就支持多播应用软件和多播路由选择。
多播程序并不要求FreeBSD的任何特殊的配置,
@@ -765,14 +767,15 @@ wi0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; mtu 1500
接着我们需要告诉内核将哪些接口桥接在一起。
我们使用 &man.sysctl.8; 来完成:</para>
- <screen>&prompt.root; <userinput>sysctl net.link.ether.bridge=1</userinput>
-&prompt.root; <userinput>sysctl net.link.ether.bridge_cfg="wi0,xl0"</userinput>
+ <screen>&prompt.root; <userinput>sysctl net.link.ether.bridge.enable=1</userinput>
+&prompt.root; <userinput>sysctl net.link.ether.bridge.config="wi0,xl0"</userinput>
&prompt.root; <userinput>sysctl net.inet.ip.forwarding=1</userinput></screen>
- <para>在 &os; 5.2-RELEASE 以及更新版本上,您必须使用下面的选项:</para>
+ <para>在 &os; 5.2 之前的版本中,
+ 则必须使用下面的选项:</para>
- <screen>&prompt.root; <userinput>sysctl net.link.ether.bridge.enable=1</userinput>
-&prompt.root; <userinput>sysctl net.link.ether.bridge.config="wi0,xl0"</userinput>
+ <screen>&prompt.root; <userinput>sysctl net.link.ether.bridge=1</userinput>
+&prompt.root; <userinput>sysctl net.link.ether.bridge_cfg="wi0,xl0"</userinput>
&prompt.root; <userinput>sysctl net.inet.ip.forwarding=1</userinput></screen>
<para>现在来设置并启动无线网卡。以下的命令将网卡设置为接入点状态:</para>
@@ -818,7 +821,7 @@ wi0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; mtu 1500
<sect3>
<title>客户端</title>
- <para>一个无线客户端是一个连入接入点或直接连接另一个客户端的系统。 </para>
+ <para>一个无线客户端是一个连入接入点或直接连接另一个客户端的系统。</para>
<para>一般地,无线客户端只有一个网络设备,也就是无线网卡。</para>
@@ -988,7 +991,7 @@ wi0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; mtu 1500
</sect4>
<sect4>
- <title>客户端</title>
+ <title>802.11b 客户端</title>
<para>现在几乎所有的 802.11b 无线网卡都能被 FreeBSD
支持。大多数基于 Prism、Spectrum24、Hermes、Aironet
@@ -996,8 +999,122 @@ wi0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; mtu 1500
BSS)模式下工作。</para>
</sect4>
- </sect3>
+ <sect4>
+ <title>802.11a & 802.11g 客户端</title>
+
+ <para>&man.ath.4; 设备驱动能够支持 802.11a 和 802.11g。
+ 如果您的网卡采用的是 Atheros 芯片组, 就可以使用这个驱动。</para>
+
+ <para>不幸的是, 由于认为设计许多敏感的商业机密,
+ 许多厂商至今仍不愿意将把驱动程序作为开放源代码形式发布列入时间表。
+ 因此, FreeBSD 以及其它操作系统的开发人员只剩下了两种选择:
+ 要么经历长时间的痛苦过程来对驱动进行逆向工程,
+ 要么使用现存的为
+ &microsoft.windows; 平台编译好的驱动程序。 许多开发人员,
+ 包括参与 FreeBSD 的那些, 选择了后者。</para>
+
+ <para>得益于 Bill Paul (wpaul) 的工作, 从
+ FreeBSD&nbsp;5.3-RELEASE 开始, 已经可以 <quote>直接</quote>
+ 支持网络驱动接口规范
+ (NDIS)。 FreeBSD NDISulator (也被称为 Project Evil)
+ 可以支持二进制形式的 &windows; 驱动程序,
+ 并让它相信正在运行的是 &windows;。 这是一个相对较新的功能,
+ 但许多测试证明, 它确实相当有效。</para>
+
+ <indexterm><primary>NDIS</primary></indexterm>
+ <indexterm><primary>NDISulator</primary></indexterm>
+ <indexterm><primary>&windows drivers</primary></indexterm>
+ <indexterm><primary>Microsoft Windows</primary></indexterm>
+ <indexterm><primary>Microsoft Windows</primary>
+ <secondary>设备驱动</secondary></indexterm>
+ <indexterm><primary>KLD (内核可加载对象)</primary></indexterm>
+<!-- We should probably omit the expanded name, and add a <see> entry
+for it. Whatever is done must also be done to the same indexterm in
+linuxemu/chapter.sgml -->
+
+ <para>要使用 NDISulator, 您需要三件东西:</para>
+
+ <orderedlist>
+ <listitem>
+ <para>内核源代码</para>
+ </listitem>
+ <listitem>
+ <para>二进制形式的 &windowsxp; 驱动程序
+ (扩展名是 <filename>.SYS</filename>)</para>
+ </listitem>
+ <listitem>
+ <para>&windowsxp; 驱动程序配置文件
+ (扩展名是 <filename>.INF</filename>)</para>
+ </listitem>
+ </orderedlist>
+
+ <para>您可能需要编译 &man.ndis.4; 袖珍端口驱动封装模块。
+ 这一操作需要以 <username>root</username> 身份来完成:</para>
+
+ <screen>&prompt.root; <userinput>cd /usr/src/sys/modules/ndis</userinput>
+&prompt.root; <userinput>make && make install</userinput></screen>
+
+ <para>找到您的卡所需的文件。 一般来说,
+ 您应该能在随卡的 CD 或者制造商的网站上找到。
+ 下面的例子中, 我们将使用
+ <filename>W32DRIVER.SYS</filename> 和
+ <filename>W32DRIVER.INF</filename> 这两个名字。</para>
+
+ <para>接下来的步骤是将二进制形式的驱动程序组装成内核模块。
+ 要完成这一任务, 需要以
+ <username>root</username> 身份进入
+ <filename>if_ndis</filename> 模块的目录, 并将
+ &windows; 驱动程序复制到这里:</para>
+
+ <screen>&prompt.root; <userinput>cd /usr/src/sys/modules/if_ndis</userinput>
+&prompt.root; <userinput>cp <replaceable>/path/to/driver/W32DRIVER.SYS</replaceable> ./</userinput>
+&prompt.root; <userinput>cp <replaceable>/path/to/driver/W32DRIVER.INF</replaceable> ./</userinput></screen>
+
+ <para>接下来我们将使用 <command>ndiscvt</command> 工具来创建驱动定义的头文件
+ <filename>ndis_driver_data.h</filename>, 用以构建驱动程序:</para>
+
+ <screen>&prompt.root; <userinput>ndiscvt -i <replaceable>W32DRIVER.INF</replaceable> -s <replaceable>W32DRIVER.SYS</replaceable> -o ndis_driver_data.h</userinput></screen>
+
+ <para>选项 <option>-i</option> 和 <option>-s</option>
+ 分别用于指定配置和二进制形式的驱动程序。 我们使用
+ <option>-o ndis_driver_data.h</option> 参数, 因为
+ <filename>Makefile</filename> 在构建内核模块时会查找它。</para>
+
+ <note>
+ <para>某些 &windows; 驱动程序需要一些额外的文件才能正常工作。
+ 您可以把它们放到 <command>ndiscvt</command> 命令的
+ <option>-f</option> 参数后面。 请参考 &man.ndiscvt.8;
+ 联机手册了解更多详情。</para>
+ </note>
+
+ <para>最后, 就可以构建并安装内核模块了:</para>
+
+ <screen>&prompt.root; <userinput>make && make install</userinput></screen>
+
+ <para>要使用驱动程序, 您需要加在适当的内核模块:</para>
+
+ <screen>&prompt.root; <userinput>kldload ndis</userinput>
+&prompt.root; <userinput>kldload if_ndis</userinput></screen>
+
+ <para>第一个命令会加载 NDIS 袖珍端口驱动封装模块,
+ 第二个则加载实际的网卡。 请查看
+ &man.dmesg.8; 的输出以了解是否在加载过程中存在错误。
+ 如果一切正常, 您应该能看到类似下面的输出:</para>
+
+ <screen>ndis0: &lt;Wireless-G PCI Adapter&gt; mem 0xf4100000-0xf4101fff irq 3 at device 8.0 on pci1
+ndis0: NDIS API version: 5.0
+ndis0: Ethernet address: 0a:b1:2c:d3:4e:f5
+ndis0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
+ndis0: 11g rates: 6Mbps 9Mbps 12Mbps 18Mbps 36Mbps 48Mbps 54Mbps</screen>
+
+ <para>这里您可以像使用其它任何无线设备 (例如 <devicename>wi0</devicename>)
+ 那样使用 <devicename>ndis0</devicename> 设备。
+ 具体细节可以参考线面章节的讨论。</para>
+
+ </sect4>
+
+ </sect3>
</sect2>
</sect1>
@@ -1444,13 +1561,9 @@ Bluetooth Profile Descriptor List:
一个新的对像被推入手机的目录。</para>
<screen>&prompt.user; <userinput>obexapp -a 00:80:37:29:19:a4 -C IrMC</userinput>
-obex&gt; get
-get: remote file&gt; telecom/devinfo.txt
-get: local file&gt; devinfo-t39.txt
+obex&gt; get telecom/devinfo.txt devinfo-t39.txt
Success, response: OK, Success (0x20)
-obex&gt; put
-put: local file&gt; new.vcf
-put: remote file&gt; new.vcf
+obex&gt; put new.vcf
Success, response: OK, Success (0x20)
obex&gt; di
Success, response: OK, Success (0x20)</screen>
@@ -1506,12 +1619,13 @@ rfcomm_sppd[94692]: Starting on /dev/ttyp6...</screen>
</sect3>
<sect3>
- <title>有些东西正发生错误,我能查看发生了什么吗?</title>
- <para>是的,您能。使用第三方软件包
- <application>hcidump-1.5</application>,这个可以从<ulink
- url="http://www.geocities.com/m_evmenkin/"></ulink>下载到。
- 工具<application>hcidump</application> 类似于 &man.tcpdump.1;。
- 它可以用来显示蓝牙数据包的内容并将其存入文件中。</para>
+ <title>如果有错, 能否知道到底正在发生什么?</title>
+ <para>可以。 需要借助第三方软件包
+ <application>hcidump</application>, 它可以通过
+ <filename role="package">comms/hcidump</filename> port
+ 来安装。 <application>hcidump</application> 工具和
+ &man.tcpdump.1; 非常相像。 它可以用来显示蓝牙数据包的内容,
+ 并将其记录到文件中。</para>
</sect3>
</sect2>
@@ -1589,13 +1703,9 @@ rfcomm_sppd[94692]: Starting on /dev/ttyp6...</screen>
</sect3>
<sect3>
- <title>过滤/数据传输防火墙</title>
- <indexterm>
- <primary>防火墙</primary>
- </indexterm>
- <indexterm>
- <primary>网络地址转换 (NAT)</primary>
- </indexterm>
+ <title>过滤/数据整形防火墙</title>
+ <indexterm><primary>防火墙</primary></indexterm>
+ <indexterm><primary>NAT</primary></indexterm>
<para>第二种常见的情况是需要防火墙的地方没有进行网络地址转换(NAT)。</para>
@@ -1635,8 +1745,8 @@ rfcomm_sppd[94692]: Starting on /dev/ttyp6...</screen>
<sect3>
<title>改变内核配置</title>
<indexterm>
- <primary>内核 选项</primary>
- <secondary>BRIDGE 选项</secondary>
+ <primary>内核选项</primary>
+ <secondary>BRIDGE</secondary>
</indexterm>
<para>为了激活内核对桥接的支持,增加以下语句:</para>
@@ -1675,27 +1785,27 @@ rfcomm_sppd[94692]: Starting on /dev/ttyp6...</screen>
<para>增加下行:</para>
- <programlisting>net.link.ether.bridge=1</programlisting>
+ <programlisting>net.link.ether.bridge.enable=1</programlisting>
<para>到 <filename>/etc/sysctl.conf</filename> 里,
以便在运行时激活网桥,然后加下行:</para>
- <programlisting>net.link.ether.bridge_cfg=<replaceable>if1</replaceable>,<replaceable>if2</replaceable></programlisting>
+ <programlisting>net.link.ether.bridge.config=<replaceable>if1</replaceable>,<replaceable>if2</replaceable></programlisting>
<para>以便在指定的接口上激活网桥
(使用您的两个网络接口的名字替换 <replaceable>if1</replaceable>
和 <replaceable>if2</replaceable> )。如果您希望用 &man.ipfw.8;
来过滤桥接的数据包,您还应该加入:</para>
- <programlisting>net.link.ether.bridge_ipfw=1</programlisting>
+ <programlisting>net.link.ether.bridge.ipfw=1</programlisting>
<para>这样一行。</para>
- <para>对于&os; 5.2-RELEASE 及以后的版本,使用下面几行来代替:</para>
+ <para>对于 &os;&nbsp;5.2-RELEASE 和更早的版本, 则应使用下面的配置:</para>
- <programlisting>net.link.ether.bridge.enable=1
-net.link.ether.bridge.config=<replaceable>if1</replaceable>,<replaceable>if2</replaceable>
-net.link.ether.bridge.ipfw=1</programlisting>
+ <programlisting>net.link.ether.bridge=1
+net.link.ether.bridge_cfg=<replaceable>if1</replaceable>,<replaceable>if2</replaceable>
+net.link.ether.bridge_ipfw=1</programlisting>
</sect2>
@@ -2714,13 +2824,13 @@ ISDN BRI line</literallayout>
<indexterm>
<primary><application>natd</application></primary>
</indexterm>
- <para>FreeBSD 的网络地址转换服务, 通常也被称为
- &man.natd.8; 是一个能够接收连入的未经处理的 IP 包,
+ <para>FreeBSD 的网络地址转换服务, 通常也被叫做
+ &man.natd.8;, 是一个能够接收连入的未处理 IP 包,
将源地址修改为本级地址然后重新将这些包注入到发出
IP 包流中。 &man.natd.8; 同时修改源地址和端口,
当接收到响应数据时,它作逆向转换以便把数据发回原先的请求者。</para>
<indexterm><primary>Internet 连接共享</primary></indexterm>
- <indexterm><primary>IP 伪装</primary></indexterm>
+ <indexterm><primary>NAT</primary></indexterm>
<para>NAT 最常见的用途是为人们所熟知的
Internet 连接共享。</para>
</sect2>
@@ -2797,18 +2907,27 @@ natd_flags="" <co id="co-natd-natd-flags"></programlisting>
<callout arearefs="co-natd-gateway-enable">
<para>将机器配置为网关。 执行
<command>sysctl net.inet.ip.forwarding=1</command> 效果相同。</para>
+ </callout>
+
<callout arearefs="co-natd-firewall-enable">
<para>在启动时启用
<filename>/etc/rc.firewall</filename> 中的防火墙规则。</para>
+ </callout>
+
<callout arearefs="co-natd-firewall-type">
<para>指定一个预定义的允许所有包进入的防火墙规则集。 参见
<filename>/etc/rc.firewall</filename> 以了解其他类型的规则集。</para>
+ </callout>
+
<callout arearefs="co-natd-natd-interface">
<para>指定通过哪个网络接口转发包
(接入 Internet 的那一个)。</para>
+ </callout>
+
<callout arearefs="co-natd-natd-flags">
<para>其他希望在启动时传递给
&man.natd.8; 的参数。</para>
+ </callout>
</calloutlist>
<para>在 <filename>/etc/rc.conf</filename> 中加入上述选项将在系统启动时运行
@@ -2919,19 +3038,19 @@ redirect_port tcp 192.168.0.3:80 80</programlisting>
<programlisting>-redirect_address localIP publicIP</programlisting>
- <informaltable frame="none">
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>localIP</entry>
- <entry>LAN 客户端的内部 IP 地址。</entry>
- </row>
- <row>
- <entry>publicIP</entry>
- <entry>相应 LAN 客户端的外部 IP 地址。</entry>
- </row>
- </tbody>
- </tgroup>
+ <informaltable frame="none" pgwide="1">
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>localIP</entry>
+ <entry>LAN 客户端的内部 IP 地址。</entry>
+ </row>
+ <row>
+ <entry>publicIP</entry>
+ <entry>相应 LAN 客户端的外部 IP 地址。</entry>
+ </row>
+ </tbody>
+ </tgroup>
</informaltable>
<para>在这个例子里,参数是:</para>
@@ -2955,11 +3074,10 @@ redirect_port tcp 192.168.0.3:80 80</programlisting>
<sect1 id="network-plip">
<title>平行线 IP(PLIP)</title>
+ <indexterm><primary>PLIP</primary></indexterm>
<indexterm>
- <primary>PLIP</primary>
- </indexterm>
- <indexterm>
- <primary>平行线 IP</primary>
+ <primary>并口电缆 IP</primary>
+ <see>PLIP</see>
</indexterm>
<para>PLIP 允许我们在两个平行的端口间运行 TCP/IP。
@@ -2967,7 +3085,7 @@ redirect_port tcp 192.168.0.3:80 80</programlisting>
这部分,我们将讨论:</para>
<itemizedlist><listitem>
- <para>建立平行的 (laplink) 线缆。</para>
+ <para>制作并口的 (laplink) 线缆。</para>
</listitem>
<listitem>
@@ -2975,11 +3093,11 @@ redirect_port tcp 192.168.0.3:80 80</programlisting>
</listitem></itemizedlist>
<sect2 id="network-create-parallel-cable">
- <title>建立平行的线缆。</title>
+ <title>制作并口电缆。</title>
- <para>您可以在许多计算机供应店里买到平行线缆。
+ <para>您可以在许多计算机供应店里买到并口电缆。
如果不行或您想知道怎么做线,
- 下面的表格就显示了如何利用普通的打印机平行线做一根:</para>
+ 下面的表格就显示了如何利用普通的打印机并口线做一根:</para>
<table frame="none">
<title>为网络配平行线</title>
@@ -3184,15 +3302,15 @@ round-trip min/avg/max/stddev = 2.530/2.643/2.774/0.103 ms</screen>
</sect1info>
<title>IPv6</title>
- <para>IPv6 (也叫 IPng <quote>IP下一代</quote>)
- 是著名的 IP 协议 (也叫 <acronym>IPv4</acronym>)
- 的新版。象其它当前的 *BSD 系统一样,FreeBSD 包括了
- <literal>KAME</literal> IPv6 相关工具。因此您的 FreeBSD
- 系统事带有所有您在体验 IPv6 时所需要的。这部分主要集中在
- IPv6 的配置和运行上。</para>
+ <para>IPv6 (也被称作 IPng <quote>下一代 IP</quote>)
+ 是中所周知的 IP 协议 (也被叫做
+ <acronym>IPv4</acronym>) 的新版本。 和其他现代的 *BSD 系统一样,
+ FreeBSD 包含了 KAME 的 IPv6 参考实现。 因此,
+ 您的 FreeBSD 系统包含了尝试 IPv6 所需要的所有工具。
+ 这一节主要集中讨论如何配置和使用 IPv6。</para>
- <para>在二十世纪 90 年代早期,人们开始当心迅速缩小的 IPv4
- 地址空间。根据互联网的膨胀率,有两点需要考虑:</para>
+ <para>在 1990 年代早期, 人们开始担心可用的 IPv4 地址空间在不断地缩小。 随着
+ Internet 的爆炸式发展, 主要的两个担心是:</para>
<itemizedlist><listitem>
<para>所有的 IP 地址用光。今天不再那么当心了,
@@ -3552,6 +3670,17 @@ gif0: flags=8010&lt;POINTOPOINT,MULTICAST&gt; mtu 1280
<programlisting>ipv6_defaultrouter="<replaceable>MY_IPv6_REMOTE_TUNNEL_ENDPOINT_ADDR</replaceable>"</programlisting>
</sect3>
+
+ <sect3>
+ <title>IPv6 隧道配置</title>
+
+ <para>如果服务器将您的网络通过 IPv6 路由到世界的其他角落,
+ 您需要在 <filename>/etc/rc.conf</filename>
+ 中添加下面的配置:</para>
+
+ <programlisting>ipv6_gateway_enable="YES"</programlisting>
+
+ </sect3>
</sect2>
<sect2>
@@ -3628,7 +3757,7 @@ gif0: flags=8010&lt;POINTOPOINT,MULTICAST&gt; mtu 1280
例如我们有四台机子在网络里,每一台都使用一张 ATM 适配器卡连接到 ATM
网络。第一步就是规划 IP 地址和机子间的 ATM 连接。我们使用下面的:</para>
- <informaltable frame="none">
+ <informaltable frame="none" pgwide="1">
<tgroup cols="2">
<colspec colwidth="1*">
<colspec colwidth="1*">
@@ -3665,7 +3794,7 @@ gif0: flags=8010&lt;POINTOPOINT,MULTICAST&gt; mtu 1280
<para>为了建造完全交错的网络,我们需要在第一对机子间有一个 ATM 连接:</para>
- <informaltable frame="none">
+ <informaltable frame="none" pgwide="1">
<tgroup cols="2">
<colspec colwidth="1*">
<colspec colwidth="1*">