【RouterBoard】IPsec L2TP設定方法

iOS10から、PPTPVPNが設定できなくなりました。

ルーターに付属のPPTPで簡易的にVPNを作成されていた方も多いと思います。

安くて高機能、ハイパワーなMikrotik製RouterBoardを使用し、IPsec L2TPを利用してリモート接続ができるようになります。

→入門機価格でハイパワー!hEX【RB750Gr3】

設定方法を掲載します。

※自己責任にてお願いいたします。

【参考】Mikrotik L2TP with IPsec for mobile clients

まずはL2TPで接続した来た場合に払い出されるIPアドレスのプールを追加します。

GUI

IP>Pool

Name: L2TP-Pool
Adresses: 172.31.86.1-172.31.86.14(自分のアドレス設定)
Next Pool: None

Terminal

/ip pool add name="L2TP-Pool" ranges=172.31.86.1-172.31.86.14(自分のアドレス設定)

L2TP設定

1.L2TP Profile

L2TPサーバーを追加する前に、L2TPプロファイルを設定します。

GUI

PPP>Profiles

Name: l2tp-profile
Local Address: L2TP-Pool
Remote Address: L2TP-Pool
DNS Server: 8.8.8.8
Change TCP MSS: yes
Use Encryption: required

残りはデフォルトの値でオッケーです。

CLI

/ppp profile add name=l2tp-profile local-address=L2TP-Pool remote-address=L2TP-Pool use-encryption=required change-tcp-mss=yes dns-server=8.8.8.8

2.L2TPサーバーの追加

GUI

PPP>Interface>L2TP Server

Enabled: Checked
Max MTU: 1460
Max MRU: 1460
Keepalive Timeout: 30
Default Profile: mschap2
Use IPsec: Checked
IPsec Secret: MYKEY

CLI

/interface l2tp-server server set authentication=mschap2 default-profile=l2tp-profile enabled=yes ipsec-secret=MYKEY max-mru=1460 max-mtu=1460 use-ipsec=yes

3.PPPパスワードの追加

GUI

PPP>Secrets

Enabled: Checked
Name: MYUSER(お好きなID)
Password: MYPASSWORD(お好きなパスワード)
Service: l2tp
Profile: l2tp-profile

あとはデフォルトの値

CLI

/ppp secret add name=MYUSER password=MYPASSWORD service=l2tp profile=l2tp-profile

IPsec 設定

1.IPsec プロポーザル

GUI

IPsec>Proposals

Enabled: Checked
Name: L2TP-Proposal
Auth. Algorithm: sha1
Encr. Algorithm: 3des, aes-256 cbc
PFS Group: none

CLI

/ip ipsec proposal add name=L2TP-Proposal auth-algorithms=sha1 enc-algorithms=3des,aes-256-cbc pfs-group=none

2.IPsec Peers

GUI

IPsec>Peers

Enabled: Checked
Address: 0.0.0.0
Auth. Method: pre shared key
Secret: MYKEY
Policy Template Group: default
Exchange Mode: main l2tp
Send Initial Contact: Checked
NAT Traversal: Checked
My ID: auto
Proposal check: obey
Hash Algorithm: sha1
Encryption Algorithm: 3des, aes-256
DH Group: modp1024
Generate policy: port override

CLI

/ip ipsec peer add address=0.0.0.0/0 port=500 auth-method=pre-shared-key secret="MYKEY" generate-policy=port-override exchange-mode=main-l2tp
 send-initial-contact=yes nat-traversal=yes hash-algorithm=sha1 enc-algorithm=3des,aes-256 dh-group=modp1024

※上記の"MYKEY"はL2TP設定の2の設定と同じでなければなりません。

3.IPSec Policies

GUI

Enabled: Checked
Src. Address: ::/0
Dst. Address: ::/0
Protocol: 255(all)
Template: Checked
Group: default
Action: encrypt
Level: require
IPsec Protocols: esp
Tunnel: Not checked
SA Src. Address: 0.0.0.0
SA Dsr. Address: 0.0.0.0
Proposal: L2TP-Proposal

CLI

/ip ipsec policy add src-address=::/0 dst-address=::/0 protocol=all template=yes group=default action=encrypt level=require ipsec-protocols=esp tunnel=no sa-src-address=0.0.0.0 sa-dst-address=0.0.0.0 proposal=L2TP-Proposal

あとは、スマートフォンでL2TP接続の設定を行えばOKです。

※こちらから、Firewall設定も確認ください。

iPhone

タイプ:L2TP

サーバ:固定IPアドレスかそのドメイン、DynamicDNSを利用したドメイン。

アカウント:MYUSER

パスワード:MYPASSWORD

シークレット:MYKEY

Android

VPNネットワークのタイプ:L2TP/IPsec PSK

サーバアドレス:固定IPアドレスかそのドメイン、DynamicDNSを利用したドメイン。

IPsec事前共有鍵:MYKEY

L2TP接続ユーザ名:MYUSER

L2TP接続パスワード:MYPASSWORD