【NEC UNIVERGE IX2106】IKEv2 による IPsec の設定方法

ルータ

はじめに

  • 前半では、UNIVERGE IX における IKEv2 の設定方法について記載します
  • 後半では、IKEv2 の設定例を記載します

対象環境

  • 型番:UNIVERGE IX2106
  • バージョン:10.2.16

IKEv2 の設定方法

IKEv2 基礎知識

  • IKEv1 における ISAKMP-SA に相当する機能は、IKEVv2 では IKE-SA と呼ばれます
  • IKEv1 における IPsec-SA に相当する機能は、IKEVv2 では Child-SA と呼ばれます

IKEv2 設定概要

UNIVERGE IX における IKEv2 に関する設定項目は以下の通りです。

  1. 機器認証情報の設定
    • 機器 ID と認証情報(事前共有キーなど)を関連付ける設定
  2. IKEv2 ポリシーの設定
    • IKEv2 で使用する認証/暗号化の方式やその他パラメータの設定
  3. Tunnel インターフェースの設定
    • IKEv2 で使用するトンネルインターフェースの設定

機器認証情報の設定

対向機器の認証情報を設定します。

設定はグローバルコンフィグモードで以下コマンドで設定します。
※ここでは方式として Pre-Shared Key を、ID として IPv4 アドレスを使用する場合について記載します

  • ikev2 authentication psk id ipv4 ADDRESS key char SHARED-KEY
    • ADDRESS:対向機器の IP アドレスを指定します
    • SHARED-KEY:事前共有鍵(対向機器に設定されているものと同じにする)

■設定例

ikev2 authentication psk id ipv4 200.210.220.1 key char ikev2pass

  • この設定によって、指定した ID と指定した事前共有鍵が関連付けられます
  • この認証情報は、後述のトンネルインターフェースにおける設定で IKEv2 ピアと関連付けられます
  • 対向機器の設定状況によっては、自装置についての認証情報も設定しておく必要があります

IKEv2 ポリシーの設定

デフォルトの設定値について

IKEv2 ポリシーの設定項目としては以下表に記載されているような項目があります。各項目の設定は省略することもでき、設定省略時はデフォルトの設定値が使用されます。

No.項目デフォルト
1自装置 IDソースアドレス
2IKE-SA プロポーザル・暗号、認証、PRF、DH は機器で対応しているものをすべて提案
・相手から複数の提案を受けた場合は、最もセキュリティの高いものを採用
3Child-SA プロポーザル・暗号、認証、PRF は機器で対応しているものをすべて提案
・相手から複数の提案を受けた場合は、最もセキュリティの高いものを採用
4接続モードトリガモード(パケット送受信時に SA 作成)
5DPD(キープアライブ)無効
6ネゴシエーション方向双方向
7リプレイ攻撃検出有効
8トラフィックセレクタany 固定(IPv4、IPv6 すべて)
9イニシャルコンタクト有効(変更不可)
10出力インターフェース固定しない
11ソースアドレス固定しない
12再送とタイムアウト2,4,8 秒間隔で再送、16 秒後にタイムアウト(計 30 秒)
13IKE-SA ライフタイム86400 秒(24 時間)
14Child-SA ライフタイム28800 秒(8 時間)
15フラグメント動作ポストフラグメント(暗号化処理のあとにフラグメント)
※自生成パケットは常にプリフラグメント
16強制フラグメント設定なし

IKEv2 ポリシーの設定方法について

IKEv2 ポリシーの設定方法としては以下の 3 通りがあります。

  1. IKEv2 デフォルトプロファイルで設定する方法
  2. IKEv2 プロファイルを作成し、それをトンネルインターフェースに対応付ける方法
  3. IKEv2 で使用するトンネルインターフェースで設定する方法

IKEv2 トンネルを複数作成し、かつトンネル別に異なる設定を使用する場合でなければ、デフォルトプロファイルにて設定する方法で対応可能です。そのため、以下ではデフォルトプロファイルで設定する方法のみを記載します。

なお、設定の優先順位は以下の通りです。

  1. Tunnel インタフェースの設定
  2. IKEv2 プロファイルの設定
  3. デフォルトプロファイルの設定
  4. デフォルトの設定

デフォルトプロファイルの設定方法

デフォルトプロファイルを設定するためには、まず以下コマンドを実行してデフォルトプロファイル設定モードに移行します。

  • ikev2 default-profile

デフォルトプロファイル設定モードに移行後、各項目を設定します。

◆自装置の認証情報の設定

No.項目設定コマンド設定値
1自装置の認証情報 (ipv4 形式の場合)local-authentication psk id ipv4 アドレス(x.x.x.x)

◆IKE-SA 関係の設定項目

No.項目設定コマンド設定値
1DHグループsa-proposal dh1024-bit:DH Group 2
1536-bit:DH Group 5
2048-bit:DH Group 14
768-bit:DH Group 1
2暗号化アルゴリズムsa-proposal enc3des-cbc:Triple DES-CBC
aes-cbc-128:AES-CBC (128 bits)
aes-cbc-192:AES-CBC (192 bits)
aes-cbc-256:AES-CBC (256 bits)
3認証アルゴリズムsa-proposal integritymd5:HMAC-MD5-96
sha1:HMAC-SHA1-96
sha2-256:HMAC-SHA2-256-128
sha2-384:HMAC-SHA2-384-192
sha2-512:HMAC-SHA2-512-256
4PRF アルゴリズムsa-proposal prfmd5:HMAC-MD5
sha1:HMAC-SHA1
sha2-256:HMAC-SHA2-256
sha2-384:HMAC-SHA2-384
sha2-512:HMAC-SHA2-512
5SA ライフタイムsa-lifetime90-691200 (秒)

◆Child-SA 関係の設定項目

No.項目設定コマンド設定値
1暗号化アルゴリズムchild-proposal enc3des-cbc:Triple DES-CBC
aes-cbc-128:AES-CBC (128 bits)
aes-cbc-192:AES-CBC (192 bits)
aes-cbc-256:AES-CBC (256 bits)
null:NULL Algorithm
2認証アルゴリズムchild-proposal integritymd5:HMAC-MD5-96
off:Disable child-proposal integrity
sha1:HMAC-SHA1-96
sha2-256:HMAC-SHA2-256-128
sha2-384:HMAC-SHA2-384-192
sha2-512:HMAC-SHA2-512-256
3PRF 設定child-pfs1024-bit:DH Group 2
1536-bit:DH Group 5
2048-bit:DH Group 14
768-bit:DH Group 1
off:Disable child-pfs
4SA ライフタイムchild-lifetime90-691200 (秒)

◆その他の設定項目

No.項目設定コマンド設定値
1DPD(キープアライブ)dpd interval
dpd off
※無効化する場合
10-3600 (秒)
2ネゴシエーション方向negotiation-directionboth
initiator
responder
3リプレイ攻撃検出の無効化anti-replay off
4トラフィックセレクタlocal-ts
remote-ts
詳細は略
公式マニュアル参照
5出力インターフェースoutgoing-interfaceインターフェース名
6ソースアドレスsource-addressアドレス
再送とタイムアウトretransmit count R interval { S | backoff }R:リトライ回数
→ 2-10
S:間隔
→ 5-60 または backoff
backoffの場合、
2秒、4秒、8秒….と

“2^n[回]”で増加

Tunnel インターフェースの設定

IKEv2 で使用するトンネルインターフェースの設定として最低限必要な設定は以下の通りです。

interface Tunne<x>.0 #<x>の部分は任意のインターフェース番号
  tunnel mode ipsec-ikev2
  ip address x.x.x.x/xx
  ikev2 peer x.x.x.x authentication psk id ipv4 x.x.x.x
  no shutdown

  • tunnel mode ipsec-ikev2
    • IKEv2 の場合は、モードを ipsec-ikev2 と設定します
  • ikev2 peer x.x.x.x authentication psk id ipv4 x.x.x.x
    • IKEv2 の対向機器(peer)と IKEv2 認証情報の設定です
    • peer x.x.x.x:IKEv2 の対向機器のアドレスを指定します
    • authentication psk id ipv4 x.x.x.x:グローバルで設定している、対向機器についての認証情報と同じ ID を指定します

以下は Tunnel インターフェースのみで任意で設定できる設定項目です。

  • ikev2 connect-type { auto | trigger }
    • auto:常時 SA を生成
    • trigger:トリガパケットにより SA を生成
  • ikev2 ipsec pre-fragment
    • フラグメント動作をポストフラグメントからプリフラグメント動作に切り替える
  • ikev2 ipsec mtu ignore
    • MTU サイズを超えたパケットを強制的にフラグメントして送信

IKEv2 設定例

作業環境

■UNIVERGE IX

  • 型番:UNIVERGE IX2106
  • バージョン:10.2.16

■対向ルータ

  • 型番:Cisco C891FJ-K9
  • バージョン:15.3(3)M5

■中間ルータ(通信を中継するだけ)

  • 型番:FortiGate 60E
  • バージョン:6.2.4

ネットワーク構成

  • UNIVERGE IX2106 と Cisco C891FJ-K9 との間で IKEv2 を使用した IPsec を構築します
  • IPsec 上で BGP を動作させます

IKEv2 設定

IX2106 の設定

※IPsec 関係の設定を抜粋

#対向装置の認証情報の設定
ikev2 authentication psk id ipv4 200.1.4.1 key char ikev2pass

#デフォルトプロファイルの設定
ikev2 default-profile
  child-pfs off
  dpd interval 10
  sa-proposal dh 1024-bit

#IPsec トンネルインターフェースの設定
interface Tunnel3.0
  tunnel mode ipsec-ikev2
  ip address 10.200.0.1/24
  ip tcp adjust-mss auto
  ikev2 connect-type auto
  ikev2 ipsec pre-fragment
  ikev2 peer 200.1.4.1 authentication psk id ipv4 200.1.4.1
  no shutdown

#IPsec 構築用ルートの設定
ip route 200.1.4.0/30 200.1.1.2

#BGP設定
router bgp 100
  neighbor 10.200.0.254 remote-as 100
  neighbor 10.200.0.254 timers 10 30
  address-family ipv4 unicast
    redistribute connected

  • 暗号/認証アルゴリズムは特に設定していませんが、この場合は対向ルータ側から提案されたものの中から最もセキュリティが高いものが使用されます

C891FJ の設定

※IPsec 関係の設定を抜粋

#IKEv2 プロポーザルの設定
crypto ikev2 proposal ikev2proposal
 encryption 3des
 integrity sha1
 group 2

#IKEv2 ポリシーの設定
crypto ikev2 policy ikev2policy
 match address local 200.1.4.1
 proposal ikev2proposal

#IKEv2 キーリングの設定
crypto ikev2 keyring keys
 peer 200.1.1.1
  address 200.1.1.1
  pre-shared-key ikev2pass

#IKEv2 プロファイルの設定
crypto ikev2 profile ikev2profile
 match identity remote address 200.1.1.1 255.255.255.255
 authentication remote pre-share
 authentication local pre-share
 keyring local keys

#IPsec トランスフォームセットの設定
crypto ipsec transform-set TF-SET esp-3des esp-sha-hmac
 mode tunnel

#IPsec プロファイルの設定
crypto ipsec profile IPS-PRF3
 set security-association lifetime kilobytes 1000000
 set transform-set TF-SET

#IPsecトンネルインターフェースの設定
interface Tunnel2
 ip address 10.200.0.254 255.255.255.0
 tunnel source Vlan204
 tunnel mode ipsec ipv4
 tunnel destination 200.1.1.1
 tunnel protection ipsec profile IPS-PRF3 ikev2-profile ikev2profile

#WAN側物理インターフェースの設定
interface GigabitEthernet5
 switchport access vlan 204
 no ip address

interface Vlan204
 ip address 200.1.4.1 255.255.255.252

#IPsec 構築用ルートの設定
ip route 200.1.1.0 255.255.255.252 200.1.4.2

#BGP設定
router bgp 100
 bgp log-neighbor-changes
 timers bgp 10 30
 redistribute connected
 neighbor 10.200.0.1 remote-as 100
 neighbor 10.200.0.1 soft-reconfiguration inbound

動作確認

疎通確認

◆端末A → 端末B

C:\WINDOWS\system32>tracert -d 10.11.0.1

10.11.0.1 へのルートをトレースしています。経由するホップ数は最大 30 です

  1     1 ms    <1 ms    <1 ms  192.168.1.254
  2     1 ms     1 ms     1 ms  10.200.0.254
  3     2 ms     2 ms     2 ms  10.11.0.1

トレースを完了しました。

◆端末B → 端末A

C:\WINDOWS\system32>tracert -d 192.168.1.1

192.168.1.1 へのルートをトレースしています。経由するホップ数は最大 30 です

  1     1 ms     1 ms     1 ms  10.11.0.254
  2     2 ms     1 ms     2 ms  10.200.0.1
  3     2 ms     2 ms     2 ms  192.168.1.1

トレースを完了しました。

IX での IKEv2 状態確認

show ikev2 sa

Router(config)# show ikev2 sa
IKEv2 SA - 1 created
Interface Tunnel3.0
  SPI (I)0xb598395e7153f9e3  (R)0xf8f17cc4737879a5
    Remain lifetime[sec] : 25441
    Serial : 33
    Direction : initiator
    Local Addr : 200.1.1.1:500
    Peer Addr  : 200.1.4.1:500
    Local ID : IPV4-ADDR 200.1.1.1
    Peer ID  : IPV4-ADDR 200.1.4.1
    Status : establish
    Local message ID : 6097
    Peer message ID  : 34
    Encryption alg : 3DES-CBC
      initiator key : 0x4a3bf68fca40d6cf7eb2a8d4ebe32e1cbbbe0d1e9bdbf835
      responder key : 0xc5ede5a97e5ded3f22c6eb24d7ee67a193b9bd45d4746b6c
    Integrity alg : HMAC-SHA1-96
      initiator key : 0x9d492d3c1dc7aaf27589ecd8ec30fb8d01d392f0
      responder key : 0x15eb8906de926cb3e10e8065bbf92f43d9357a49
    PRF alg  : HMAC-SHA1
    DH group : MODP-1024
    PFS : off
    DPD : interval 10[sec]
    Child
      Prot SPI(IN)    SPI(OUT)   Lifetime[sec]
      ESP  0x31105ebd 0xd976b38e 26796

show ikev2 child-sa

Router(config)# show ikev2 child-sa
Child SA - 1 connected
Interface Tunnel3.0
  IKE Peer ID : IPV4-ADDR 200.1.4.1
    IKE SPI (I)0xb2495f148065b8f5  (R)0xe29ae85b8e0067e8
    IKE SA serial : 34
    Child SA
      Protocol : ESP
      Local Addr : 200.1.1.1
      Peer Addr  : 200.1.4.1
      Enc alg  : 3DES-CBC
      Hash alg : HMAC-SHA1-96
      Remain lifetime[sec] : 28698
      Anti-replay : on
      Direction is outbound
        SPI : 0xbc306b2b
        Serial : 73
        Authkey : 0x12f27a77a6b2289940123722021461acc2cb52f6
        Enckey  : 0x39b06a5eefb93557ba471c8a82bb072b5380ac3aa22a0d68
      Direction is inbound
        SPI : 0xdc53f027
        Serial : 72
        Authkey : 0x224d25ce59dd87454a56ebe00e39774c20ed8f93
        Enckey  : 0x062bd04b461f85249df86ded75b851d953f3d3b285831470
      Local TS:
        TS type : IPV4-ADDR-RANGE
          Protocol any
            Address Range 0.0.0.0 to 255.255.255.255
            Port Range 0 to 65535
      Peer TS:
        TS type : IPV4-ADDR-RANGE
          Protocol any
            Address Range 0.0.0.0 to 255.255.255.255
            Port Range 0 to 65535
    Statistics
      Outbound
        43 packets, 1970 octets
        0 cipher failure, 0 out of memory, 0 ts unacceptable
        0 misc error, 0 invalid packet, 0 packet too big
      Inbound
        42 packets, 2025 octets
        0 invalid sa, 0 replay detected, 0 integrity failure
        0 cipher failure, 0 packet truncated, 0 invalid padding
        0 unknown protocol, 0 out of memory, 0 ts unacceptable
        0 misc error, 0 tcp chksum error, 0 invalid packet
        0 recv error
    History
      Time                Event
      2020/10/22 06:25:41 Delete : Delete IKE SA by command
      2020/10/22 06:25:41 Create

show ikev2 statistics

Router(config)# show ikev2 statistics
IKEv2 Statistics
  Informational     : Initiator 13 success, 0 fail
                      Responder 0 success, 0 fail

  Exchange
    INFORMATIONAL   : 13 send request, 13 recv response
                      0 recv request, 0 send response
                      0 resend, 0 timeout

IX での BGP 状態確認

show ip bgp

Router(config)# show ip bgp
BGP table version is 10, local router ID is 10.150.0.1
Local AS number 100
Status codes: s - suppressed, * - valid, h - history, l - looped
              > - best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network            Next Hop            Metric     LocPrf  Path
*> 10.7.254.0/24      0.0.0.0                  0             ?
*> 10.7.255.0/24      0.0.0.0                  0             ?
*>i10.11.0.0/24       10.200.0.254             0        100  ?
*> 10.150.0.0/30      0.0.0.0                  0             ?
*> 10.200.0.0/24      0.0.0.0                  0             ?
* i                   10.200.0.254             0        100  ?
*> 192.168.1.0/24     0.0.0.0                  0             ?
*> 200.1.1.0/30       0.0.0.0                  0             ?
*>i200.1.4.0/30       10.200.0.254             0        100  ?

Total number of prefixes 9

show ip bgp summary

Router(config)# show ip bgp summary
BGP router ID 10.150.0.1, local AS number 100
1 BGP AS-PATH entries

Neighbor         V    AS    MsgRcvd MsgSent Up/DownTime   State
 10.200.0.254    4    100   302     285     0:47:05       ESTABLISHED

show ip bgp neighbors

Router(config)# show ip bgp neighbors
BGP neighbor is 10.200.0.254, remote AS 100, local AS 100, internal link
  BGP version 4, remote router ID 200.1.4.1
  BGP state is ESTABLISHED, up for 0:49:04
  Last read 0:00:09, last sent 0:00:04
  Received 314 messages, 0 notifications
  Sent 297 messages, 0 notifications
  Minimum time between advertisement runs is 5 seconds
  Minimum time between origination runs is 15 seconds
  Hold time is 30, keepalive interval is 10 seconds
  Neighbor capabilities:
    Address family IPv4 unicast: advertised, received, supported
    Address family IPv6 unicast: not advertised, not received, not supported
    Route refresh capability: advertised (new), received (old & new), supported (old & new)
  For address family: IPv4 unicast
    BGP table version 10, advertised table version 10
    3 accepted prefixes
    Send default route is enabled
    Next-hop self is disabled
    Inbound policy: None
    Outbound policy: None
  Connections established 1, dropped 0
    Local host: 10.200.0.1, port: 32292
    Foreign host: 10.200.0.254, port: 179
    TTL is 254

show ip route bgp

Router(config)# show ip route bgp
IP Routing Table - 1 entries, 19 hidden, 2028 frees
Entries: 0 Connected, 0 Static, 0 RIP, 0 OSPF, 1 BGP
Codes: C - Connected, S - Static, R - RIP, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, B - BGP
       * - Candidate default, s - Summary
Timers: Age
B      10.11.0.0/24 [200/0] via 10.200.0.254, Tunnel3.0, 0:05:13

―――――――――――――

タイトルとURLをコピーしました