Leased line Mini HOWTO <author>Rob van der Putten, <tt>rob@sput.signature.nl</tt> <date>v1.7, 29 October 1999 <trans>高橋 聡 <tt>hisai@din.or.jp</tt> <tdate> 17 Jan 2000 <toc> <p> 最新版(ベータ版)のドキュメントは、<url url="http://www.sput.signature.nl"> にあります。 <!-- What is a leased line --> <sect>専用線とは <p> <!-- Any fixed, that is permanent, point to point data communications link, which is leased from a telco or similar organisation. The leased line involves cables, such as twisted pair, coax or fiber optic, and may involve all sorts of other hardware such as (pupin) coils, transformers, amplifiers and regenerators. --> 専用線とは、決まった相手と常時データ通信を行う回線です。回線は通信会社や 同等のサービスを提供する会社から借り受けます。 専用線は、ツイスト・ペア、同軸、光などのケーブルを指し、(誘導負荷)コイル、 トランス、アンプ、再生器などのハードウエアを含む場合もあります。 <!-- This document deals with: Configuring your modem and pppd to use a 2 wire twisted pair leased line. This document does NOT deal with: SLIP, getting or installing pppd, synchronous data communication, baseband modems. --> このドキュメントでは、 2 線式のツイスト・ペア ケーブルを使った専用線で、モデムと pppd を使用する場合の設定方法を扱います。<newline> しかし、 SLIP や pppd の取得方法、インストールのしかた、同期通信、ベース バンド方式のモデムについては<em>扱いません</em>。 <!-- Assumptions --> <sect>前提条件 <p> <!-- You should already have a working pppd on your system. You also need Minicom or a similar program to configure your modems. --> すでに pppd がマシンで動いていることが前提になります。 Minicom のようなモデムを設定できるプログラムも必要になります。 <!-- Modem --> <sect>モデム <p> <!-- A leased line is not connected to a telephone exchange and does not provide DC power, dial tone, busy tone or ring signal. This means that your modems are on their own and have to be able to deal with this situation. --> 専用線は電話交換機に接続されていませんし、電力(直流)も供給されておらず、 ダイヤル・トーン、ビジー・トーン、着信信号もありません。つまりモデム自体が これらの状態に対応していなければなりません。 <!-- You should have 2 identical (including firmware version) external modems supporting both leased line and dumb mode. Make sure your modems can actually do this! Also make sure your modem is properly documented. You also need: --> 同じ種類(ファームウエアのバージョンも)の外付けモデムを 2 つ用意してくだ さい。専用線を利用することでき、ダム・モードを持ったモデムである必要が あります。用意したモデムが本当にそうなのか、確かめてください! あなたの 持っているモデムがこのドキュメントに載っているかもしれません。 <newline> また下記も必要になります。 <!-- * 2 fully wired shielded RS232 cables. The shield should be connected to the connector shell (not pin 1) at both ends (not at one end). * A RS232 test plug may be handy for test purposes. * 2 RJ11 cords, one for each end of the leased line. * A basic understanding of 'AT' commands. --> <itemize> <item>全てのピンに線が接続されているシールドされた RS232 ケーブルを 2 本。 シールドは、両端(片方だけではなく)のコネクタ・シェル(1 ピンにではなく) に接続してあること <item>RS232 のテスト用プラグは、テストの時に役に立つ <item>RJ11 コードを 2 本。専用線の両端に使用する <item>AT コマンドをある程度理解していること </itemize> <!-- Modem Configuration --> <sect1>モデムの設定 <p> <!-- A note on modem configuration and init strings in general: Configure your modem software such as minicom or (m)getty to use the highest possible speed; 57600 bps for 14k4 and 115200 bps for 28k8 or faster modems. Lots of people use very long and complicated init strings, often starting with AT&F and containing lots of modem brand and -type specific commands. This however is needlessly complicated. Most programs feel happy with the same modem settings, so why not write these settings in the non volatile memory of all your modems, and only use 'ATZ' as an init string in all your programs. This way you can swap or upgrade your modems without ever having to reconfigure any of your software. --> このセクションでは、モデムの設定と一般的なモデムの初期化コマンドについて 解説します。モデムは minicom のようなソフトウエアを使って設定します。また (m)getty を使って、最高速で通信ができるように設定します。モデム間の通信 速度が 14400 bps ならば モデムと端末間 は 57600 bps、28800 bps ならば 115200 bps というようにです。 初期化コマンドは往々にして長たらしく、複雑なものになりがちです。AT&F からはじまって、それにメーカー固有のコマンドが続き、さらに機種固有のコマンド が続きます。これが初期化を必要以上に複雑にしている原因です。 モデムの設定が同じならば、たいていのプログラムは動作します。ですから それらのコマンドをモデムの不揮発メモリに書き込んでしまいましょう。そうすれ ば、プログラムからはただ「ATZ」とするだけで初期化できるようになります。こう しておけば、モデムを交換したりアップグレードしたとしても、ソフトウエアの 設定をいじらなくて済みます。 <!-- Most programs require you to use the following settings; * Fixed baud rate (no auto baud) * Hardware bidirectional RTS-CTS flow control (no x-on/x-off) * 8 Bits, no parity, 1 stopbit * The modem should produce the TRUE DCD status (&C1) * The modem should NOT ignore the DTR status (&D2 or &D3) --> 下記の設定をすることで、たいていのプログラムは動作します。 <itemize> <item>ボー・レートを固定する(自動設定は不可) <item>ハードウエアによる双方向の RTS-CTS フロー・コントロール (X-ON/X-OFF は不可)を行う <item>8 ビット、ノン・パリティ、ストップ・ビットが 1 にする <item>相手側モデムのキャリアが検出されると CD 信号を有効にする(&C1) <item>DTR(&D2 or &D3)の状態を監視するようにする </itemize> <!-- Check this with AT&V or AT&Ix (consult your modem documentation) --> AT&V か AT&Ix として確かめてみてください(モデム付属のドキュメント を調べてください)。 <!-- These settings are not necessarily the same as the default factory profile (&F), so starting an init string with AT&F is probably not a good idea in the first place. The smart thing to do is probably to use AT&F only when you have reason to believe that the modem setup stored in the non volatile memory is really screwed up. If you think you have found the right setup for your modems, write it to non volatile memory with AT&W and test it thoroughly with Z-modem file transfers of both ASCII text and binary files. Only if all of this works perfectly should you configure your modems for leased line. --> 上記の設定は必ずしも工場出荷時のプロファイルの設定(&F)と同じものである とは限りません。したがって最初に初期化を行う時に &F を使うことはあまり おすすめできません。賢い &F の使い方は、不揮発メモリにあるモデムの設定 を台なしにしてしまった場合だけです。 モデムの正しい設定がわかったら、AT&W を使って不揮発メモリに書き込んで から、十分にテストしてください。Z-modem を使ってテキスト・ファイルやバイナリ・ ファイルを転送してみてください。 テストの結果が完璧ならば、専用線でモデムを使うための設定はおしまいです。 <!-- Find out how to put your modem into dumb mode and, more importantly, how to get it out of dumb mode; The modem can only be reconfigured when it is not in dumb mode. Make sure you actually configure your modems at the highest possible speed. Once in dumb mode it will ignore all 'AT' commands and consequently will not adjust its speed to that of the COM port, but will use the speed at which it was configured instead (this speed is stored in a S-register by the AT&W command). --> 次にモデムをダム・モードにする方法を調べましょう。大切なことはダム・ モードを解除する方法です。モデムの再設定はダム・モードでは行えないからです。 <newline> モデムが、本当に最高速度で通信できる設定になっていますか? 一度ダム・モードになってしまうと、「AT」コマンドはまったく効かなくなります。 つまり COM ポートの速度との調整ができなくなり、モデムに設定済みの速度を 使って接続することになります(AT&W で S レジスタに書き込まれた速度です)。 <!-- Now configure your modem as follows; --> それでは次の手順で、モデムの設定をしていきましょう。 <!-- * Reset on DTR toggle (&D3, this is sometimes a S register). This setting is required by some ISP's! * Leased line mode (&L1 or &L2, consult your modem documentation) * The remote modem auto answer (S0=1), the local originate (S0=0) * Disable result codes (Q1, sometimes the dumb mode does this for you) * Dumb mode (\D1 or %D1, this is sometimes a jumper) In dumb mode the modem will ignore all AT commands (sometimes you need to disable the ESC char as well). --> <itemize> <item>DTR の状態が変化するとリセットを行う(&D3 。S レジスタに設定 される場合がある)。ISP(インターネット・サービス・プロバイダ)によって は必要になる <item>専用線モードにする(&L1 か &L2。モデム付属のドキュメントを 参照のこと) <item>相手側のモデムは自動着信(S0=1)し、こちら側のモデムは自動着信しない (S0=0) <item>リザルト・コードを表示しない(Q1。ダム・モードにするとこの設定になる 場合あり) <item>ダム・モードにする(\D1 か %1。ジャンパーで設定する場合 あり)。<newline> ダム・モードでは AT コマンドがまったく利用できない(ESC キャラクタも 無効にする必要があるかもしれない) </itemize> <!-- Write the configuration to non-volatile memory (&W). --> 上記の設定を不揮発メモリに書き込んでください(&W)。 <!-- Test --> <sect1>テスト <p> <!-- Now connect the modems to 2 computers using the RS232 cables and connect the modems to each other using a RJ11 lead. Use a modem program such as Minicom (Linux), procom or telix (DOS) on both computers to test the modems. You should be able to type text from one computer to the other and vice versa. If the screen produces garbage check your COM port speed and other settings. Now disconnect and reconnect the RJ11 cord. Wait for the connection to reestablish itself. Disconnect and reconnect the RS232 cables, switch the modems on and off, stop and restart Minicom. The modems should always reconnect at the highest possible speed (some modems have speed indicator leds). Check whether the modems actually ignores the ESC (+++) character. If necessary disable the ESC character. --> それでは RS232 ケーブルを使って 2 つのコンピュータにモデムを接続して、 モデム間を RJ11 で接続してみましょう。Minicom(Linux)や procom、telix(DOS) などのモデムを制御できるプログラムを両方のコンピュータで使用して、モデムを テストします。 片方のコンピュータから相手側にテキストを入力したり、相手側からも同じように やってみてください。文字化けが起こるようであれば、COM ポートの速度やその他の 設定を確認してください。 以上が終ったら、一度 RJ11 を抜いて、再び挿してみてください。自動的に再接続 するまで待ちましょう。RS232 ケーブルも同じようにしてください。モデムの 電源の ON OFF や Minicom を終了させてからまた動かすといったことも試してくだ さい。 モデムは上記のいずれの場合にも、自動的に最高速度で再接続するはずです(速度 表示用 LED が付いているモデムもあります)。 モデムが本当に ESC キャラクタ(+++)を無視するかを確かめてください。もしそう でなかったら、ESC キャラクタを無効にしてください。 <!-- If all of this works you may want to reconfigure your modems; Switch off the sound at the remote modem (M0) and put the local modem at low volume (L1). --> 完璧に動作したら、モデムを再設定してもかまいません。相手側のモデムの音を 切って(M0)、こちら側は最小の音(L1)にしましょう。 <!-- Examples --> <sect1>設定例集 <p> <!-- Hi-Tech This is a rather vague 'no name clone modem'. Its config string is however typical and should work on most modems. Originate (local): ATL1&C1&D3&L2%D1&W&W1 Answer (remote): ATM0L1&C1&D3&L2%D1S0=1&W&W1 --> <descrip> <tag/Hi-Tech/これは「ノーブランドの互換モデム」と言ってもいいものです。 下記は典型的な設定で、たいていのモデムはこれで動作するはずです <descrip> <tag/手動着信(こちら側)/ATL1&C1&D3&L2%D1&W&W1 <tag/自動着信(相手側)/ATM0L1&C1&D3&L2%D1S0=1&W&W1 </descrip> <!-- Tornado FM 228 E This is what should work; Originate (local): ATB15L1Q1&C1&D3&L2&W&W1 Answer (remote): ATM0B15M0Q1&C1&D3&L2S0=1&W&W1 --> <tag/Tornado FM 228 E/これでうごくはずです <descrip> <tag/手動着信(こちら側)/ATB15L1Q1&C1&D3&L2&W&W1 <tag/自動着信(相手側)/ATM0B15M0Q1&C1&D3&L2S0=1&W&W1 </descrip> <!-- Move the dumb jumper from position 2-3 to 1-2. Due to a firmware bug, the modems will only connect after being hard reset (power off and on) while DTR is high. I designed a [3]cirquit which hard resets the modem on the low to high transition of DTR. The FreeBSD pppd however, isn't very happy about this. By combining the setting &D0 with a [4]cirquit which resets on the high to low transition instead, this problem can be avoided. --> ダム・モードを設定するジャンパを 2-3 から 1-2 に変更 <p> ファームウエアのバグで DTR が ON になっても、ハードウエア・リセット(電源の ON/OFF)をしないと接続できません。私はある <url url="http://www.sput.signature.nl/hardware/modem-reset.html#l2h" name="回路">を設計して、DTR が OFF から ON に移った時に、モデムをハード ウエア・リセットするようにしました。しかしこの回路では FreeBSD の pppd はうまく 動作しません。この問題を回避するには、この <url url="http://www.sput.signature.nl/hardware/modem-reset.html#l2h" name="回路">を使って ON から OFF に状態を移行させて &D0 してください。 <!-- Tron DF The ESC char should be disabled by setting S2 > 127; Originate: ATL1&L1Q1&C1&D3S2=171\D1&W Answer: ATM0&L2Q1&C1&D3S0=1S2=171\D1&W --> <tag/Tron DF/ESC キャラクタを無効にするには、S2 レジスタを 128 以上に設定 すること <descrip> <tag/手動着信/ATL1&L1Q1&C1&D3S2=171\D1&W <tag/自動着信/ATM0&L2Q1&C1&D3S0=1S2=171\D1&W </descrip> <!-- US Robotics Courier V-Everything --> <tag/US Robotics Courier V-Everything/ <!-- The following is based on information supplied by [5]Rolf Raar. The USR Sportster and USR Courier-I do not support leased line. You need the Courier V-everything version for this job. There is a webpage on the USR site 'explaining' how to set-up your Courier for leased line. However, if you follow these instructions you will end up with a completely brain dead modem, which can not be controlled or monitored by your pppd. --> この情報は <htmlurl url="mailto:rolf@tardis.webster.nl" name=" Rolf Raar 氏"> から寄せられた情報に基づいています。 US Robotics の Sportster と Courier-I は専用線をサポートしていません。専用線 を使うなら、Courier V-everything を使用すること。<newline> US Robotics の Web サイトのあるページで Courier V-everything を専用線で利用 する方法を「解説」しています。しかしこの解説通りにやっても、モデムが機能不全 になるだけで pppd からモデムを制御することも、監視することもできません。 <!-- The USR Courier can be configured with dip switches, however you need to feed it the config string first. First make sure it uses the right factory profile. Unlike most other modems it has three; &F0, &F1 and &F2. The default, which is also the one you should use, is &F1. If you send it an AT&F, however it will load the factory profile &F0! For the reset on DTR toggle you set bit 0 of S register 13. This means you have to set S13 to 1. Furthermore you need set it to leased line mode with &L1; ATS13=1&L1&W The dip switches are all default except for the following: --> US Robotics の Courier はディップ・スイッチで設定ができます。しかしまず初期 化コマンドで設定する必要があります。 まず最初に工場で設定済みのプロファイルの中から、適切なプロファイルを選択 したかを確認すること。他のおおかたのモデムとは異なり、Courier は 3 つの プロファイル &F0、&F1、&F2 を持っています。&F1 が選択すべき プロファイルになるが、AT&F した時にロードされてしまうのは &F0 に入っているプロファイルです! こうしてしまうと、DTR の切替えをリセットする S レジスタ 13 を 0 に設定して しまいます。本当は 1 に設定しなければいけません。しかも専用線モードにするため、 &L1 も設定しなければいけません。<newline> ATS13=1&L1&W<newline> ディップ・スイッチでデフォルト値から変更する必要のあるものは下記の通りです。 <!-- 3 OFF Disable result codes 4 ON Disable offline commands 5 ON For originate, OFF For answer 8 OFF Dumb mode --> <descrip> <tag/3/「リザルト・コードを表示しない」は OFF になっている <tag/4/「オフライン・コマンドを使用不可」は ON になっている <tag/5/「手動着信 が ON で 自動着信」は OFF になっている <tag/8/「ダム・モード」は OFF になっている </descrip> </descrip> <!-- PPPD --> <sect> PPPD <p> <!-- You need a pppd (Point to Point Protocol Daemon) and a reasonable knowledge of how it works. Consult the relevant RFC's or the [6]Linux PPP HOWTO if necessary. Since you are not going to use a login procedure, you don't use (m)getty and you do not need a (fake) user associated with the pppd controlling your link. You are not going to dial so you don't need any chat scripts either. In fact, the modem circuit and configuration you have just build, are rather like a fully wired null modem cable. This means you have to configure your pppd the same way as you would with a null modem cable. --> pppd(Point to Point Protocol Daemon) を用意して、pppd を動かすのに必要な知識 を身につけて動作させてください。関連する RFC のドキュメントや <url url="http://metalab.unc.edu/linux/HOWTO/PPP-HOWTO.html" name="Linux PPP HOWTO">を調べてください。 相手側のマシンにログインする予定がなければ、(m)getty は必要ありません。 また ppp 接続の制御に必要な(ダミーの)ユーザ・アカウントもいりません。相手 にダイヤルする必要がないので、chat スクリプトも不必要です。<newline> 実際のところモデムの回路やここまで行なってきた設定はヌル・モデムケーブル を使った接続の仕方とほとんど変わりありません。つまり pppd の設定はヌル・ モデムケーブルを使用した場合と同じやり方で行なう必要があるということです。 <!-- For a reliable link, your setup should meet the following criteria; --> 接続を安定させるために、下記の基準にしたがって設定を行ってください。 <!-- * Shortly after booting your system, pppd should raise the DTR signal in your RS232 port, wait for DCD to go up, and negotiate the link. * If the remote system is down, pppd should wait until it is up again. * If the link is up and then goes down, pppd should reset the modem (it does this by dropping and then raising DTR), and then try to reconnect. * If the quality of the link deteriorates too much, pppd should reset the modem and then reestablish the link. * If the process controlling the link, that is the pppd, dies, a watchdog should restart the pppd. --> <itemize> <item>pppd が、システムのブート直後に RS232 ポートで DTR を ON にし、 相手の DCD を検出するまで待機状態になります。DCD が検出された後、接続 のためのネゴーシエイションを行うこと <item>相手側のシステムが落ちた場合に、pppd は相手側が復旧するまで待つこと <item>一度確立された接続が切断されてしまった場合、pppd はモデムをリセット します(リセットすると、DTR が OFF になってから ON になります)。その後 再接続を行うこと <item>回線状態があまりにも悪化した場合、pppd はモデムをリセットした後、 再接続を行うこと <item>接続を制御している pppd 自体が落ちてしまった場合、なんらかの監視シス テムを使って pppd の再起動をかけること </itemize> <!-- Configuration --> <sect1>設定 <p> <!-- Suppose the modem is connected to COM2, the local IP address is 'Loc_Ip' and the remote IP address is 'Rem_Ip'. We want to use 576 as our MTU. The /etc/ppp/options.ttyS1 would now be: --> COM2 にモデムが接続されていて、こちらのアドレスが「Loc_Ip」、相手のアド レスが「Rem_Ip」、MTU は 576 とすると、/etc/ppp/options.ttyS1 は下記のよう になります。 <tscreen><code> crtscts mru 576 mtu 576 passive Loc_Ip:Rem_Ip -chap modem #noauth -pap persist </code></tscreen> <!-- So, if the local system is 192.168.1.1 and the remote system is 10.1.1.1, then /etc/options.ttyS1 on the local system would be: --> こちら側が 192.168.1.1 で 相手側が 10.1.1.1 なら /etc/options.ttyS1 は下記のようになります。 <tscreen><code> crtscts mru 576 mtu 576 passive 192.168.1.1:10.1.1.1 -chap modem #noauth -pap persist </code></tscreen> <!-- The options.ttyS1 on the remote system would be: --> 相手側のシステムの options.ttyS1 は下記のようになります。 <tscreen><code> crtscts mru 576 mtu 576 passive 10.1.1.1:192.168.1.1 -chap modem #noauth -pap persist </code></tscreen> <!-- The passive option limits the number of (re)connection attempts. The persist option will keep pppd alive in case of a disconnect or when it can't connect in the first place. If you telnet a lot while doing filetransfers (FTP or webbrowsing) at the same time, you might want to use a smaller MTU and MRU such as 296. This will make the remote system more responsive. If you don't care much about telnetting during FTP, you could set the MTU and MRU to 1500. The noauth option may be necessary with some newer distributions. --> passive オプションは(再)接続数に制限をかけます(???)。persist オプション は、接続が切れた場合や最初の接続が失敗した場合に、pppd を接続待ちの状態に します。 ファイル転送(FTP や Web ブラウジング)をしながら、telnet をよくつかう場合は、 MTU や MRU を 296 ぐらいの小さい値にしたほがいいかもしれません。こうすると 相手側からの telnet のレスポンスが良くなるはずです。<newline> telnet のレスポンスを気にしないなら、MTU と MRU は 1500 にした方がいいで しょう。 noauth オプションは新しいディストリビューションを使った時に必要になる場合 があります。 <!-- Scripts --> <sect1>スクリプト <p> <!-- Starting the pppd and keeping it alive --> <sect1>pppd を起動して、pppd を落ちないようにする <p> <!-- The script /usr/local/sbin/PRem_Host.sh shown below starts the pppd. You have to start it after the COM ports are configured (substitute Rem_Host with the remote host's name). --> 下記の /usr/local/sbin/PRem_Host.sh は pppd を起動します。このスクリプト を起動する前に COM ポートを設定しておかなければいけません(Rem_Host は 相手側のホスト名を表します) <tscreen><code> #!/bin/bash # Optional sleep #/usr/bin/sleep 30 ( /usr/sbin/pppd /dev/ttyS1 115200 ) & </code></tscreen> <!-- It could be called from the script which configures your networkcard (/etc/init.d/network on Debian systems), in which case you have to uncomment the sleep, to make sure the COM ports are configured first. If you use setserial, you could call it from there. An other way is to call it from rc.local. On Debian systems, there is a directory /etc/rc.boot/. According to [7]Rolf Raar, the scripts in this Directory are executed in alphabetical order. The setserial script is called 0setserial. If you call your script from a script called 2leased-lines, it will be executed after 0setserial. --> このスクリプトはネットワーク・カードを設定するスクリプト(Debian なら /etc/init.d/network)から起動するようにしてください。念のため sleep の行は コメントアウトしてください。そうしたら、まず COM ポートを設定していること を確認してください。setserial を使っていればそこから呼び出すようにして ください。rc.local から呼び出してもかまいません。 Debian では /etc/rc.boot/ というディレクトリがあります。 <htmlurl url="mailto:rolf@tardis.webster.nl" name="Rolf Raar ">氏によると 、 このディレクトリにあるスクリプトは、ファイル名のアルファベット順に実行 されます。setserial のスクリプトは、0setserial として起動されます。 2leased-lines という名前のスクリプトから呼び出した場合、そのスクリプトは 0setserial の後に実行されます。 <!-- Some older systems will not accept the speed 115200. In this case you will have to set the speed to 38400 en set the 'spd_vhi' flag with setserial. Some systems expect you to use a 'cua' instead of 'ttyS' sevice. --> 古いシステムでは、速度を 115200 に設定できないことがあります。その場合は、 setserial で「spd_vhi」と設定してあるところを 38400 で接続するように設定 しなければいけません。 <!-- Though the persist option should make this superfluous, the pppd can also be restarted using ip-down; --> persist オプションがオーバーなら、ip-down を使って pppd を再起動する こともできます。 <tscreen><code> #!/bin/bash case $2 in /dev/ttyS1) /usr/bin/sleep 30 /usr/local/sbin/PRem_Host.sh & ;; esac </code></tscreen> <!-- If the pppd dies it should be restarted by the persist option or the ip-up script (optional). If this doesn't happen the script /usr/local/sbin/test-Rem_Host-ppp restarts it for you. This script checks whether the remote interface exists and will try to start the pppd if it doesn't; --> pppd が落ちると、persist オプションか ip-up スクリプト(どちらにするか選択) が pppd の再起動をかけます。もしこれでも再起動しないなら /usr/local/sbin/test-Rem_Host-ppp スクリプトを使って、再起動をかけられます。 このスクリプトは相手側に接続されているインタフェースが存在するかどうかを チェックし、もしなければ pppd を起動させます。 <tscreen><code> #!/bin/bash if ! ( /sbin/ifconfig | grep Rem_Ip > /dev/null ) then if [ ! -f /var/lock/LCK..ttyS1 ] then # PPP gone logger "Rem_Host PPP gone ; restarted" /usr/local/sbin/PRem_Host.sh & fi fi </code></tscreen> <!-- The following line in crontab runs the above script every 5 minutes. You could run the script more often if you like but I would not run it more often then once every two minutes. --> 下記の行を crontab に設定して 5 分おきにこのスクリプトを走らせます。 もっと短い間隔で動かしてもかまいませんが、私は 2 分以下には設定しない方が いいと思います。 <tscreen><code> */5 * * * * /usr/local/sbin/test-Rem_Host-ppp </code></tscreen> <!-- You can edit the crontab with 'crontab -e'. This will restart cron after editing. It uses the editor specified by the 'EDITOR' environment variable, which may be set by /etc/profile or ~/.profile (export EDITOR=Your_Favourite_Editor). --> crontab を編集するには、「crontab -e」としてください。こうすれば編集が 終わると、cron が再起動します。crontab は「EDITOR」環境変数に設定されている エディタを起動します。この環境変数は、/etc/profile か ~/.profile に記述 されています(export EDITOR=お好みのエディタ)。 <!-- Some people run pppd from /etc/inittab, but I never tested this. --> /etc/inittab から pppd を起動する場合もありますが、テストしていません。 <!-- Setting the routes --> <sect1>ルーティング情報の設定 <p> <!-- The default route can be set with the defaultroute option or with the /etc/ppp/ip-up script; --> デフォルト・ルートは、defaultroute オプションで設定するか、/etc/ppp/ip-up スクリプトで下記のようにします。 <tscreen><code> #!/bin/bash case $2 in /dev/ttyS1) /sbin/route add -net 0.0.0.0 gw Rem_Ip netmask 0.0.0.0 ;; esac </code></tscreen> <!-- Ip-up can also be used to sync your clock using netdate. --> Ip-up は netdate を使ってシステム時計を同期させる場合にも使われます。 <!-- Of course the route set in ip-up is not necessarily the default route. Your ip-up sets the route to the remote network while the ip-up script on the remote system sets the route to your network. If your network is 192.168.1.0 and your ppp interface 192.168.1.1, the ip-up script on the remote machine looks like this; --> ip-up で必ずデフォルト・ルートの設定をする必要はありません。 ip-set で相手側へのルーティングを設定し、相手側でもこちら側へのルーティング を設定すれば OK です。ネットワーク・アドレスが 192.168.1.0 で、ppp の インターフェース・アドレスが 192.168.1.1 とすると、相手側の ip-up スクリプト は下記の様になります。 <tscreen><code> #!/bin/bash case $2 in /dev/ttyS1) /sbin/route add -net 192.168.1.0 gw 192.168.1.1 netmask 255.255.255.0 ;; esac </code></tscreen> <!-- The 'case $2' and '/dev/ttyS1)' bits are there in case you use more than one ppp link. Ip-up will run each time a link comes up, but only the part between '/dev/ttySx)' and ';;' will be executed, setting the right route for the right ttyS. You can find more about routing in the [8]NET-3-HOWTO section on routing. --> 「case $2」と「/dev/ttyS1)」の部分は、複数の ppp 接続を利用している場合に 利用されます。Ip-up は接続する度に起動し、「/dev/ttySx)」 と 「;;」に 囲まれたコマンドを実行するだけではなく、ttyS に合ったルーティング情報を 設定します。 ルーティングについての詳しい内容は、 <url url="http://metalab.unc.edu/linux/HOWTO/NET-3-HOWTO.html" name="NET-3-HOWTO">のルーティングを解説しているセクションに載っています。 <!-- Test --> <sect1>テスト <p> <!-- Test the whole thing just like the modem test. If it works, get on your bike and bring the remote modem to the remote side of your link. If it doesn't work, one of the things you should check is the COM port speed; Apparently, a common mistake is to configure the modems with Minicom using one speed and then configure the pppd to use an other. This will NOT work! You have to use the same speed all of the time! --> モデムをテストした時と同様に、思いつくすべてのテストをしてください。 うまくいったら、自転車で相手側に設置するモデムを持っていきましょう。<newline> うまくいかなかったら、まず COM ポートの速度設定のチェックからはじめてみて ください。<newline> よくやるミスは、Minicom でモデムに通信速度を設定して、それから pppd の 設定をした時に、モデムとは別の速度で設定をしてしまうというものです。たぶん このミスではないでしょうか。これでは動作<em>しません</em>。速度の設定は 同じにしてください! <!-- References --> <sect>参考文献 <p> <!-- 1. mailto:rob@sput.signature.nl 2. http://www.sput.signature.nl/software/leased-line.html 3. http://www.sput.signature.nl/hardware/modem-reset.html#l2h 4. http://www.sput.signature.nl/hardware/modem-reset.html#h2l 5. mailto:rolf@tardis.webster.nl 6. http://metalab.unc.edu/linux/HOWTO/PPP-HOWTO.html 7. mailto:rolf@tardis.webster.nl 8. http://metalab.unc.edu/linux/HOWTO/NET-3-HOWTO.html --> <enum> <item><htmlurl url="mailto:rob@sput.signature.nl"> <item><url url="http://www.sput.signature.nl/software/leased-line.html"> <item><url url="http://www.sput.signature.nl/hardware/modem-reset.html#l2h"> <item><url url="http://www.sput.signature.nl/hardware/modem-reset.html#h2l"> <item><htmlurl url="mailto:rolf@tardis.webster.nl"> <item><url url="http://metalab.unc.edu/linux/HOWTO/PPP-HOWTO.html"> <item><htmlurl url="mailto:rolf@tardis.webster.nl"> <item><url url="http://metalab.unc.edu/linux/HOWTO/NET-3-HOWTO.html"> </enum> 訳注:<url url="http://www.linux.or.jp/JF/JFdocs/PPP-HOWTO.html" name="PPP-HOWTO の日本語訳">と <url url="http://www.linux.or.jp/JF/JFdocs/NET-3-HOWTO.html" name="NET-3-HOWTO の日本語訳">も参考になさってください。 </article>