![]()
![]()
FreeBSDで直接PPPoEでISP認証して利用するようなケースを実施した際のメモです。
portsのmpd4を利用した例となります。
GENERICカーネルのままで利用したいと思い、どのような設定をすればいいかを探していました。
/boot/defaults/loader.conf を参照するところから始めました。
############################################################## ### Netgraph modules ####################################### ############################################################## ng_UI_load="NO" # UI netgraph node type ng_async_load="NO" # asynchronous framing netgraph node type ng_bpf_load="NO" # Berkeley packet filter netgraph node type ng_bridge_load="NO" # Ethernet bridging netgraph node type ng_cisco_load="NO" # Cisco HDLC protocol netgraph node type ng_echo_load="NO" # Netgraph echo node type ng_eiface_load="NO" # generic Ethernet interface netgraph node type ng_etf_load="NO" # Ethertype filtering netgraph node type ng_ether_load="NO" # Ethernet netgraph node type ng_fec_load="NO" # netgraph Fast EtherChannel node ng_frame_relay_load="NO" # frame relay netgraph node type ng_gif_load="NO" # generic tunnel interface netgraph node type ng_gif_demux_load="NO" # demultiplexer for packets from ng_gif(4) nodes ng_hole_load="NO" # Netgraph discard node type ng_hub_load="NO" # packet distribution netgraph node type ng_iface_load="NO" # interface Netgraph node type ng_ip_input_load="NO" # netgraph IP input node type ng_ksocket_load="NO" # kernel socket netgraph node type ng_l2tp_load="NO" # L2TP protocol netgraph node type ng_lmi_load="NO" # frame relay LMI protocol netgraph node type ng_mppc_load="NO" # Microsoft MPPC/MPPE compression and encryption netgraph node type ng_netflow_load="NO" # Cisco's NetFlow netgraph note type ng_one2many_load="NO" # packet multiplexing netgraph node type ng_ppp_load="NO" # PPP protocol netgraph node type ng_pppoe_load="NO" # RFC 2516 PPPOE protocol netgraph node type ng_pptpgre_load="NO" # PPTP GRE protocol netgraph node type ng_rfc1490_load="NO" # RFC 1490 netgraph node type ng_socket_load="NO" # Netgraph socket node type ng_split_load="NO" # netgraph node to separate incoming and outgoing flows ng_sppp_load="NO" # sppp netgraph node type ng_tee_load="NO" # Netgraph ``tee'' node type ng_tty_load="NO" # Netgraph node type that is also a line discipline ng_vjc_load="NO" # Van Jacobsen compression netgraph node type ng_vlan_load="NO" # IEEE 802.1Q VLAN tagging netgraph node type
これであるかを見つけにくかったのですが、
ng_pppoe_load="YES" # RFC 2516 PPPOE protocol netgraph node type
を加えることとしました。
# kldload /boot/kernel/ng_pppoe.ko
とし、確認。
# kldstat Id Refs Address Size Name 1 24 0xc0400000 6f6668 kernel . 3 1 0xc0b0b000 5798 ng_pppoe.ko 4 9 0xc0b11000 c83c netgraph.ko . 14 1 0xc4ee8000 4000 ng_socket.ko 15 1 0xc4eee000 3000 ng_iface.ko 16 1 0xc4ef6000 6000 ng_ppp.ko 17 1 0xc4f04000 4000 ng_vjc.ko 18 1 0xc4f52000 4000 ng_bpf.ko 19 1 0xc4f56000 2000 ng_tcpmss.ko 20 1 0xc4f5c000 3000 ng_ether.ko .
という感じになっていました。
ports(net/mpd)は、存在するものの既にメンテナがいない状態だった。
バージョンは mpd-3.18_5と古い状態のままになっていました。
SF.NETのMPD: FreeBSD PPP daemonでは、Mpd-4.1 released 2007-02-11 となっている。
古いままで問題がないと思っているユーザだらけなのか、portsなんか使わないさ、という人が多いのか。
net/mpd4 というportsが新しいバージョン用になっていることに気づきました。
mpd4の方は、機能としてウェブインターフェイスが利用できることなど面白そうです。
5005番のポート番号を利用するようなので、TCP Wrapper により範囲を制限することとしました。
# make clean install clean ===> Cleaning for libpdel-0.5.3_2 ===> Cleaning for expat-2.0.0_1 ===> Cleaning for mpd-4.1 . .
ウェブ上のドキュメントは既に 4.2rc1 用のものになっていました。
導入が完了したら、設定ファイルを確認する。/usr/local/etc/mpd4/ にできている。
-r--r--r-- 1 root wheel 11260 May 31 20:54 mpd.conf.sample -r--r--r-- 1 root wheel 3730 May 31 20:54 mpd.links.sample -r--r--r-- 1 root wheel 39085 May 31 20:54 mpd.script.sample -r--r--r-- 1 root wheel 834 May 31 20:54 mpd.secret.sample
4つのファイルはサンプル状態。
まず、mpd.conf.sample より PPPoEの部分を残し、デフォルトを変更したものを作成しました。
FreeBSD+mpdによるブロードバンドルータの高速化のページを参考に修正。
startup:
# enable TCP-Wrapper (hosts_access(5)) to block unfriendly clients
set global enable tcp-wrapper
# configure the console
set console port 5005
set console ip 0.0.0.0
set console user foo bar
set console user foo1 bar1
set console open
# Default configuration is "PPPoE"
default:
load PPPoE
PPPoE:
new -i ng0 PPPoE PPPoE
set iface addrs 1.1.1.1 2.2.2.2
set iface route default
set iface disable on-demand
set iface mtu 1454
set iface idle 0
set auth authname AAA123456@excite.co.jp
set bundle disable multilink
set auth authname MyLogin
set link no acfcomp protocomp
set link disable pap chap
set link accept chap
set link mtu 1454
set link mru 1454
set link keep-alive 10 60
set ipcp yes vjcomp
set ipcp ranges 0.0.0.0/0 0.0.0.0/0
open
のようにしてみました。
mpd.links には、
#
# For our PPPoE connection, using Ethernte interface "fxp1"
# Often the service is ignored. If yours is required, replace
# the "whatever" string with your PPPoE service string.
#
PPPoE:
set link type pppoe
set pppoe iface fxp1
set pppoe service "whatever"
set pppoe disable incoming
set pppoe enable originate
のような感じで作成。 ifconfigで見えているイーサのインターフェイス名にしておきました。
mpd.secret は
# MyLogin MyPassword AAA123456@excite.co.jp PASSWORD123
のように設定。
/etc/rc.conf には
mpd_enable="YES" mpd_flags="-s mpd -b"
としました。
/etc/syslog.conf には、
!mpd *.* /var/log/mpd.log !ppp *.* /var/log/ppp.log
を加え、ファイルを touchしておきます。
どうでも良いな、と思ったので、
# cp -p /var/log/ppp.log /var/log/mpd.log # kill -HUP syslogd # chmod 400 /usr/local/etc/mpd4/mpd.secret
で作成。/etc/newsyslog.conf にも同様、前著のページを参考に、
/var/log/mpd.log 640 3 100 * JC /var/run/mpd.pid
としました。
この状態で試しにつないでみると、
May 31 22:30:03 HOST mpd: process 1654 started, version 4.1 (root@〜 20:53 31-May-2007) May 31 22:30:03 HOST mpd: CONSOLE: listening on 0.0.0.0 5005 May 31 22:30:03 HOST mpd: [PPPoE] using interface ng0 May 31 22:30:03 HOST mpd: [PPPoE] link: OPEN event May 31 22:30:03 HOST mpd: [PPPoE] LCP: Open event May 31 22:30:03 HOST mpd: [PPPoE] LCP: state change Initial --> Starting May 31 22:30:03 HOST mpd: [PPPoE] LCP: LayerStart May 31 22:30:03 HOST mpd: [PPPoE] PPPoE: Connecting to 'whatever' May 31 22:30:03 HOST mpd: PPPoE: rec'd ACNAME "brasgp23〜" May 31 22:30:03 HOST mpd: [PPPoE] rec'd proto LCP while dead May 31 22:30:03 HOST mpd: [PPPoE] PPPoE: connection successful May 31 22:30:03 HOST mpd: [PPPoE] link: UP event May 31 22:30:03 HOST mpd: [PPPoE] link: origination is local May 31 22:30:03 HOST mpd: [PPPoE] LCP: Up event May 31 22:30:03 HOST mpd: [PPPoE] LCP: state change Starting --> Req-Sent May 31 22:30:03 HOST mpd: [PPPoE] LCP: SendConfigReq #1 May 31 22:30:03 HOST mpd: MRU 1454 May 31 22:30:03 HOST mpd: MAGICNUM 2ea7f9fe May 31 22:30:03 HOST mpd: [PPPoE] LCP: rec'd Configure Ack #1 link 0 (Req-Sent) May 31 22:30:03 HOST mpd: MRU 1454 May 31 22:30:03 HOST mpd: MAGICNUM 2ea7f9fe May 31 22:30:03 HOST mpd: [PPPoE] LCP: state change Req-Sent --> Ack-Rcvd May 31 22:30:05 HOST mpd: [PPPoE] LCP: rec'd Configure Request #2 link 0 (Ack-Rcvd) May 31 22:30:05 HOST mpd: MRU 1454 May 31 22:30:05 HOST mpd: AUTHPROTO CHAP MD5 May 31 22:30:05 HOST mpd: MAGICNUM d4073e61 May 31 22:30:05 HOST mpd: [PPPoE] LCP: SendConfigAck #2 May 31 22:30:05 HOST mpd: MRU 1454 May 31 22:30:05 HOST mpd: AUTHPROTO CHAP MD5 May 31 22:30:05 HOST mpd: MAGICNUM d4073e61 May 31 22:30:05 HOST mpd: [PPPoE] LCP: state change Ack-Rcvd --> Opened May 31 22:30:05 HOST mpd: [PPPoE] LCP: auth: peer wants CHAP, I want nothing May 31 22:30:05 HOST mpd: [PPPoE] LCP: LayerUp May 31 22:30:05 HOST mpd: [PPPoE] CHAP: rec'd CHALLENGE #1 May 31 22:30:05 HOST mpd: Name: "brasgp23otiai012" May 31 22:30:05 HOST mpd: Using authname "〜@excite.co.jp" May 31 22:30:05 HOST mpd: [PPPoE] CHAP: sending RESPONSE len:39 May 31 22:30:06 HOST mpd: [PPPoE] CHAP: rec'd SUCCESS #1 May 31 22:30:06 HOST mpd: [PPPoE] LCP: authorization successful May 31 22:30:06 HOST mpd: [PPPoE] Bundle up: 1 link, total bandwidth 64000 bps May 31 22:30:06 HOST mpd: [PPPoE] IPCP: Open event May 31 22:30:06 HOST mpd: [PPPoE] IPCP: state change Initial --> Starting May 31 22:30:06 HOST mpd: [PPPoE] IPCP: LayerStart May 31 22:30:06 HOST mpd: [PPPoE] IPCP: Up event May 31 22:30:06 HOST mpd: [PPPoE] IPCP: state change Starting --> Req-Sent May 31 22:30:06 HOST mpd: [PPPoE] IPCP: SendConfigReq #1 May 31 22:30:06 HOST mpd: IPADDR 0.0.0.0 May 31 22:30:06 HOST mpd: COMPPROTO VJCOMP, 16 comp. channels, no comp-cid May 31 22:30:06 HOST mpd: [PPPoE] IPCP: rec'd Configure Reject #1 link 0 (Req-Sent) May 31 22:30:06 HOST mpd: COMPPROTO VJCOMP, 16 comp. channels, no comp-cid May 31 22:30:06 HOST mpd: [PPPoE] IPCP: SendConfigReq #2 May 31 22:30:06 HOST mpd: IPADDR 0.0.0.0 May 31 22:30:06 HOST mpd: [PPPoE] IPCP: rec'd Configure Nak #2 link 0 (Req-Sent) May 31 22:30:06 HOST mpd: IPADDR 124.147.79.66 May 31 22:30:06 HOST mpd: 124.147.79.66 is OK May 31 22:30:06 HOST mpd: [PPPoE] IPCP: SendConfigReq #3 May 31 22:30:06 HOST mpd: IPADDR 124.147.79.66 May 31 22:30:06 HOST mpd: [PPPoE] IPCP: rec'd Configure Ack #3 link 0 (Req-Sent) May 31 22:30:06 HOST mpd: IPADDR 124.147.79.66 May 31 22:30:06 HOST mpd: [PPPoE] IPCP: state change Req-Sent --> Ack-Rcvd May 31 22:30:06 HOST mpd: [PPPoE] IPCP: rec'd Configure Request #79 link 0 (Ack-Rcvd) May 31 22:30:06 HOST mpd: IPADDR 210.149.34.69 May 31 22:30:06 HOST mpd: 210.149.34.69 is OK May 31 22:30:06 HOST mpd: [PPPoE] IPCP: SendConfigAck #79 May 31 22:30:06 HOST mpd: IPADDR 210.149.34.69 May 31 22:30:06 HOST mpd: [PPPoE] IPCP: state change Ack-Rcvd --> Opened May 31 22:30:06 HOST mpd: [PPPoE] IPCP: LayerUp May 31 22:30:06 HOST mpd: 124.147.79.66 -> 210.149.34.69 May 31 22:30:06 HOST mpd: [PPPoE] IFACE: Up event
のようにちゃんと接続ができました。
ping yahoo.com で返事も返ってきます。
慌てて失敗したのは、/etc/rc.conf に defaultrouter=〜 の記述が残ってしまっていたこと。
そっちを見に行っちゃうそれはダメですよね。
【改訂履歴】作成:2007/05/31
2009/06/17 … Namazu検索の窓を追加
【参考リンク】
design テンプレート