OpenWrtで IPSec + L2TP VPN > (3)環境設定

「OpenWrtで IPSec + L2TP VPN/(3)環境設定」の編集履歴(バックアップ)一覧に戻る

OpenWrtで IPSec + L2TP VPN/(3)環境設定 - (2014/11/05 (水) 23:51:14) のソース

OpenWrtで IPSec + L2TP VPN/(3)環境設定

/etc/ipsec.conf に以下追記(なければ作成)

 conn L2TP-PSK-noNAT
	forceencaps=yes
	authby=secret
	auto=add
 	keyingtries=3
 	ike=aes-sha1-modp2048
 	esp=aes-sha1-modp2048
 	rekey=no
 	ikelifetime=8h
 	keylife=1h
 	keyexchange=ikev1
 	type=transport
	left=%any
 	leftprotoport=17/1701
 	right=%any
 	rightprotoport=17/%any
 	dpddelay=40
 	dpdtimeout=130
 	dpdaction=clear

 conn L2TP-PSK-NAT
	rightsubnet=0.0.0.0/0
	also=L2TP-PSK-noNAT

/etc/ipsec.secrets
 [現在のグローバルIP] : PSK "password" #passwordは自身で適切な内容を入れること。ここが事前共有キーになります。

/etc/strongswan.conf
 include /etc/strongswan.conf.d/*.conf
 
 charon {
 	#load_modular = yes
 	dns1 = 192.168.11.1
 	plugins {
 		include strongswan.d/charon/*.conf
  	}
 }
 
 include strongswan.d/*.conf

/etc/sysctl.conf に以下追記
 net.ipv4.ip_forward = 1
 net.ipv4.conf.all.send_redirects = 0
 net.ipv4.conf.all.accept_redirects = 0
 net.ipv4.conf.default.send_redirects = 0
 net.ipv4.conf.default.accept_redirects = 0
 net.ipv4.conf.eth0.send_redirects = 0
 net.ipv4.conf.eth0.accept_redirects = 0
 net.ipv4.conf.lo.send_redirects = 0
 net.ipv4.conf.lo.accept_redirects = 0

/etc/ppp/chap-secrets
 [任意のID] * [任意のパスワード] * #適切なIDとパスワードを設定してください。ここがユーザ名とパスワードになります。

/etc/ppp/l2tpd-options
 name l2tp
 refuse-pap
 refuse-chap
 refuse-mschap
 require-mschap-v2
 ms-dns 192.168.11.1 #ルータのIPを入れました
 proxyarp
 nodefaultroute
 lock
 nobsdcomp
 mtu 1280 #ここが大きいと通信効率の向上が見込めますがmodem hangupすることがあります。頑張ってチューニングしてください。
 mru 1280 #同上

/etc/xl2tpd/xl2tpd.conf
 [global]
 access control = no
 auth file = /etc/ppp/chap-secrets
 debug avp = yes
 debug network = yes
 debug packet = yes
 debug state = yes
 debug tunnel = yes
 
 [lns default]
 ip range = 192.168.11.91-192.168.11.99 #pppインターフェースと同じセグメントで利用したい範囲を入力
 local ip = 192.168.11.90 #pppインターフェースのIP
 length bit = yes
 refuse chap = yes
 require authentication = yes
 name = l2tp
 pppoptfile = /etc/ppp/l2tpd-options