Dial-On-Demand mini-HOWTO <author>Rodney van den Oever, <htmlurl url="mailto:Rodney.van.den.Oever@tip.nl" name="Rodney.van.den.Oever@tip.nl"> <date>Version 1.0, 28 July 1996 <!-- Version 1.0, 28 July 1996 / updated and submitted 29 february 1997--> <trans>伊佐冶 哲, <htmlurl url="mailto:isaji@mxu.meshnet.or.jp" name="isaji@mxu.meshnet.or.jp"> <tdate>8 Jan 1998 <abstract> <!-- This document describes how to do dial-on-demand dialling and how to use a Linux host connected to a private local network as a dial-on-demand PPP-router. --> このHOWTOはどのようにしてダイアルオンデマンド(<tt/dial-on-demand/)ダイアリング をするか、またどのようにしてダイアルオンデマンドPPPルータとしてプライベート ローカルネットワーク接続されたLinuxを使うかについて解説しています。 (<em/訳注:/ダイアルオンデマンドネットワークについてはkerneld mini-HOWTO (日本語版)、小川 健太郎さん(<tt/k_ogawa@oyna.cc.muroran-it.ac.jp/)、 藤井 真吾さん(<tt/sfujii@super.win.or.jp/) 共訳にも書かれているので参照して下 さい。また文書中のPPPの設定が現在あまり適切でないものもあるので 「Networking Linux」やまだ あきらさん、はね ひでやさん(アスキー出版)を参考に したほうがよい箇所もあります)。 </abstract> <!-- Table of Contents --> <toc> <sect>イントロダクション <!-- Introduction:--> <p> <!-- The kerneld-mini-HOWTO already describes how kerneld can execute a 'request-route' script, I'd like to describe a working setup in more detail. --> kerneld-mini-HOWTOにはすでに,どのようにしてkerneldが<tt/request-route/ スクリプトを実行するか書かれています。そこでここでは動作設定について詳しく 述べたいと思います。 <!-- If you have a small network at home, this is a very elegant way to provide transparent Internet-access for a couple of other machines. --> もし自宅で小さなネットワークを組んでいる場合について,2台のマシンで (透過的な)インターネットアクセスを行うエレガントな方法があります。 <verb> ______________________________ __|__ ___|___ | | ローカル | | ______ プロバイダへのPPP-リンク | PC | ネットワーク | Linux |---|モデム|--------------------------> | | 192.168.1.0 | ルータ| |______| x.x.x.x |_____| |_______| (ダイナミックIP-アドレス) named pppd </verb> <!-- This setup requires: --> ここで以下の環境が整っているものとして話しを進めます。 <itemize> <item>Kernel 2.0.0 以降 <item>ppp-2.2.0f.tar.gz 以降 <item>modules-2.0.0.tar.gz 以降 <item>ipfwadm-2.3.tar.gz (http://www.xos.nl/linux/ipfwadm) </itemize> <!-- The following steps need to be taken: --> また以下の順番で作業を進めます。 <enum> <item> Kernel 設定 <item> Modules インストール <item> PPP インストール <item> シリアルポートとモデムの設定 <item> PPP 設定 <item> Dial-On-Demand <item> ネットワークの設定 <item> Masquerading 設定 <item> Workstation 設定 </enum> <sect>カーネル設定 <!-- 1. Kernel Configuration: --> <p> <!-- First we need to compile a kernel with kerneld, ppp and IP-masquerading support.I'll only show the options required for this setup, other options like firewall logging or transparent proxying can be turned on, but are not required: --> はじめにkerneld, ppp そして IP-マスカレード(masquerading)をサポート するようにカーネルをコンパイルします。このセットアップで必要なオプション を書くだけにします。その他のオプション[ファイアウォール(firewall)、 ログイン(logging)、透過的プロキシ(transparent proxying)] についてはこれも指定しておきますが必ずしも必要というわけではありません。 <code> cd /usr/src/linux make config (or make menuconfig) * Code maturity level options * Prompt for development and/or incomplete code/drivers (CONFIG_EXPERIMENTAL) [Y/n/?] * Loadable module support (ロードモジュールのサポート) * Enable loadable module support (CONFIG_MODULES) [Y/n/?] Set version information on all symbols for modules (CONFIG_MODVERSIONS) [N/y/?] Kernel daemon support (e.g. autoload of modules) (CONFIG_KERNELD) [Y/n/?] * Networking support (CONFIG_NET) [Y/n/?] * * Networking options (ネットワークオプション) * Network firewalls (CONFIG_FIREWALL) [Y/n/?] TCP/IP networking (CONFIG_INET) [Y/n/?] IP: forwarding/gatewaying (CONFIG_IP_FORWARD) [Y/n/?] IP: firewalling (CONFIG_IP_FIREWALL) [Y/n/?] IP: masquerading (EXPERIMENTAL) (CONFIG_IP_MASQUERADE) [Y/n/?] * * Protocol-specific masquerading support will be built as modules. * (マスカレードプロトコルサポートはモジュールとして作られます) IP: always defragment (CONFIG_IP_ALWAYS_DEFRAG) [Y/n/?] IP: optimize as router not host (CONFIG_IP_ROUTER) [Y/n/?] * * Network device support (ネットワークデバイスのサポート) * Network device support (CONFIG_NETDEVICES) [Y/n/?] * PPP (point-to-point) support (CONFIG_PPP) [M/n/y/?] * * CCP compressors for PPP are only built as modules. * (CCP PPPコンプレッサはモジュールとしてだけ作られます) Ethernet (10 or 100Mbit) (CONFIG_NET_ETHERNET) [Y/n/?] NE2000/NE1000 support (CONFIG_NE2000) [Y/m/n/?] </code> <!-- The latter option depends of course on the netword card used! --> 後半のオプションは使っているネットワークカードに依存します! <!-- Compile the kernel with: --> そしてコンパイルします。 <verb> make zlilo make modules make modules_install </verb> <!-- If you don't use LILO, copy /usr/src/linux/arch/i386/boot/zImage to the proper location for your setup. The modules are installed in /lib/modules/x.x.x, Where x.x.x reflects the version-number of your kernel. --> もしLILOを使わないなら<tt>/usr/src/linux/arch/i386/boot/zImage</tt>を適当な 場所にコピーします。モジュールは<tt>/lib/modules/x.x.x</tt>にインストールさ れています。ここで<tt/x.x.x/はカーネルのバージョンを表しています。 <sect>モジュールのインストール <!-- 2. Modules Installation: --> <p> <!-- The following module-utilities are required: --> 以下のモジュールユーティリティが必要です: <itemize> <item>/sbin/insmode <!-- Loads module requested --> 要求されたモジュールを読み込む <item>/sbin/rmmod <!-- Removes module no longer needed --> 不必要なモジュールを削除する <item>/sbin/depmod <!-- Creates depedencies --> Makefileライクな依存性(depedencies)ファイルを作る <item>/sbin/kerneld <!-- Kerneld extension to load modules automatically--> 自動的にモジュールを読み込むためのカーネルデーモン(Kerneld) </itemize> <!-- If you don't have these yet, install 'm by: --> まだ上記したものをインストールしていなければ,いれておきましょう。 <verb> cd /usr/src tar zxf modules-2.0.0.tar.gz make install </verb> <!-- To load kerneld at startup we need to edit /etc/rc.d/rc.S or create a seperate script rc.modules which is called from rc.S. Add or change the following lines: --> 起動時にkerneldをロードするために,<tt>/etc/rc.d/rc.S</tt>を編集するか rc.Sから呼ばれる分割スクリプト rc.modulesを作っておきます。 以下の行のように変更するか追加するかして下さい。 <p> /etc/rc.d/rc.modules: <code> if [ ! -f /lib/modules/`uname -r`/modules.dep ] ; then echo "Updating module dependencies for Linux `uname -r`:" /sbin/depmod -a fi [ -x /sbin/kerneld ] && /sbin/kerneld </code> <!-- The first part checks for the module-dependencies and creates them if they don't rc.modulesexist yet. --> はじめの箇所ではモジュール依存をチェックして、 もしrc.modulesが存在しない場合はそれをアップデートします。 <sect>PPPインストール <!-- 3. PPP Installation: --> <p> <!-- The following stuff is required to setup a PPP-link: --> PPPリンクを設定するために以下のプログラム群が必要です。 <itemize> <item>/usr/sbin/pppd PPP-デーモン <item>/usr/sbin/pppstats PPP-状態の表示 <item>/usr/sbin/chat 実行スクリプト </itemize> 以下のようにしてインストールします。 <verb> cd /usr/src tar zxf ppp-2.2.0f.tar.gz cd ppp-2.2.0f ./configure make kernel </verb> <!-- Since later kernels already include the PPP-code, 'make kernel' won't replace anything. Check the README and Makefile for shadow-support (if you also want to dial-in to this host) and other options. Then do: --> 最新のカーネルはPPPコードを含んでいるので'make kernel'は何も置き換えません。 (もしこのホストへのダイアルインが不要なら)シャドウパスワードやその他のオプ ションのREADMEやMakefileをチェックして下さい。そして <verb> make make install </verb> と実行します。 <sect>シリアルポートとモデムの設定 <!-- 4. Serial port and modem configuration: --> <p> <!-- This setup requires a modem. Serial port setup is done in /etc/rc.d/rc.serial: --> このセットアップではモデムが当然必要です。またシリアルポートのセットアップは <tt>/etc/rc.d/rc.serial</tt>で行います: <code> ${SETSERIAL} /dev/cua0 uart 16450 port 0x3F8 irq 4 ${SETSERIAL} /dev/cua1 uart 16550A port 0x2F8 irq 3 spd_vhi </code> <!-- In this setup COM1 is used by the mouse and COM2 by an internal 28k8 modem.The spd_vhi-parameter replace the 38400 bps-entry in the speeds-table with 115200. Likewise, spd_hi replaces this by 57600. --> COM1はマウスに使われていて、COM2は内部28k8(28,800)モデムに使われています。 <tt/spd_vhi/パラメータはスピードテーブルの38400bpsエントリーを11520bpsに 置き換えます。一方<tt/spd_hi/にすれば57600bpsに設定されます(<em/訳注:/ モデムによる圧縮が働いて内部的にシリアルデバイス読み書きの速度が上がります)。 <!-- Use spd_vhi with a 28k8 modem and spd_hi with a 14k4 modem, but start with 38400,just to be on the safe side. --> 28k8モデムでは<tt/spd_vhi/オプションを使い14k4モデムでは<tt/spd_hi/オプション を使いますが、安全のために38400でスタートします。 <!-- You can check your modem setup by running 'minicom' or some other terminal program. --> 'minicom'(<em/訳注:/ほとんどのlinuxディストリビューションではインストール されています)や他のターミナルプログラムを使って(seyonなど)モデムのセット アップをチェックできます <!-- your modem should echo the characters typed. use ctrl-a, p to change the communication parameters. check if it still works at 57600 or 115200 bps. entering 'atz' should return 'ok'. use ctrl-a x to leave minicom. --> モデムは入力した文字をエコーしなければなりません。<tt/Ctrl-A P/で通信 パラメータ(<em/訳注:/minicomでは&dquot;Comm Parameters&dquot;と表示)の変更 ができます。 もし57600 か 115200 bpsで動作しているようだったらチェックして下さい。 'atz'と入力すると 'ok'と返ってきます。<tt/Ctrl-A X/でminicomを終了させます。 <!-- minicom can also be used to dial your provider manually. make a note of what you need to enter to setup the link and what the response are from the remote server. if your provider doesn't use pap or chap you probably need to enter a username and password and possibly enter a command to setup the link in ppp-mode. --> minicomはプロバイダに手動でダイアルする時や、リモートサーバからの応答や設定前 の確認などに使えます。 もしプロバイダがpapやchapを使っていない場合はPPPモードでリンク設定のコマンド を入力したり,ユーザ名/パスワードを入力する必要があるかもしれません。 <sect>ppp設定 <!-- 5. ppp configuration: --> <p> <!-- pppd searches /etc/ppp for scripts and the file 'options'. --> pppdは/etc/pppでスクリプトを探します。 <p> /etc/ppp/options: <code> /dev/modem 38400 crtscts modem noipdefault defaultroute idle-disconnect 120 </code> 意味: <itemize> <item>/dev/modem <!-- in my setup a link to /dev/cua1. --> デバイスは/dev/cua1にリンクをはっています。 <item>38400 <!-- gets replaced by 115200 (spd_vhi-parameter in /etc/rc.d/rc.serial) -->(/etc/rc.d/rc.serialファイルの<tt/spd_vhi/パラメータで)115200に 置き換えられます。 <item>crtscts <!-- hardware handshake, rts/cts, don't use xon-xoff-handshaking! -->ハードフロー制御(hardware handshake)、rts/cts。 Xon-Xoffフロー制御 は使わないで下さい。 <item>noipdefault <!-- the ip-address is assigned automatically. --> 自動的にIPアドレスをアサインする(PPPネゴシエーションでIPを決定)。 <item>defaultroute <!-- this sets the default route to the ppp-interface when the link is up. -->これはリンクが確立したときデフォルトルートをpppインターフェースにセット します。 <item>idle-disconnect<!-- idle-disconnect ppp-2.2.0f automatically disconnects an idle link after 120 seconds.--> 120秒後にアイドルリンクを自動的に切断(PPP-2.2.0f)。 </itemize> <!-- Now we need to create a script, just name it 'default', meaning the ISP you normally use. If you want to make other connections too, creates differents scripts for these sites and name them with the remote IP-address. --> 次にスクリプト'default'(通常使うプロバイダISP)を書きます。 他の接続も行う場合は,各サイト用のスクリプトを別々に作ります。 <p> /etc/ppp/default: <verb> "" ats11=55dtXXXXXXXX CONNECT "" rname: UUUUU sword: PPPPP > ppp </verb> 意味: <itemize> <item>ats11=55 <!-- shortens the duration of the dial tones to speed up dialing. --> ダイアルトーンとダイアルスピードの指定。 <item>XXXXXXXX <!-- Enter the phone-number for your provider here. --> プロバイダの電話番号を入力。 <item>CONNECT <!-- chat waits for your modem to return 'CONNECT'. --> chatはモデムから'CONNECT'が返ってくるのを待ちます。 <item>rname: <!-- chat waits for 'rname', and enters 'UUUUU' --> chatは'rname'を待ち、'UUUUU'を入力します。 <item>sword: <!-- chat waits for 'sword', and then enters 'PPPPP'. --> chatは'sword'を待ち、'PPPPP'を入力します。 </itemize> <!-- Replace 'UUUUU' and 'PPPPP' by your username and password. I use 'rname' and 'sword' because sometimes the first letter gets missed or could be upper- or lowercase and language-dependent. Some ISP's require you to enter 'ppp' after your enter the username and password, so I wait for the last character of the routerprompt ('>'). --> 'UUUUU' と 'PPPPP'をそれぞれユーザ名とパスワードに置き換えておいて下さい。 ここでは 'rname'と'sword'を使います。はじめの文字が欠落したり大文字/小文字 だったり言語によって違うのでこのようにします(<em/訳注/:各自のプロバイダに合 わせて変更します。'rname'ではなく'ogin:'などの場合もあります)。 プロバイダによってユーザー名とパスワードを入力したら'ppp'入力を必要とする ところもあります。そこでルータプロンプト('>')のラストキャラクタ待ちにします。 <!-- If you get errors like 'serial line looped back' or 'serial line not 8-bit clean' the link is not yet in PPP-mode. --> &dquot;serial line looped back&dquot;や&dquot;serial line not 8-bit clean &dquot;といったエラーが出たら、まだPPPモードにはなっていません。 <p> /etc/ppp/ppp: <code> #!/bin/sh /usr/sbin/pppd connect '/usr/sbin/chat -v -f /etc/ppp/default' </code> <!-- This command is long enough to place it in a small script:--> このコマンドは短いスクリプトに書ける程度の長さです。 <!-- You should now be able to connect to your ISP, you might add the 'debug' parameter to the /etc/ppp/options-file, make sure you increase the loglevel of syslogd to see whats going on: --> これでプロバイダに接続できます。<tt>/etc/ppp/options</tt>にデバッグパラメータ 'debug'を追加すればpppdが行っていることを監視するsyslogdのログレベルを増やす ことができます。 <p> /etc/syslog.conf <verb> *.debug /var/log/messages </verb> <!-- If you edit syslog.conf be sure to notify syslogd about this change. Depending on the location of its PID-file, do:--> syslog.confを編集したらこの変更をsyslogd(syslogデーモン)に認識させます。 PIDファイルの位置は適当なディレクトリを書いて下さい。 <verb> kill -1 `cat /var/run/syslog.pid` </verb> あるいは <verb> kill -1 `cat /etc/syslog.pid` </verb> <!-- After the connection is made, check with 'ifconfig' for the existing of a 'ppp0'-interface. Check your default route with 'netstat -r', it should point to your ISP. Try pinging a remote server, e.g. your providers nameserver. --> 接続後'ppp0'インターフェースがあるかを'<tt/ifconfig/'で、またデフォルトルート を '<tt/netstat -r/'でチェックします(プロバイダに接続しています)。 リモートサーバにpingをしてみます(例えばプロバイダのネームサーバに)。 <!-- If this works you could add this nameserver to your /etc/resolv.conf: -->以上で問題がなければ、ネームサーバを<tt>/etc/resolv.conf</tt>に登録します。 <verb> search your.isp.domain nameserver x.x.x.x </verb> (<em/訳注:/1行目はドメイン名の補完用のアドレスで、2行目はネームサーバ のIPアドレスです)。 <sect>ダイアルオンデマンド(Dial-on-Demand) <!-- 6. Dial-on-Demand --> <p> <!-- Kerneld can be used to load modules, like ppp, on demand. An additional feature,described in the kerneld-HOWTO, is the ability to invoke a script, if a particular route is missing. Kerneld will look for '/sbin/request-route'. The script below is an almost exact copy of the script included with the modules-2.0.0.tar.gz: --> KerneldはPPPといったモジュールを必要に応じてロードします。kerneld-HOWTO に書かれている追加機能は,特定のルートが失われたらスクリプトを呼び出すという 機能があるというものです。Kerneldはシェルスクリプト<tt>/sbin/request-route </tt>を探します。以下のスクリプトは<tt/modules-2.0.0.tar.gz/にあった スクリプトのコピーです。 <p> /sbin/request-route: <code> #!/bin/sh LOCK=/var/run/request-route.pid export PATH=/usr/sbin:$PATH # for ppp-2.2* # This script will be called from kerneld with the requested route as $1 # $1として要求されるルートで、このスクリプトがkerneldから呼び出されます。 chatfile=/etc/ppp/$1 # If no chatscript exists use a default value (symlink to preferred script): # chatスクリプトがなければデフォルト値を使います # (参照されるスクリプトへのシンボリックリンク): [ ! -f $chatfile ] && chatfile=/etc/ppp/default # Check if we're already running: # 実行されているかどうかチェックする: if [ ! -f $LOCK ] ; then pppd connect "chat -f $chatfile" & # Timer to be killed by ip-up, tunable! Check kerneld delay as well # ip-upによってkillされるタイマ。変更できます!kerneldもチェック。 sleep 60 & sleepid=$! echo $sleepid > $LOCK wait $sleepid rm -f $LOCK exit 0 fi exit 1 </code> <!-- Kerneld will run this script using the missing route as an argument: -->Kerneldは引数として無くなったルートを使ったこのスクリプトを実行します。 <verb> /sbin/request-route x.x.x.x </verb> <!-- The script uses a lock-file to prevent multiple 'request-route'-instances. -->スクリプトは'request-route'-要求(instances)の重複を防ぐためにロックファイル (<tt/lock-file/)を使います(<em/訳注:/ロックファイルがあるデバイスは他から 使用できないようになります)。 <!-- At first I used a script that was triggered by a nameserver query, but since I like to run a local nameserver, this lookup would be cached and a second query wouldn't bring the link up. That's why I changed the script to use a default chat-script if none exists. --> 最初はネームサーバへの参照があった時にスクリプトが起動されるように していました。しかし、ローカル(=自分のマシン)で(キャッシュ用に)ネー ムサーバを走らせようとすると、(最初の)参照がキャッシュされるため、2 度目(以降)の参照では(外部へアクセスが無いため)接続が確立しません。 <!-- old: はじめにネームサーバ要求(query)によって起動されるスクリプトを使いました が、ローカルネームサーバを起動したいので このlookupはキャッシュされ、セカンド query はリンクを確立しません。これが、 このスクリプトがない時にデフォルトのchatスクリプトを使うよう変更した理由 です。 --> <!-- This also allows you to create multiple chat-scripts for different links and use a default chat-script to connect to your ISP. --> 異なるリンク用のチャットスクリプト(chat-scripts)を複数つくるか デフォルトのチャットスクリプトでISP(プロバイダ)に接続するようにします。 <!-- After the link has been brought up, pppd executes the script /etc/ppp/ip-up which removes the lock-file. Add commands you'd like to execute everytime the link is brought up, like a sendmail queue-run: --> リンクが確立されたらpppdは<tt>/etc/ppp/ip-up</tt>スクリプトを実行します。 これはロックファイルを削除するものです。sendmailのキュー実行(queue-run)のよう に、リンクが確立される時はいつでも実行したいコマンドを追加します。 <code> #!/bin/ash LOCK=/var/run/request-route.pid [ -f $LOCK ] && kill `cat $LOCK` # Execute these commands after connecting: # 接続後実行するコマンド: #/usr/sbin/sendmail -q </code> <!-- The 'idle-disconnect'-option automatically disconnects an idle link, use 'ppp-off' is you want to disconnect immediately: -->'idle-disconnect'オプションは自動的にアイドルリンクを切断します。直接 PPPを切断するときは'ppp-off'スクリプトを実行します。 <p> /usr/sbin/ppp-off: <code> #!/bin/sh LOCK=/var/run/request-route.pid DEVICE=ppp0 rm -f $LOCK # # If the ppp0 pid file is present then the program is running. Stop it. # ppp0 PIDファイルがあればkillする。 if [ -r /var/run/$DEVICE.pid ]; then kill -INT `cat /var/run/$DEVICE.pid` # # If unsuccessful, ensure that the pid file is removed. # 不成功なら、PIDファイルが削除されていることを確認。 if [ ! "$?" = "0" ]; then echo "removing stale $DEVICE pid file." rm -f /var/run/$DEVICE.pid exit 1 fi # # Success. Terminate with proper status. # 成功。適当な状態で終りました。 echo "$DEVICE link terminated" exit 0 fi # # The link is not active # リンクがアクティブではない。 echo "$DEVICE link is not active" exit 1 </code> <sect>ネットワークの設定 <!-- 7. Network Configuration: --> <p> <!-- If your Linux-box has another network interface, like an Ethernet-card or if you use PLIP to connect to another machine, you can configure this box to function as a router. This is how I configured my network, I always enter all IP-addresses in /etc/hosts so I only have one file to maintain: --> もしLinuxボックスが他にネットワークインターフェース(イーサネットカードや PLIP接続)を装備していない場合は,ルータとしての機能するように設定できます。 これは著者のネットワークの設定です。IPアドレスは/etc/hostsに全て 書いているので一つのファイルを管理するだけで済みます。 <p> /etc/hosts: <verb> 127.0.0.1 localhost 10.0.0.1 your.domain.com host 10.0.0.2 some.other.machine </verb> /etc/networks: <verb> loopback 127.0.0.0 localnet 10.0.0.0 </verb> /etc/rc.d/inet1: <verb> # Loopback interface: ループバックインターフェース: ifconfig lo localhost route add -net loopback # Local interface: ローカルインターフェース: ifconfig eth0 host route add -net localnet eth0 </verb> <!-- The last rule adds a route to the local network. We don't need to enter the default gateway here, since we don't have one until a PPP-link is setup. --> 最後のルールはルートをローカルネットワークに追加したということです。 ここでデフォルトゲートウェイを入力する必要はありません。というのも PPP接続が確立するまでゲートウェイはないからです。 <sect>マスカレードの設定 <!-- 8. Masquerading Configuration:--> <p> <!-- If you need to connect multiple machines, but only have one IP-address, you can use the Linux masquerading feature. This allows you to configure an internal network-number (preferably a private IP-address) which gets translated to the IP-address assigned to the PPP-interface. --> 複数のマシンに接続する必要があるけれど一つのIPアドレスしかない場合は、 Linuxマスカレードを使うことができます。IPマスカレードを使って、IPアドレス をPPPインターフェースに変換する内部ネットワーク番号(できればプライベート IPアドレス)の設定ができます。 <!-- You are free to use the following network numbers:--> 以下のネットワーク番号を使うことができます。 <itemize> <item>Class A: 10.0.0.0 <item>Class B: 172.16.0.0 - 172.31.0.0 <item>Class C: 192.168.0.0 - 192.168.254.0 </itemize> <!-- Add the following rules to /etc/rc.d/rc.inet1: --> /etc/rc.d/rc.inet1に追加します。 <code> FW=/sbin/ipfwadm ${FW} -F -f ${FW} -F -a m -P tcp -S localnet/8 -D default/0 ${FW} -F -a m -P udp -S localnet/8 -D default/0 # Masquerading timeout-values (tcp tcpfin udp), defaults: ${FW} -M -s 3600 0 0 # Load module for special protocols: /sbin/modprobe ip_masq_ftp /sbin/modprobe ip_masq_raudio /sbin/modprobe ip_masq_irc </code> <!-- The two masquerading rules will translate UDP and TCP-traffic to the IP-address used as the default gateway (the PPP-interface). Ping, which uses the ICMP-protocol, will fail from other hosts, it will only work from the router.I used network 10.0.0.0 with subnet mask 255.0.0.0 or in CIDR-notation:'/8'. --> 上の2つのマスカレードルール(<em/訳注:/&dquot;${FW} -F..&dquot;の行) はUDPとTCPトラフィックをIPアドレスに変換するというものです (<em/訳注:/UDPとTCPはトランスポート層にあるプロトコルです。詳しくは アブストラクトで紹介した「Networking Linux」を参照して下さい)。 IPアドレスはデフォルトゲートウェイ(PPPインターフェース)として使われています。 ICMPプロトコルを使うpingは他のホストからはエラーになります。ルータから のpingだけが動作します。 著者はサブネットマスク 255.0.0.0 あるいは CIDR記法の'/8'で ネットワーク 10.0.0.0 を使っています。 <!-- The next rule prevents FTP-DATA connections from timing out, by increasing the TCP-timeout value. --> つぎのルール(<em/訳注:/&dquot;${FW} -M..&dquot;の行) は&dquot;TCPタイムアウト値&dquot;(TCP-timeout value)を増やすことで FTP-DATA接続(FTP-DATA connections)を表示しています。 <!-- The modules are only required if you want to use these protocols across the firewall. E.g. if you want to use normal ftp through the firewall, you need to load the ip_masq_ftp-module. --> ファイアウォールからこれらのプロトコルを使いたいなら、モジュールだけが必要 です。例えば、ファイアウォールを通したftpをしたいなら<tt/ip_masq_ftp/ モジュールを読み込む必要があります。 <sect>ワークステーションの設定 <!-- 9. Workstation Configuration: --> <p> <!-- Configure your other machine for your local network number and set them up to use the Linux-box as their default gateway. --> ローカルネットワーク番号について他のマシンを設定して、デフォルトゲートウェイ としてLinuxマシンを使うようにセットアップします。 <sect>免責事項 <!-- 10. Disclaimer --> <p> <!-- This document describes a configuration that works for me, use it at your own risk. If anything substantial is missing or if something is terribly wrong, please let me know! --> このドキュメントは著者が行った設定について解説しました。各自の責任において 使って下さい。もし大切なことが抜けていたり,具合の悪いところがある場合はぜひ 著者まで連絡して下さい。 <!-- One thing I could add is a description of how to setup a local nameserver.--> あと追加できることはローカルネームサーバの設定方法です。 <p> [(日本語訳) 伊佐治 哲, <tt/isaji@mxu.meshnet.or.jp/ <p> (校正) 藤原 輝嘉さん, <tt/fujiwara@cim.pe.u-tokyo.ac.jp/ ] </article>