IKEv2とは
IKEv2(Internet Key Exchange Version 2)は、IPsec(Internet Protocol Security)で使用される鍵交換および認証のためのプロトコルです。
IPsecトンネルの暗号化に必要な鍵を安全に生成・交換し、通信相手を認証します。
IKEv2はIKEv1の改良版であり、再接続の高速化、モビリティ(MOBIKE)対応、メッセージ交換の効率化などが行われています。
現在では、VPN構築時の標準的な鍵交換プロトコルとして広く採用されています。
IKEv2の設定
下記の構成図でIPSecのIKEv2を構成します。
IPSecに関する設定以外は、以下のページで紹介しているので興味がある方はご確認ください。
IKEv2ポリシーの設定
IKEv2で使用する暗号化およびハッシュアルゴリズムを設定して、IKEv2のポリシーに関連付けます。
HUB-Router(config)#crypto ikev2 proposal IKEV2-PROPOSAL
IKEv2 proposal MUST either have a set of an encryption algorithm other than aes-gcm, an integrity algorithm and a DH group configured or
HUB-Router(config-ikev2-proposal)#encryption aes-cbc-256
HUB-Router(config-ikev2-proposal)#integrity sha256
HUB-Router(config-ikev2-proposal)#group 14
HUB-Router(config-ikev2-proposal)#exit
HUB-Router(config)#crypto ikev2 policy IKEV2-POLICY
IKEv2 policy MUST have atleast one complete proposal attached
HUB-Router(config-ikev2-policy)#proposal IKEV2-PROPOSAL
SPOKE-Router1(config)#crypto ikev2 proposal IKEV2-PROPOSAL
IKEv2 proposal MUST either have a set of an encryption algorithm other than aes-gcm, an integrity algorithm and a DH group configured or
encryption algorithm aes-gcm, a prf algorithm and a DH group configured
SPOKE-Router1(config-ikev2-proposal)#encryption aes-cbc-256
SPOKE-Router1(config-ikev2-proposal)#integrity sha256
SPOKE-Router1(config-ikev2-proposal)#group 14
SPOKE-Router1(config-ikev2-proposal)#exit
SPOKE-Router1(config)#crypto ikev2 policy IKEV2-POLICY
IKEv2 policy MUST have atleast one complete proposal attached
SPOKE-Router1(config-ikev2-policy)#proposal IKEV2-PROPOSAL
SPOKE-Router2(config)#crypto ikev2 proposal IKEV2-PROPOSAL
IKEv2 proposal MUST either have a set of an encryption algorithm other than aes-gcm, an integrity algorithm and a DH group configured or
encryption algorithm aes-gcm, a prf algorithm and a DH group configured
SPOKE-Router2(config-ikev2-proposal)#encryption aes-cbc-256
SPOKE-Router2(config-ikev2-proposal)#integrity sha256
SPOKE-Router2(config-ikev2-proposal)#group 14
SPOKE-Router2(config-ikev2-proposal)#exit
SPOKE-Router2(config)#crypto ikev2 policy IKEV2-POLICY
IKEv2 policy MUST have atleast one complete proposal attached
SPOKE-Router2(config-ikev2-policy)#proposal IKEV2-PROPOSAL
💡 IKEv2では、暗号アルゴリズム・ハッシュ・Diffie-Hellmanグループをproposalで定義し、
それをpolicyで紐づける構造になっています。IKEv1のcrypto isakmp policyとは異なります。
| コマンド | 解説 | 目的 |
|---|---|---|
crypto ikev2 proposal <名前> | IKEv2で使用する暗号・認証アルゴリズムの組み合わせを定義 | IKEv2フェーズ1で暗号化方式・ハッシュ方式・DHグループを指定 |
encryption aes-cbc-256 | AES 256ビットによるCBCモード暗号化を使用 | 強力な暗号化でセキュアなトンネルを確立 |
integrity sha256 | ハッシュ関数にSHA-256を使用 | メッセージ完全性(改ざん防止)を保証 |
group 14 | Diffie-Hellmanグループ14(2048bit)を使用 | 鍵交換の強度を指定 |
crypto ikev2 policy <名前> | どのProposalを採用するかを定義 | 複数Proposalの中から一致するものを選択 |
proposal <名前> | IKEv2 PolicyにProposalを関連付け | 暗号スイートを明示的に指定 |
事前共有鍵(Pre-Shared Key:PSK)の設定
IKEv2で使用する事前共有鍵(Pre-Shared Key:PSK)を設定します。
HUB-Router(config)#crypto ikev2 keyring IKEV2-KEYRING
HUB-Router(config-ikev2-keyring)#peer ANY
HUB-Router(config-ikev2-keyring-peer)#address 0.0.0.0 0.0.0.0
HUB-Router(config-ikev2-keyring-peer)#pre-shared-key cisco
SPOKE-Router1(config)#crypto ikev2 keyring IKEV2-KEYRING
SPOKE-Router1(config-ikev2-keyring)#peer ANY
SPOKE-Router1(config-ikev2-keyring-peer)#address 0.0.0.0 0.0.0.0
SPOKE-Router1(config-ikev2-keyring-peer)#pre-shared-key cisco
SPOKE-Router2(config)#crypto ikev2 keyring IKEV2-KEYRING
SPOKE-Router2(config-ikev2-keyring)#peer ANY
SPOKE-Router2(config-ikev2-keyring-peer)#address 0.0.0.0 0.0.0.0
SPOKE-Router2(config-ikev2-keyring-peer)#pre-shared-key cisco
💡 DMVPN環境では、Hubが複数のSpokeから接続を受け入れるため、peer ANY を使用して全アドレスを許可します。
1対1のVPN構成では、特定の相手アドレスを指定しても構いません。
| コマンド | 解説 | 目的 |
|---|---|---|
crypto ikev2 keyring <名前> | IKEv2用の鍵リングを作成 | 事前共有鍵を格納するための論理的な入れ物 |
peer <名前> | 鍵を定義する相手ピア名を指定 | Hubの場合はANYで複数Spokeを許可 |
address 0.0.0.0 0.0.0.0 | 接続元IPをすべて許可 | 複数のSpokeを受け入れるHub向け設定 |
pre-shared-key <文字列> | 事前共有鍵(Pre-Shared Key: PSK)を設定 | IKEv2の認証に使用する共通キー |
IKEv2プロファイルの設定
IKEv2プロファイルを設定し、事前共有鍵(Pre-Shared Key:PSK)を使用して認証します。
HUB-Router(config)#crypto ikev2 profile IKEV2-PROFILE
IKEv2 profile MUST have:
1. A local and a remote authentication method.
2. A match identity or a match certificate or match any statement.
HUB-Router(config-ikev2-profile)#match identity remote any
HUB-Router(config-ikev2-profile)#identity local address 1.1.1.1
HUB-Router(config-ikev2-profile)#authentication local pre-share
HUB-Router(config-ikev2-profile)#authentication remote pre-share
HUB-Router(config-ikev2-profile)#keyring local IKEV2-KEYRING
SPOKE-Router1(config)#crypto ikev2 profile IKEV2-PROFILE
IKEv2 profile MUST have:
1. A local and a remote authentication method.
2. A match identity or a match certificate or match any statement.
SPOKE-Router1(config-ikev2-profile)#match identity remote any
SPOKE-Router1(config-ikev2-profile)#identity local address 1.1.1.2
SPOKE-Router1(config-ikev2-profile)#authentication local pre-share
SPOKE-Router1(config-ikev2-profile)#authentication remote pre-share
SPOKE-Router1(config-ikev2-profile)#keyring local IKEV2-KEYRING
SPOKE-Router2(config)#crypto ikev2 profile IKEV2-PROFILE
IKEv2 profile MUST have:
1. A local and a remote authentication method.
2. A match identity or a match certificate or match any statement.
SPOKE-Router2(config-ikev2-profile)#match identity remote any
SPOKE-Router2(config-ikev2-profile)#identity local address 1.1.1.3
SPOKE-Router2(config-ikev2-profile)#authentication local pre-share
SPOKE-Router2(config-ikev2-profile)#authentication remote pre-share
SPOKE-Router2(config-ikev2-profile)#keyring local IKEV2-KEYRING
IKEv1では「crypto isakmp key」コマンドで事前共有鍵を設定していましたが、IKEv2ではキーリングを作成してそれを基にIKEv2のプロファイルを作成します。
| コマンド | 解説 | 目的 |
|---|---|---|
crypto ikev2 profile <名前> | IKEv2プロファイルを作成 | IKEv2セッションに使用する認証方式や識別子を定義 |
match identity remote any | すべての相手を受け入れる | DMVPNなど複数Spoke構成に必須 |
identity local address <IP> | ローカル識別子をインターフェースIPで指定 | 相手が自分を認識するためのID |
authentication local pre-share | 自身の認証方式に事前共有鍵を使用 | 対称鍵方式による簡易認証 |
authentication remote pre-share | 相手の認証方式を指定 | 双方向で一致する必要あり |
keyring local <名前> | 関連付けるKeyringを指定 | プリシェアードキー情報を参照 |
IPsecトランスフォームセットの設定
IPsecトンネルを暗号化するためのトランスフォームセットを設定します。
HUB-Router(config)#crypto ipsec transform-set IPSEC-TRANSFORM esp-aes 256 esp-sha-hmac
HUB-Router(cfg-crypto-trans)#mode transport
SPOKE-Router1(config)#crypto ipsec transform-set IPSEC-TRANSFORM esp-aes 256 esp-sha-hmac
SPOKE-Router1(cfg-crypto-trans)#mode transport
SPOKE-Router2(config)#crypto ipsec transform-set IPSEC-TRANSFORM esp-aes 256 esp-sha-hmac
SPOKE-Router2(cfg-crypto-trans)#mode transport
内容はIKEv1と同様です。
| コマンド | 解説 | 目的 |
|---|---|---|
crypto ipsec transform-set <名前> | IPsecで使用する暗号化・ハッシュ方式を指定 | IKEv2フェーズ2(データトンネル暗号化)の設定 |
esp-aes 256 | ESPでAES256による暗号化を使用 | データプレーンの暗号化を実施 |
esp-sha-hmac | HMAC-SHAを使用した認証を設定 | 改ざん検出・完全性保証 |
mode transport | トランスポートモードを指定 | GREトンネルと併用し、ヘッダを暗号化しない |
IPsecプロファイルの設定
IKEv2プロファイルとトランスフォームセットを関連付けたIPsecプロファイルを作成し、これをトンネルインターフェースに適用します。
HUB-Router(config)#crypto ipsec profile DMVPN-IPSEC
HUB-Router(ipsec-profile)#set ikev2-profile IKEV2-PROFILE
HUB-Router(ipsec-profile)#set transform-set IPSEC-TRANSFORM
SPOKE-Router1(config)#crypto ipsec profile DMVPN-IPSEC
SPOKE-Router1(ipsec-profile)#set ikev2-profile IKEV2-PROFILE
SPOKE-Router1(ipsec-profile)#set transform-set IPSEC-TRANSFORM
SPOKE-Router2(config)#crypto ipsec profile DMVPN-IPSEC
SPOKE-Router2(ipsec-profile)#set ikev2-profile IKEV2-PROFILE
SPOKE-Router2(ipsec-profile)#set transform-set IPSEC-TRANSFORM
| コマンド | 解説 | 目的 |
|---|---|---|
crypto ipsec profile <名前> | IPsecプロファイルを作成 | Transform-SetとIKEv2 Profileを統合する設定単位 |
set ikev2-profile <名前> | 使用するIKEv2プロファイルを指定 | 事前共有鍵や認証設定を関連付け |
set transform-set <名前> | 使用するTransform-Setを指定 | データ暗号化方式を関連付け |
GREトンネルへのIPsecプロファイルの適用
最後に、トンネルインターフェースにIPsecプロファイルを適用して、トンネルを暗号化します。
HUB-Router(config)#interface Tunnel0
HUB-Router(config-if)#tunnel protection ipsec profile DMVPN-IPSEC
SPOKE-Router1(config)#interface Tunnel0
SPOKE-Router1(config-if)#tunnel protection ipsec profile DMVPN-IPSEC
SPOKE-Router2(config)#interface Tunnel0
SPOKE-Router2(config-if)#tunnel protection ipsec profile DMVPN-IPSEC
| コマンド | 解説 | 目的 |
|---|---|---|
interface Tunnel0 | トンネルインターフェースを開く | GREトンネル設定対象 |
tunnel protection ipsec profile <名前> | IPsecプロファイルを適用 | GREパケットをIPsecで暗号化し、安全な通信を実現 |
設定後の動作確認
IKEv2はisakmpによる暗号化が行われないため、確認をしても表示されません。

代わりに、IKEv2のステータスを確認することが出来ます。

IPSec SAのステータスについてはIKEv1と同様に確認することが出来ます。

| コマンド | 解説 | 目的 |
|---|---|---|
show crypto ikev2 sa | IKEv2セッションの状態を確認 | SAが確立しているか確認(Ready状態) |
show crypto ipsec sa | IPsecトンネルの暗号化状況を確認 | 暗号化・復号パケット数を確認 |
show crypto ikev2 stats | IKEv2の統計情報を確認 | 再送・失敗回数などを解析 |