Bridging mini-Howto <author>Christopher Cole <tt><htmlurl url="mailto:cole@coledd.com" name="cole@coledd.com"></tt> <date>v1.11, 7 September 1998 <trans>柴田(ひ)@福岡 <tt><htmlurl url="mailto:shibata@opost1.netspace.or.jp" name="shibata@opost1.netspace.or.jp"></tt> と 早川 仁 <tt><htmlurl url="mailto:cz8cb01@linux.or.jp" name="cz8cb01@linux.or.jp"></tt> <tdate>v1.11j, 1999年 6月26日 <abstract> <!-- This document describes how to setup an ethernet bridge. What is an ethernet bridge? An ethernet bridge is a device that controls data packets within a subnet in an attempt to cut down the amount of traffic. A bridge is usually placed between two separate groups of computers that talk within themselves, but not so much with the computers in the other group. A good example of this is to consider a cluster of Macintoshes and a cluster of unix machines. Both of these groups of machines tend to be quite chatty amongst themselves, and the traffic they produce on the network causes collisions for the other machines who are trying to speak to one another. A bridge would be placed between these groups of computers. The job of the bridge is then to examine the destination of the data packets one at a time and decide whether or not to pass the packets to the other side of the ethernet segment. The result is a faster, quieter network with less collisions.--> このドキュメントでは ethernet ブリッジをどのようにセットアップするかについて説明しています。ethernet ブリッジとはサブネットのトラフィック量を減少させるためにデータパケットをコントロールするデバイス(機器)のことです。通常ブリッジは、多くの通信がグループ内だけで行われ多少の通信を他のグループと行う、2つのグループの間に置かれます。(訳注:このグループは一般的にセグメントと表現されます) </abstract> <!-- 本当は下の"はじめに"セクションも abstract の一部だったんですが、冗長だったため セクションにしてしまいました(^^;;; あと、netscape だと改行(\n)を行うとなぜか半角スペースが空いてしまうため、 1パラグラフ=1行にしています。 --> <!-- Table of contents --> <toc> <sect>はじめに <p> たとえば、同一のネットワーク上にある Macintosh マシンのグループと Unix マシンのグループを考えてみましょう。それぞれのグループ内での通信は非常に多く、一方のグループがネットワーク上に流すトラフィックが、他方のグループ内で通信しようとしているマシンにコリジョンを引き起こしてしまいます。これら 2 つのコンピュータグループの境目に、ブリッジを置くことができます。ブリッジは、一つ一つのデータパケットの宛先を調べ、そのパケットをもう一方の Ethernet セグメントに送るかどうかを決定する働きをします。結果としてコリジョンが減少し、ネットワークの使用率は低下して速度が向上することになります。 (訳注:ethernet の世界では、セグメント上の全マシン(実際には NIC)が全パケットを受信し、自分か全員宛(ブロードキャストメッセージ)以外のパケットを破棄するようになっています。ですから、仮にMACとUNIXが1つのセグメント上にあったとすると、MAC→MACといった通信であってもUNIXもこのパケットを受信してしまいます。2台のマシンから同時にパケットを送信した場合コリジョンとなり、両者のパケットは破棄されてしまいます。ブリッジを立てることによって、セグメント内ではコリジョンは発生しますが、セグメント間のトラフィック量は減少することになります) <!-- 直訳っぽくなるため、What is an ethernet bridge? は訳しませんでした(^^; --> <sect>セットアップ <!-- Setup --> <p> <enum> <item>``Bridge Config''の入手 <!-- Get ``Bridge Config'': --> <!-- <tscreen> <url url="ftp://shadow.cabi.net/pub/Linux/BRCFG.tgz"> </tscreen> --> <tscreen> http://mirror.nucba.ac.jp/mirror/stampede/pre-0.90/source/net/BRCFG/source/ </tscreen> <!-- (cz) 2000/07/15 追記: 原文のサイトからは消えているため、ミラーサイトを記述 --> <!-- <item>Enable multiple ethernet devices on your machine by adding this to your <tt>/etc/lilo.conf</tt>, and re-run <tt>lilo</tt>: --> <item>使用するマシンで複数の ethernet を扱えるように <tt>/etc/lilo.conf</tt> に次の行を追加し、<tt>lilo</tt> を再実行します。 <tscreen> <verb> append = "ether=0,0,eth1" </verb> </tscreen> <!-- If you have three interfaces on your bridge, use this line instead: --> 3枚のNICでブリッジを構成するのであれば、かわりとして下記の設定を使います。 <tscreen> <verb> append = "ether=0,0,eth1 ether=0,0,eth2" </verb> </tscreen> <!-- </p> --> <!-- <p> --> <!-- More interfaces can be found by adding more ether statements. By default a stock Linux kernel probes for a single ethercard, and once one is found the probe ceases. The above append statement tells the kernel to keep probing for more ethernet devices after the first one is found. --> 4 枚以上の NIC を使うのであれば、さらに <tt>ether</tt> の指定を追加すればいいでしょう。標準の Linux Kernel の動作としては、1 枚の NIC が検出された時点でそれ以上の検出は行いません。上記の設定は 1 枚目の NIC が検出された後も引き続き NIC の検出を行わせるための指定です。 <!-- </p> --> <!-- <p> --> <!-- Alternatively, the boot parameter can be used instead: --> その他にもブート時のパラメータ設定で(NIC が 2 枚の時は)下記のようにも出来ます。 <tscreen> <verb> linux ether=0,0,eth1 </verb> </tscreen> <!-- Or, with 3 interfaces, use: --> また NIC が 3 枚の場合は、次のようになります。 <tscreen> <verb> linux ether=0,0,eth1 ether=0,0,eth2 </verb> </tscreen> <!-- </p> --> <item><tt>BRIDGING</tt> を有効にして、kernel の再構築を行います。 <!-- Recompile the kernel with <tt>BRIDGING</tt> enabled. --> <!-- <item>A bridge should not have an IP address. It CAN, but a plain bridge doesn't need one. To remove the IP address from your bridge, go to <tt>/etc/sysconfig/network-scripts/</tt> (for a RedHat system) and copy <tt>ifcfg-lo0</tt> to <tt>ifcfg-eth0</tt> & <tt>ifcfg-eth1</tt>. In these 2 eth files, change the line containing ``<tt>DEVICE=lo</tt>'' to ``<tt>DEVICE=eth0</tt>'' and ``<tt>DEVICE=eth1</tt>''. Other distributions may deviate from this, do what you need to do! If there are more than 2 interfaces to this bridge, be sure to make the corresponding configurations to those, as well. --> <item>通常ブリッジは IP アドレスを持たないものです。持たせることも出来ますが、普通は IP アドレスを必要としません。(RedHat の場合)ブリッジから IP アドレスを取り除くには <tt>/etc/sysconfig/network-scripts/</tt> ディレクトリの <tt>ifcfg-lo0</tt> を、<tt>ifcfg-eth0</tt> と <tt>ifcfg-eth1</tt> としてコピーします。 この 2 つのファイルの中で ``<tt>DEVICE=lo</tt>''と書かれている行を探して、それぞれ ``<tt>DEVICE=eth0</tt>'' と ``<tt>DEVICE=eth1</tt>''に変更します。 その他のディストリビューションでこれとはちょっと違うでしょうから、(そのディストリビューションでの)適切な方法で行ってください。 (訳注: Slackware では、/etc/rc.d/rc.inet1 を編集することになると思います) 3 枚以上の NIC でブリッジを構成するのであれば、同様に適切な設定を行ってください。 <!-- <item>Reboot, so you are running the new kernel with bridging in it, and also to make sure that an IP addresses are not bound to the network interfaces. --> <item>リブートします。新しい kernel はブリッジ機能をサポートしています。また NIC に IP アドレスが割り振られていないことに注意してください。 <!-- <item>Once the system is back up, put the ethernet cards into promiscuous mode, so they will look at every packet that passes by its interface: <tscreen> <verb> ifconfig eth0 promisc ; ifconfig eth1 promisc </verb> </tscreen> All interfaces which are connected to network segments to be bridged are to be put into promiscuous mode. --> <item>システムが再起動したら、NIC を「無差別透過:promiscuous」モードにします。このモードではすべてのパケットをそれぞれの NIC で透過させます。 <tscreen> <verb> ifconfig eth0 promisc ; ifconfig eth1 promisc </verb> </tscreen> これにより、ブリッジを構成するためにネットワークセグメントに接続されている全ての NIC は、無差別透過モードとなります。 <!-- <item>Turn bridging ON using the <tt>brcfg</tt> program: --> <item><tt>brcfg</tt> プログラムでブリッジングを ON にします。 <tscreen> <verb> brcfg -ena </verb> </tscreen> <item>各 NIC でのトラフィックが異なっていることを確認します。 <!-- <item>Verify that there is different traffic on each interface: --> <tscreen> <!-- <verb> tcpdump -i eth0 (in one window) tcpdump -i eth1 (in another window) </verb> --> <verb> tcpdump -i eth0 (こっちのウインドウで見る) tcpdump -i eth1 (別のウインドウで見る) </verb> </tscreen> <!-- <item>Run a sniffer or <tt>tcpdump</tt> on another machine to verify the bridge is separating the segment correctly. --> <item>sniffer(スニッファー)や <tt>tcpdump</tt> を他のマシンで動かし、構築したブリッジで正しくセグメントが分離されている事を確認します。 </enum> </p> <sect>よくある質問と答え <!-- Common problems --> <p> <enum> <item> <descrip> <tag/Question/ <!-- I get the message <tscreen> <verb> ioctl(SIOCGIFBR) failed: Package not installed </verb> </tscreen> What does this mean? --> <tscreen><verb>ioctl(SIOCGIFBR) failed: Package not installed</verb></tscreen> と言うメッセージが出ます。これはどういう意味ですか? <tag/Answer/ <!-- You don't have bridging capability in your kernel. Get a 2.0 or greater kernel, and recompile with the <tt>BRIDGING</tt> option enabled. --> kernel のブリッジ機能を有効にしていません。バージョン 2.0 以降の新しい kernel を入手して、<tt>BRIDGING</tt> を有効にしてカーネルを再構築しましょう。 </descrip> <item> <descrip> <tag/Question/ <!-- Machines on one side cannot ping the other side! --> ブリッジの一方のセグメントのマシンから、他方のセグメントのマシンに ping できません。 <tag/Answer/ <itemize> <!-- <item>Did you enable bridging using ``<tt>brcfg -ena</tt>''? (<tt>brcfg</tt> should say ``<tt>bridging is ENABLED</tt>'') <item>Did you put the interfaces into promiscuous mode? (issue the ``<tt>ifconfig</tt>'' command. The ``<tt>PROMISC</tt>'' flag should be on for both interfaces.) <item>If using multiple-media interface adapters, make sure that the correct one is enabled. You may need to use the config/setup program that came with the network interface card. --> <item> ``<tt>brcfg -ena</tt>''として、ブリッジ機能を有効にしましたか? (<tt>brcfg</tt> は``<tt>bridging is ENABLED</tt>'' と表示するはずです) <item> NIC を「無差別透過モード」にしましたか? (``<tt>ifconfig</tt>''で確認して見てください。``<tt>PROMISC</tt>''フラグがそれぞれの NIC に表示されるはずです) <item>複数のメディア(10Base-5/2/T)を持つ NIC の場合は、正しいものが有効になっていますか? NIC と一緒に付いてきた設定プログラムを使用する必要があるかもしれません。 </itemize> </descrip> <item> <descrip> <tag/Question/ <!-- I cannot <tt>telnet</tt>/<tt>ftp</tt> from the bridge! Why? --> ブリッジから <tt>telnet</tt> / <tt>ftp</tt> ができません。なぜでしょうか? <tag/Answer/ <!-- This is because there is no IP address bound to any of bridge interfaces. A bridge is to be a transparent part of a network. --> ブリッジの NIC には IP アドレスが割り振られていないからです。ブリッジはネットワーク上の透過的なものですから。 </descrip> <item> <descrip> <tag/Question/ <!-- What do I need to set up in the way of routing? --> routing(経路制御)にあたって何をすればいいでしょうか? <tag/Answer/ <!-- Nothing! All routing intelligence is handled by the bridging code in the kernel. To see the ethernet addresses as they are learned by the bridge, use the <tt>brcfg</tt> program in debug mode: --> 何もいりません! kernel 内のブリッジに関するコードですべての経路制御学習機能が実現されています。ブリッジによって学習された Eternet アドレスを見るには <tt>brcfg</tt> プログラムをデバッグモードで動かしてください。 <tscreen> <verb> brcfg -deb </verb> </tscreen> </descrip> <item> <descrip> <tag/Question/ <!-- The bridge appears to work, but why doesn't ``traceroute'' show the bridge as a part of the path? --> ブリッジは動いているようですが、なぜブリッジが ``traceroute'' でパスの一部分として見えないのでしょうか? <tag/Answer/ <!-- Due to the nature of a bridge, a ``traceroute'' should NOT show the bridge as a part of the path. A bridge is to be a transparent component of the network. --> 元来のブリッジの意味合いから、``traceroute'' ではブリッジをパスの一部分として見せるべきではありません。ブリッジはネットワーク上の透過的な部品(ケーブルなど)と同様ですから。 </descrip> <item> <descrip> <tag/Question/ <!-- Is it necessary to compile <tt>IP_FORWARD</tt> into the kernel? --> kernel 再構築時に <tt>IP_FORWARD</tt> を有効にする必要がありますか? <tag/Answer/ <!-- No. The bridging code in the kernel takes care of the packet transport. <tt>IP_FORWARD</tt> is for a gateway which has IP addresses bound to its interfaces. --> いいえ。ブリッジ機能を実現する kernel 内のコードはパケットを通しているだけです。<tt>IP_FORWARD</tt> はそれぞれの NIC に IP アドレスを割り振ったゲートウエイとして動作させるためのものです。 </descrip> <item> <descrip> <tag/Question/ <!-- Why are the physical ethernet addresses for port 1 and port 2 the same according to the ``<tt>brcfg</tt>'' program? Shouldn't they be different? --> なぜ <tt>brcfg</tt> によって返されるポート 1 とポート 2 のイーサネット(MAC)アドレスは同じなのですか? 異なるはずではないのですか? <tag/Answer/ <!-- No. Every port on a bridge intentionally is assigned the same physical ethernet address by the bridging code. --> いいえ。ブリッジとして動作させているすべてのポートはブリッジプログラムによって同じイーサネットアドレスが割り振られます。 </descrip> <item> <descrip> <tag/Question/ <!-- Bridging does not appear to be an option when performing a make config on the kernel. How does one enable it? --> <tt>BRIDING</tt> はカーネルコンフィグの際に出てこないようですが、どのように有効にすればよいのでしょうか? <tag/Answer/ <!-- During the kernel config, answer 'Y' to the question, ``Prompt for development and/or incomplete code/drivers (CONFIG_EXPERIMENTAL) [Y/n/?]''. --> ``Prompt for development and/or incomplete code/drivers (CONFIG_EXPERIMENTAL) [Y/n/?]'' に対して 'Y' を設定することにより表示されます。 </descrip> <item> <descrip> <tag/Question/ <!-- Too many hubs (4 or more) chained one after another (in series) cause timing problems on an ethernet. What effect does a bridge have in a subnet that is layered with hubs? --> (4 個以上の)多くのハブがカスケード接続されている場合、ethernet 上でタイミングの問題を引き起こしますが、ハブがそのように積み重なっているサブネット中にブリッジが存在する場合、どのような影響がありますか? (訳注:物理的な(電気信号的な)仕様により、ハブは 4 個以上カスケード接続できないことになっています。4 個までではなく、4 個以上です) <tag/Answer/ <!-- A bridge resets the 3/4/5 hubs rule. A bridge does not deal with packets the way a hub does, and is therefore not a contributor to timing problems on a network. --> ブリッジはそのような 3/4/5 個のハブのルールを解決できます。ブリッジはハブと同じ方法でパケットを扱うわけではありませんので、ネットワーク上でのタイミングの問題は引き起こしません。 (訳注:ハブはレイヤ1(物理層)、ブリッジはレイヤ2(データリンク層)でパケットを扱います) </descrip> <item> <descrip> <tag/Question/ <!-- Can a bridge interface to both 10Mb and 100Mb ethernet segments? Will such a configuration slow down the rest of the traffic on the high speed side? --> ブリッジは 10Mb と 100Mb の ethernet セグメントとの間で使用できるのでしょうか? そのような使い方をした場合、早い方(100Mb)の速度は低下してしまわないでしょうか? (訳注:b = bit です。ですから 10Mb = 10M bit となります) <tag/Answer/ <!-- Yes, a bridge can tie together a 10Mb segment with a 100Mb segment. As long as the network card on the fast network is 100Mb capable, TCP takes care of the rest. While it's true that the packets from a host in the 100Mb network communicating to a host in the 10Mb network are moving at only 10Mb/s, the rest of the traffic on the fast ethernet is not slowed down. --> 始めの質問の答えは Yes です。ブリッジは 10Mb と 100Mb のセグメントとを結ぶことができます。(ブリッジの)早い方のネットワークの NIC が 100Mb で動作するものである限り、問題ありません。100Mb ネットワークのホストから 10Mb ネットワークのホストへ送られたパケットは 10Mb/s の速度しか出ませんが、100Mb ネットワークの他のトラフィックは 100Mb のまま動作しつづけます。 (訳注:つまり、100Mb から 10Mb へ投げられたパケットは、ブリッジで 10Mb へ送られる際に 10Mb で動作することになります。よって 100Mb のホスト→ブリッジの速度、及び 100Mb のホスト→ 100Mb のホストは 100Mb で動作するということです) </descrip> </enum> </p> <p> <sect>翻訳について <p> 当文書は柴田(ひ)@福岡氏の翻訳した 1996/08/23 版を、早川が最新版(1998/09/07)の LDP で更新したものです。 <verb> 日本語訳:柴田(ひ)@福岡 <shibata@opost1.netspace.or.jp> (1997/01/05) 日本語訳:早川 仁 <cz8cb01@linux.or.jp> (1999/06/26) </verb> </article>