[HOME] [github] [twitter] [blog] [fml4] [fml8] [北海道] Powered by NetBSD and [nuinui.net] .

rp-pppoe (PPP over Ethernet) による ADSL への接続について

Warning

常時接続になるのだから フィルタリング 等には十分気をつけて下さい。

以下では次のような接続形態を考えます。

ADSL modem ----- NetBSD (natbox) --- (private network)
最近は、この NetBSD の部分を floppy 一枚の NetBSD で動かしています。

なお ADSL とくれば Dynamic DNS とセットで使うのが常套手段/流行りです :-) [1]

rp-pppoe の設定

まずパッケージから rp-pppoe (/usr/pkgsrc/net/rp-pppoe) をインストールしてください。 インストール後、

/usr/pkg/share/examples/rp-pppoe/pppoe.conf
/etc/ppp/pppoe.conf
にコピーする必要があることに注意して下さい。 この時、/etc/ppp ディレクトリがない場合は、 /etc/ppp ディレクトリも作成してください。

/etc/ppp を作ったら、 /usr/pkg/sbin/adsl-setup を実行することで、対話的に pppoe の設定をすることができます。 設定時の必須項目は、 ADSL モデルと接続するイーサネットインターフェイスの名前と PPP アカウントと PPP パスワードです。 PPP アカウントと PPP パスワードは 利用する ISP から教えられているはずです。 あとは適当に ENTER してデフォルト値にしてしまえば よろしくやってくれるようです。

** Summary of what you entered **

Ethernet Interface: fxp1
User name:          xxxxxxxx@yyy.service.provider
Activate-on-demand: No
DNS:                Do not adjust
Firewalling:        NONE

>>> Accept these settings and adjust configuration files (y/n)? y
Adjusting /etc/ppp/pppoe.conf
Adjusting /etc/ppp/pap-secrets and /etc/ppp/chap-secrets



Congratulations, it should be all set up!

Type 'adsl-start' to bring up your ADSL link and 'adsl-stop' to bring
it down.  Type 'adsl-status' to see the link status.
adsl-setup が終了すると /etc/ppp/ 以下に pppd が必要とするファイル群がよろしく作成されます。
# ls /etc/ppp
chap-secrets     pap-secrets      pppoe.conf
chap-secrets-bak pap-secrets-bak  pppoe.conf-bak
これで終了です。

/usr/pkg/sbin/ 以下に adsl- ではじまる一連のコマンドがあります。

# /usr/pkg/sbin/adsl-start
を実行すれば ADSL が開通するはずです。

rp-pppoe を起動時に自動的に実行する

パッケージシステムが作ってくれるので、 それを /etc/rc.d にインストールするだけで終りです。

# cp /usr/pkg/etc/rc.d/pppoe /etc/rc.d
次回 NetbSD 起動時には、 このファイルが rp-pppoe を自動的にスタートさせてくれます。

注意: 最近は、ちゃんと /etc/rc.conf と連動しているので、pppoe=yes とか 書く必要があるでしょう。

rp-pppoe と TCP MSS (Maximum Segment Size)

(pppoe のソースを読むと)、 CLAMPMSS というオプションを指定(指定するのが推奨)した 場合には、 SYN フラッグのついた TCP パケットが 通過する際に MSS の値の上限を 1412 bytes に強制書換えをします。 これは方向にかかわらず行なわれます。 例:

SYN
client --> mss=1460 -->  NetBSD (natbox) --> mss=1412 --> サーバ  

SYN+ACK
client <-- mss=1412 <--  NetBSD (natbox) <-- mss=1460 <-- サーバ  

TCP コネクションの確立

tcpdump を ppp0 で行なった例。 ここでは IP ヘッダが 20 bytes TCP ヘッダが 20 bytes + オプションの 12 bytes あることに注意。

13:32:42.241306 natbox.3290 > server.5001: S 737678331:737678331(0) win 16384 <mss 1460,nop,wscale 0,nop,nop,timestamp 15364 0>
13:32:42.284907 server.5001 > natbox.3290: S 1128752822:1128752822(0) ack 737678332 win 16384 <mss 1412,nop,wscale 0,nop,nop,timestamp 55305132 15364>
13:32:42.286210 natbox.3290 > server.5001: . ack 1 win 17520 <nop,nop,timestamp 15364 55305132>
13:32:42.290811 natbox.3290 > server.5001: . 1:1401(1400) ack 1 win 17520 <nop,nop,timestamp 15364 55305132> (frag 43660:1432@0+)
13:32:42.326459 server.5001 > natbox.3290: . ack 1 win 17520 <nop,nop,timestamp 55305132 0>
13:32:42.383205 server.5001 > natbox.3290: . ack 1413 win 17520 <nop,nop,timestamp 55305132 15364>
13:32:42.388818 natbox.3290 > server.5001: . 1413:2813(1400) ack 1 win 17520 <nop,nop,timestamp 15364 55305132> (frag 43661:1432@0+)
13:32:42.389141 natbox.3290 > server.5001: . 2825:4225(1400) ack 1 win 17520 <nop,nop,timestamp 15364 55305132> (frag 43662:1432@0+)
13:32:42.473929 server.5001 > natbox.3290: . ack 2825 win 17520 <nop,nop,timestamp 55305132 15364>
13:32:42.479604 natbox.3290 > server.5001: . 4237:5637(1400) ack 1 win 17520 <nop,nop,timestamp 15364 55305132> (frag 43664:1432@0+)
13:32:42.479912 natbox.3290 > server.5001: . 5649:7049(1400) ack 1 win 17520 <nop,nop,timestamp 15364 55305132> (frag 43665:1432@0+)
13:32:42.503789 server.5001 > natbox.3290: . ack 4237 win 17520 <nop,nop,timestamp 55305132 15364>


   ... snip ...

13:34:34.584758 server.5001 > natbox.3290: . ack 4685653 win 17520 <nop,nop,timestamp 55305357 15588>
13:34:34.589299 natbox.3290 > server.5001: . 4698361:4699761(1400) ack 1 win 17520 <nop,nop,timestamp 15588 55305132> (frag 48153:1432@0+)
13:34:34.613545 server.5001 > natbox.3290: . ack 4687065 win 17520 <nop,nop,timestamp 55305357 15588>
13:34:34.618146 natbox.3290 > server.5001: . 4699773:4701173(1400) ack 1 win 17520 <nop,nop,timestamp 15588 55305132> (frag 48155:1432@0+)
13:34:34.640384 server.5001 > natbox.3290: . ack 4688477 win 17520 <nop,nop,timestamp 55305357 15588>
13:34:34.645067 natbox.3290 > server.5001: . 4701185:4702585(1400) ack 1 win 17520 <nop,nop,timestamp 15588 55305132> (frag 48157:1432@0+)
13:34:34.668696 server.5001 > natbox.3290: . ack 4689889 win 17520 <nop,nop,timestamp 55305357 15588>
13:34:34.673337 natbox.3290 > server.5001: . 4702597:4703997(1400) ack 1 win 17520 <nop,nop,timestamp 15588 55305132> (frag 48159:1432@0+)
13:34:34.696888 server.5001 > natbox.3290: . ack 4691301 win 17520 <nop,nop,timestamp 55305357 15588>
13:34:34.701360 natbox.3290 > server.5001: . 4704009:4705409(1400) ack 1 win 17520 <nop,nop,timestamp 15588 55305132> (frag 48162:1432@0+)
13:34:34.725212 server.5001 > natbox.3290: . ack 4692713 win 17520 <nop,nop,timestamp 55305357 15588>
13:34:34.729658 natbox.3290 > server.5001: . 4705421:4706821(1400) ack 1 win 17520 <nop,nop,timestamp 15588 55305132> (frag 48163:1432@0+)
13:34:34.752811 server.5001 > natbox.3290: . ack 4694125 win 17520 <nop,nop,timestamp 55305357 15588>
13:34:34.757227 natbox.3290 > server.5001: . 4706833:4708233(1400) ack 1 win 17520 <nop,nop,timestamp 15589 55305132> (frag 48164:1432@0+)
13:34:34.781703 server.5001 > natbox.3290: . ack 4695537 win 17520 <nop,nop,timestamp 55305357 15588>
13:34:34.786137 natbox.3290 > server.5001: . 4708245:4709645(1400) ack 1 win 17520 <nop,nop,timestamp 15589 55305132> (frag 48165:1432@0+)
13:34:34.809483 server.5001 > natbox.3290: . ack 4696949 win 17520 <nop,nop,timestamp 55305357 15588>
13:34:34.813935 natbox.3290 > server.5001: . 4709657:4711057(1400) ack 1 win 17520 <nop,nop,timestamp 15589 55305132> (frag 48166:1432@0+)
13:34:34.837647 server.5001 > natbox.3290: . ack 4698361 win 17520 <nop,nop,timestamp 55305357 15588>
13:34:34.843292 natbox.3290 > server.5001: . 4711069:4712469(1400) ack 1 win 17520 <nop,nop,timestamp 15589 55305132> (frag 48167:1432@0+)
13:34:34.843605 natbox.3290 > server.5001: . 4712481:4713881(1400) ack 1 win 17520 <nop,nop,timestamp 15589 55305132> (frag 48168:1432@0+)
13:34:34.865678 server.5001 > natbox.3290: . ack 4699773 win 17520 <nop,nop,timestamp 55305357 15588>
13:34:34.870133 natbox.3290 > server.5001: . 4713893:4715293(1400) ack 1 win 17520 <nop,nop,timestamp 15589 55305132> (frag 48169:1432@0+)
13:34:34.894240 server.5001 > natbox.3290: . ack 4701185 win 17520 <nop,nop,timestamp 55305357 15588>
13:34:34.922107 server.5001 > natbox.3290: . ack 4702597 win 17520 <nop,nop,timestamp 55305357 15588>
13:34:34.927719 natbox.3290 > server.5001: . 4715305:4716705(1400) ack 1 win 17520 <nop,nop,timestamp 15589 55305132> (frag 48170:1432@0+)
13:34:34.928036 natbox.3290 > server.5001: . 4716717:4718117(1400) ack 1 win 17520 <nop,nop,timestamp 15589 55305132> (frag 48171:1432@0+)
13:34:34.949929 server.5001 > natbox.3290: . ack 4704009 win 17520 <nop,nop,timestamp 55305357 15588>
13:34:34.954468 natbox.3290 > server.5001: . 4718129:4719529(1400) ack 1 win 17520 <nop,nop,timestamp 15589 55305132> (frag 48172:1432@0+)
13:34:34.978257 server.5001 > natbox.3290: . ack 4705421 win 17520 <nop,nop,timestamp 55305357 15588>
13:34:35.007097 server.5001 > natbox.3290: . ack 4706833 win 17520 <nop,nop,timestamp 55305357 15588>
13:34:35.012913 natbox.3290 > server.5001: . 4719541:4720941(1400) ack 1 win 17520 <nop,nop,timestamp 15589 55305132> (frag 48173:1432@0+)
13:34:35.013235 natbox.3290 > server.5001: . 4720953:4722353(1400) ack 1 win 17520 <nop,nop,timestamp 15589 55305132> (frag 48174:1432@0+)
13:34:35.013529 natbox.3290 > server.5001: FP 4722365:4722368(3) ack 1 win 17520 <nop,nop,timestamp 15589 55305132>
13:34:35.035666 server.5001 > natbox.3290: . ack 4708245 win 17520 <nop,nop,timestamp 55305357 15589>
13:34:35.063033 server.5001 > natbox.3290: . ack 4709657 win 17520 <nop,nop,timestamp 55305357 15589>
13:34:35.090942 server.5001 > natbox.3290: . ack 4711069 win 17520 <nop,nop,timestamp 55305358 15589>
13:34:35.118746 server.5001 > natbox.3290: . ack 4712481 win 17520 <nop,nop,timestamp 55305358 15589>
13:34:35.147105 server.5001 > natbox.3290: . ack 4713893 win 17520 <nop,nop,timestamp 55305358 15589>
13:34:35.175122 server.5001 > natbox.3290: . ack 4713893 win 17520 <nop,nop,timestamp 55305358 15589>
13:34:35.204210 server.5001 > natbox.3290: . ack 4713893 win 17520 <nop,nop,timestamp 55305358 15589>
13:34:35.231049 server.5001 > natbox.3290: . ack 4713893 win 17520 <nop,nop,timestamp 55305358 15589>
13:34:35.235481 natbox.3290 > server.5001: . 4713893:4715293(1400) ack 1 win 17520 <nop,nop,timestamp 15590 55305132> (frag 48176:1432@0+)
13:34:35.259850 server.5001 > natbox.3290: . ack 4713893 win 17520 <nop,nop,timestamp 55305358 15589>
13:34:35.287977 server.5001 > natbox.3290: . ack 4713893 win 17520 <nop,nop,timestamp 55305358 15589>
13:34:35.289061 server.5001 > natbox.3290: . ack 4713893 win 17520 <nop,nop,timestamp 55305358 15589>
13:34:35.317757 server.5001 > natbox.3290: . ack 4722369 win 9045 <nop,nop,timestamp 55305358 15590>
13:34:35.318925 server.5001 > natbox.3290: . ack 4722369 win 17237 <nop,nop,timestamp 55305358 15590>
13:34:35.319744 server.5001 > natbox.3290: F 1:1(0) ack 4722369 win 17520 <nop,nop,timestamp 55305358 15590>
13:34:35.320960 natbox.3290 > server.5001: . ack 2 win 17520 <nop,nop,timestamp 15590 55305358>

ケーススタディ: ADSL 〜 NetBSD(natbox) 〜 Windows 2000

もちろん MSS の書換えが動作しています。

SYN
client --> mss=1460 -->  NetBSD (natbox) --> mss=1412 --> サーバ  

SYN+ACK
client <-- mss=1412 <--  NetBSD (natbox) <-- mss=1460 <-- サーバ  

TCP コネクションの確立
通常データサイズ 1460 のところを、pppoe ごしに通信すると 1412 で通信します。

ケーススタディ: ADSL 〜 BA512 〜 NetBSD(natbox) 〜 Windows 2000

市販のルータ BA512 の例も見ていただこう。

              network A       network B 

              mss 1460          1460         mss 1414
windows 2000 ----------> NetBSD ---> BA512 ----------> server
windows 2000 <---------- NetBSD <--- BA512 <---------- server
              mss 1414          1414           ?


[network A]

17:09:41.385753 client2000.1639 > server.www: S 926465340:926465 340(0) win 16384 ≤mss 1460,nop,nop,sackOK> (DF)
17:09:41.437243 server.www > client2000.1631: R 2474967497:24749 67497(0) win 0 (DF)
17:09:41.467868 server.www > client2000.1639: S 2807243888:28072 43888(0) ack 926465341 win 65044 ≤mss 1414> (DF)
17:09:41.468663 client2000.1639 > server.www: . ack 1 win 16968 (DF)
17:09:41.469772 client2000.1639 > server.www: P 1:325(324) ack 1 win 16968 (DF)
17:09:41.559888 server.www > client2000.1639: . ack 325 win 65044 (DF)
17:09:41.565160 server.www > client2000.1639: P 1:138(137) ack 325 win 65044 (DF)
17:09:41.570627 server.www > client2000.1639: P 138:808(670) ack 325 win 65044 (DF)
17:09:41.572871 client2000.1639 > server.www: . ack 808 win 16161 (DF)


[network B]

17:09:41.386213 natbox-out.1371 > server.www: S 926465340:926465340(0) win 16384 ≤mss 1460,nop,nop,sackOK> (DF)
17:09:41.436913 server.www > natbox-out.1363: R 2474967497:2474967497(0) win 0 (DF)
17:09:41.467536 server.www > natbox-out.1371: S 2807243888:2807243888(0) ack 926465341 win 65044 ≤mss 1414> (DF)
17:09:41.469013 natbox-out.1371 > server.www: . ack 1 win 16968 (DF)
17:09:41.470129 natbox-out.1371 > server.www: P 1:325(324) ack 1 win 16968 (DF)
17:09:41.559568 server.www > natbox-out.1371: . ack 325 win 65044 (DF)
17:09:41.564854 server.www > natbox-out.1371: P 1:138(137) ack 325 win 65044 (DF)
17:09:41.570327 server.www > natbox-out.1371: P 138:808(670) ack 325 win 65044 (DF)
17:09:41.573230 natbox-out.1371 > server.www: . ack 808 win 16161 (DF)

Notes

[1]

さぁこれで君もお家で MLサーバ だね(笑)

[HOME] [github] [twitter] [blog] [fml4] [fml8] [北海道] Powered by NetBSD and [nuinui.net] .
Copyright (C) 1993-2022 Ken'ichi Fukamachi mail:< fukachan at fml.org >