|
|
PPPoE 2
|
|
|
|
# ee /usr/local/etc/mpd/mpd.conf
default: # 自動呼出しの設定 load bbexcite load flets
pppoe: # PPPoE共通の設定 set iface disable on-demand set iface idle 0 set iface mtu 1454 set bundle disable multilink set link no acfcomp protocomp set link disable pap chap set link mtu 1454 set link mru 1454 set ipcp yes vjcomp set ipcp ranges 0.0.0.0/0 0.0.0.0/0
bbexcite: # ISP接続の設定 new -i ng0 bbexcite bbexcite # 最後(bbexcite)はリンク名 load pppoe set bundle authname username@excite.co.jp set bundle password password set iface route default set iface up-script /usr/local/etc/mpd/script-bbexcite.sh # 接続時処理 set iface down-script /usr/local/etc/mpd/script-bbexcite.sh # 切断時処理 open iface
flets: # Flets接続の設定 new -i ng1 flets flets # 最後(flets)はリンク名 load pppoe set bundle authname guest@flets set bundle password guest set iface route 220.210.194.0/25 set iface route 220.210.195.0/26 set iface route 220.210.195.64/26 set iface route 220.210.198.128/26 set iface route 220.210.199.0/27 set iface route 220.210.199.128/28 set iface route 220.210.199.160/28 set iface route 220.210.199.192/29 set iface route 220.210.199.176/28 set iface up-script /usr/local/etc/mpd/script-flets.sh # 接続時処理 set iface down-script /usr/local/etc/mpd/script-flets.sh # 切断時処理 open iface
# ee /usr/local/etc/mpd/mpd.links
bbexcite: # リンク名 set link type pppoe # 接続タイプ set pppoe iface rl0 # 接続インタフェース set pppoe service "whatever" set pppoe disable incoming set pppoe enable originate
flets: # リンク名 set link type pppoe # 接続タイプ set pppoe iface rl0 # 接続インタフェース set pppoe service "whatever" set pppoe disable incoming set pppoe enable originate
# ee /usr/local/etc/mpd/script-bbexcite.sh
#!/bin/sh
nat_port=8668 nat_cmd="/sbin/natd -config /etc/nat.conf -p $nat_port -n $1" ipfw_num="65531"
case $# in # 接続時処理 5) $nat_cmd ipfw add $ipfw_num divert $nat_port ip from any to any via $1 /etc/rc.d/named restart ;; # 切断時処理 3) kill -9 `ps -ax | grep "$nat_cmd" | awk '{print $1}'` ipfw delete $ipfw_num /etc/rc.d/named restart ;; *) ;; esac
* /usr/local/etc/mpd/script-flets.sh
!/bin/sh
nat_port=8669 nat_cmd="/sbin/natd -config /etc/nat.conf -p $nat_port -n $1" ipfw_num="65532"
case $# in # 接続時処理 5) $nat_cmd ipfw add $ipfw_num divert $nat_port ip from any to any via $1 ;; # 切断時処理 3) kill -9 `ps -ax | grep "$nat_cmd" | awk '{print $1}'` ipfw delete $ipfw_num ;; *) ;; esac
# /usr/local/sbin/mpd ... [bbexcite] IFACE: Up event
[flets:flets]
mpdが接続状態なら、natプロセスなどが確認できる。
# ps -ax | grep natd 11518 ?? Is 0:00.00 /sbin/natd -config /etc/nat.conf -p 8669 -n ng1 11529 ?? Ss 0:00.00 /sbin/natd -config /etc/nat.conf -p 8668 -n ng0 # ipfw list ... 65531 divert 8668 ip from any to any via ng0 65532 divert 8669 ip from any to any via ng1 ...
切断すると、natプロセスなども停止する。
[flets:flets] quit ... [flets] IPCP: LayerFinish mpd: process 11375 terminated # ps -ax | grep natd #
↑ OS起動時の設定 †
FreeBSDの場合、OS起動時のmpd起動スクリプトは /usr/local/etc/rc.d/mpd にある。これを起動するには、/etc/rc.conf を編集し、mpd_enable変数をYESにする必要がある。また、natはmpdプロセスから起動・終了されるため、OS起動時に起動する必要はない。
* /etc/rc.conf
... mpd_enable="YES" natd_enable="NO" ...
起動スクリプトを手動で実行する場合は以下の通り。
# /usr/local/etc/rc.d/mpd start Starting mpd. # /usr/local/etc/rc.d/mpd stop Stopping mpd. Waiting for PIDS: 12356.
|
|
|