ヤマハNVR510を使い、外出先のiPadから自宅LANへIKEv2でVPN接続する設定を試みた記録です。iOS 18以降のセキュリティ変更により単純な設定では接続できず、いくつかのハードルがありました。同じ問題にぶつかった方の参考になれば幸いです。
環境
| 機器 | 詳細 |
|---|---|
| ルーター | ヤマハ NVR510(Rev.15.01.26) |
| クライアント | iPad(iPadOS 26) |
| グローバルIP | 動的IP・DDNSで運用 |
問題1:IKEペイロードエラー
最初にNVR510側でIKEv2トンネルを設定し、iPadの標準VPN設定から接続を試みると以下のエラーが発生しました。
[IKE2] GW:*/SA:1/INIT cannot accept KE payload
[IKE2] SA:1/IKE established
原因はDiffie-Hellmanグループの不一致です。iOS 18以降はセキュリティ強化により、ecp256(Group 19)やecp384(Group 20)を優先して提案します。一方NVR510がサポートするのはmodp2048(Group 14)までです。
modp768 / modp1024 / modp1536 / modp2048ecp256・ecp384には非対応
iOSの標準VPN設定画面ではDHグループを指定できません。そこでmobileconfig(構成プロファイル)を手動作成してiPadにインストールすることで解決しました。MacがなくてもテキストエディタでXMLを書いてメールで送るだけでOKです。
mobileconfigのDHグループ指定箇所
IKESecurityAssociationParametersとChildSecurityAssociationParametersの両方でDHグループ14を明示することが重要です。片方だけでは接続できません。
<key>IKESecurityAssociationParameters</key>
<dict>
<key>EncryptionAlgorithm</key><string>AES-256</string>
<key>IntegrityAlgorithm</key><string>SHA2-256</string>
<key>DiffieHellmanGroup</key><integer>14</integer>
</dict>
<key>ChildSecurityAssociationParameters</key>
<dict>
<key>EncryptionAlgorithm</key><string>AES-256</string>
<key>IntegrityAlgorithm</key><string>SHA2-256</string>
<key>DiffieHellmanGroup</key><integer>14</integer>
</dict>
問題2:IDiペイロードエラー
IKEペイロード問題を解消すると、次は認証フェーズでエラーが発生しました。
[IKE2] SA:1/IKE established
[IKE2] GW:*/SA:1/AUTH exchange started
[IKE2] GW:*/SA:1/AUTH cannot accept IDi payload
IDi(接続元の識別子)がNVR510側の設定と一致していないことが原因でした。
NVR510とmobileconfigの識別子の対応関係
| NVR510の設定 | 意味 | mobileconfig側の対応項目 |
|---|---|---|
ipsec ike local name | ルーター自身の識別子 | RemoteIdentifier |
ipsec ike remote name | クライアントの識別子 | LocalIdentifier |
また ipsec ike remote name の型は fqdn を指定します。文字列にアンダースコア(_)を含めるとRFC違反となりiOSに拒否される場合があるため、ハイフン区切りにしてください。
最終的な設定
NVR510側コンフィグ
tunnel select 3
description tunnel IKEv2_3
tunnel encapsulation ipsec
ipsec tunnel 3
ipsec sa policy 3 3 esp
ipsec ike version 3 2
ipsec ike duration ipsec-sa 3 3600
ipsec ike duration isakmp-sa 3 28800
ipsec ike encryption 3 aes256-cbc
ipsec ike group 3 modp2048
ipsec ike hash 3 sha256
ipsec ike keepalive log 3 off
ipsec ike keepalive use 3 on rfc4306 10 3
ipsec ike local name 3 router.example.com fqdn
ipsec ike nat-traversal 3 on
ipsec ike pfs 3 on
ipsec ike proposal-limitation 3 off
ipsec ike pre-shared-key 3 text [事前共有鍵]
ipsec ike remote name 3 client.example.com fqdn
ipsec ike mode-cfg address 3 1
ipsec auto refresh 3 on
tunnel enable 3
save
mobileconfig(構成プロファイル)全文
以下の内容をテキストエディタで保存し、拡張子を .mobileconfig にしてください。router.example.com と client.example.com はNVR510の設定に合わせた任意の文字列に変更してください(実際のFQDNである必要はありません)。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadType</key>
<string>com.apple.vpn.managed</string>
<key>PayloadIdentifier</key>
<string>com.example.vpn.nvr510</string>
<key>PayloadUUID</key>
<string>A1B2C3D4-E5F6-7890-ABCD-EF1234567890</string>
<key>PayloadVersion</key>
<integer>1</integer>
<key>UserDefinedName</key>
<string>NVR510 IKEv2</string>
<key>VPNType</key>
<string>IKEv2</string>
<key>IKEv2</key>
<dict>
<key>RemoteAddress</key>
<string>[DDNSホスト名]</string>
<key>RemoteIdentifier</key>
<string>router.example.com</string>
<key>LocalIdentifier</key>
<string>client.example.com</string>
<key>AuthenticationMethod</key>
<string>SharedSecret</string>
<key>SharedSecret</key>
<string>[事前共有鍵]</string>
<key>DeadPeerDetectionRate</key>
<string>Medium</string>
<key>EnablePFS</key>
<integer>1</integer>
<key>IKESecurityAssociationParameters</key>
<dict>
<key>EncryptionAlgorithm</key><string>AES-256</string>
<key>IntegrityAlgorithm</key><string>SHA2-256</string>
<key>DiffieHellmanGroup</key><integer>14</integer>
</dict>
<key>ChildSecurityAssociationParameters</key>
<dict>
<key>EncryptionAlgorithm</key><string>AES-256</string>
<key>IntegrityAlgorithm</key><string>SHA2-256</string>
<key>DiffieHellmanGroup</key><integer>14</integer>
</dict>
</dict>
</dict>
</array>
<key>PayloadDisplayName</key>
<string>NVR510 VPN Profile</string>
<key>PayloadIdentifier</key>
<string>com.example.vpn.profile</string>
<key>PayloadUUID</key>
<string>B2C3D4E5-F6A7-8901-BCDE-F12345678901</string>
<key>PayloadVersion</key>
<integer>1</integer>
<key>PayloadType</key>
<string>Configuration</string>
</dict>
</plist>
iPadへのインストール手順
- 1作成した
.mobileconfigファイルを自分宛にメールで送信 - 2iPadのメールアプリで添付ファイルをタップ
- 3「プロファイルをダウンロード」→ 設定アプリに移動して「インストール」
- 4設定 → 一般 → VPNとデバイス管理 でプロファイルを確認
- 5設定 → 一般 → VPN からVPN接続をオンにする
接続成功の確認
設定完了後にiPadからVPN接続を試みると、NVR510のログに以下が表示されました。
[IKE2] SA:1/IKE assigned gateway GW:3
[IKE2] SA:2/CHLD_SEND established
[IKE2] SA:3/CHLD_RECV established
IP Tunnel[3] Up
# show status tunnel 3
TUNNEL[3]:
Current status is Online.
Received: (IPv4) 910 packets [177390 octets]
Transmitted: (IPv4) 1357 packets [699978 octets]
IKE keepalive: OK
パケットが双方向に流れ、keepaliveも正常に動作しています。
まとめ:ハマりポイント一覧
| エラー | 原因 | 対処 |
|---|---|---|
cannot accept KE payload | iOS18がecp256を提案するがNVR510は非対応 | mobileconfigでDHグループ14を指定 |
cannot accept IDi payload | 識別子の型・値の不一致 | local name↔RemoteIdentifier、remote name↔LocalIdentifierの対応を確認 |
| 識別子エラー(その他) | 文字列にアンダースコアが含まれる | ハイフン区切りに変更(例:client.example.com) |