玄箱PROでL2TP設定

以前に玄箱PROをDebian(lenny)化してあり,今回はL2TPを入れてAndroidケータイを接続してみる.

OpenSwanとL2TPDのインストール

kernelは対応しているようなので,今回はapt-getでインストールしてみた.

apt-get install openswan l2tpd

インストール中にいろいろ聞いてくるけど,今回はデフォルトのまま進めました.

OpenSwan事前共有鍵

/etc/ipsec.secretsにあります.
テストなんでこんな感じ.

: PSK "1234567890"

xl2tpdの設定

apt-getでインストールすると/etc/xl2tpd/xl2tpd.confに設定済みのファイルがあるのでこれを編集する.
自分はこんな感じで変更.

[global] ; Global parameters:
; port = 1701 ; * Bind to port 1701
; auth file = /etc/l2tpd/l2tp-secrets ; * Where our challenge secrets are
auth file = /etc/ppp/chap-secrets ; * Where our challenge secrets are
; access control = yes ; * Refuse connections without IP match
; rand source = dev ; Source for entropy for random
; ; numbers, options are:
; ; dev - reads of /dev/urandom
; ; sys - uses rand()
; ; egd - reads from egd socket
; ; egd is not yet implemented
;
[lns default] ; Our fallthrough LNS definition
; exclusive = no ; * Only permit one tunnel per host
ip range = 192.168.0.1-192.168.0.20 ; * Allocate from this IP range
; no ip range = 192.168.0.3-192.168.0.9 ; * Except these hosts
; ip range = 192.168.0.5 ; * But this one is okay
; ip range = lac1-lac2 ; * And anything from lac1 to lac2's IP
; lac = 192.168.1.4 - 192.168.1.8 ; * These can connect as LAC's
; no lac = untrusted.marko.net ; * This guy can't connect
; hidden bit = no ; * Use hidden AVP's?
local ip = 192.168.1.2 ; * Our local IP to use
; length bit = yes ; * Use length bit in payload?
require chap = yes ; * Require CHAP auth. by peer
refuse pap = yes ; * Refuse PAP authentication
; refuse chap = no ; * Refuse CHAP authentication
; refuse authentication = no ; * Refuse authentication altogether
require authentication = yes ; * Require peer to authenticate
; unix authentication = no ; * Use /etc/passwd for auth.
; name = myhostname ; * Report this as our hostname
; ppp debug = no ; * Turn on PPP debugging
ppp debug = yes ; * Turn on PPP debugging
pppoptfile = /etc/ppp/options.l2tpd.lns ; * ppp options file
; call rws = 10 ; * RWS for call (-1 is valid)
; tunnel rws = 4 ; * RWS for tunnel (must be > 0)
; flow bit = yes ; * Include sequence numbers
; challenge = yes ; * Challenge authenticate peer ;

l2tp認証設定

/etc/ppp/options.l2tpd.lnsはPPTPで使った/etc/ppp/optionsファイルを参考に

require-mschap-v2
nodefaultroute
debug
lock
nobsdcomp

パスワードファイル

PPTPで使っている/etc/ppp/chap-secretsをそのまま利用します.

クライアントの設定

AndroidXperia(SO-01B)でつないでみました.
サポートページVPN(仮想プライベートネットワーク)展開ガイドにあるL2TP VPNの設定で接続することができました.