Choose “Save as PDF” as the destination to download this doc.

Back to the doc
amnimo Manual Library

G2.6 拠点間をIPsecで接続する

設定ガイド 第2章 設定例  ·  https://manual.amnimo.com/docs/guide-examples-cli/g2-6-cli/

G2.6 拠点間をIPsecで接続する

対象機種: AG10(ほかの機種はインターフェイス名が異なります。『G1.4 インターフェイスとポートの対応』を参照してください)

2 台の本製品の LAN どうしを、IPsec(IKEv2、事前共有鍵)で接続します。この設定例の構成は、『6.7 IPsecの設定をする』の実行例と同じです。

要件
項目IKE(ike01)SA(sa01)
暗号化アルゴリズムaes128aes128
認証アルゴリズムsha256sha256
PRFsha256―
DH グループ/PFS14(MODP2048)14(MODP2048)
ライフタイム3h1h

warning 注意: 3des、md5、DH グループ 1・2・5(MODP768・MODP1024・MODP1536)、IKEv1 のアグレッシブモード(aggressive)は、現在では十分な安全性がないため推奨しません。これらは既定の設定ではありません。対向機器との互換性などのためにやむを得ず使用する場合は、お客様の責任で使用してください。推奨値は、暗号化アルゴリズムが aes128 または aes256、認証アルゴリズムと PRF が sha256 以上、DH グループ(PFS)が 14(MODP2048)以上です。IKEv1 を使う場合は、メインモード(mode main)を使用してください。

構成
   拠点 1                                                 拠点 2
   LAN 192.168.0.0/24                                    LAN 192.168.10.0/24
          |                                                     |
   +----------------+                                  +----------------+
   | 本製品(拠点 1) |  192.168.1.254          192.168.1.10  | 本製品(拠点 2) |
   | gw1.example.com |----------- WAN 側ネットワーク ----------| gw2.example.com |
   +----------------+       IPsec(IKEv2 / ESP トンネル)     +----------------+
項目拠点 1拠点 2
IPsec の終端アドレス(WAN 側)192.168.1.254192.168.1.10
ID(FQDN)gw1.example.comgw2.example.com
IPsec で接続するサブネット(LAN 側)192.168.0.0/24192.168.10.0/24
IKE 設定名/SA 設定名ike01 / sa01ike01 / sa01
手順

拠点 1 の本製品での手順を示します。拠点 2 では、アドレス、ID、サブネットを入れ替えて設定します(「完成した設定」を参照)。

  1. 設定モードに移行し、IKE の詳細設定モードに移行します。

    amnimo# configure
    amnimo(cfg)# ipsec ike ike01
    amnimo(cfg-ips-ike-ike01)#
  2. 自分(local)と相手(remote)のアドレスと ID を設定します。ID は、相手側の設定の remote id / local id と一致させます。

    amnimo(cfg-ips-ike-ike01)# local address 192.168.1.254
    amnimo(cfg-ips-ike-ike01)# local id fqdn gw1.example.com
    amnimo(cfg-ips-ike-ike01)# remote address 192.168.1.10
    amnimo(cfg-ips-ike-ike01)# remote id fqdn gw2.example.com
  3. IKE のバージョン、認証方式、トランスフォーム(暗号アルゴリズムの組み合わせ)、ライフタイムを設定します。

    amnimo(cfg-ips-ike-ike01)# version 2
    amnimo(cfg-ips-ike-ike01)# authentication pre-shared-key secret dGVzdA==
    amnimo(cfg-ips-ike-ike01)# transform encryption aes128 integrity sha256 prf sha256 dh-group 14
    amnimo(cfg-ips-ike-ike01)# lifetime 3h
    • 事前共有鍵は、両拠点で同じ値にします。secret の後には、事前共有鍵を暗号化した文字列を指定します。設定済みの機器では、show config ipsec ike の authentication pre-shared-key secret の行で確認できます。dGVzdA== は『6.7』の実行例と同じ値の例です。必ずお客様の事前共有鍵に置き換えてください。
    • transform は最大 4 つまで設定できます。両拠点に、共通するトランスフォームを設定してください。
  4. DPD(Dead Peer Detection)を設定し、IKE の設定を終了します。dpd action restart は、相手の応答がなくなって SA 情報を削除した後に、IKE ネゴシエーションを開始し直す設定です。

    amnimo(cfg-ips-ike-ike01)# dpd action restart
    amnimo(cfg-ips-ike-ike01)# dpd interval 150s
    amnimo(cfg-ips-ike-ike01)# dpd timeout 30s
    amnimo(cfg-ips-ike-ike01)# exit
    amnimo(cfg)#
  5. SA の詳細設定モードに移行し、使用する IKE、接続動作、プロトコル、通信モードを設定します。negotiation-mode initiate は、自分から接続を開始する設定です。どの設定でも、相手から接続を開始された場合は、可能であれば応答側として動作します。

    amnimo(cfg)# ipsec sa sa01
    amnimo(cfg-ips-sa-sa01)# key-exchange ike ike01
    amnimo(cfg-ips-sa-sa01)# negotiation-mode initiate
    amnimo(cfg-ips-sa-sa01)# rekey
    amnimo(cfg-ips-sa-sa01)# type esp
    amnimo(cfg-ips-sa-sa01)# mode tunnel
  6. トランスフォーム、ライフタイム、暗号化する通信のサブネットを設定し、SA を有効にします。

    amnimo(cfg-ips-sa-sa01)# transform encryption aes128 integrity sha256 pfs 14
    amnimo(cfg-ips-sa-sa01)# lifetime 1h
    amnimo(cfg-ips-sa-sa01)# local subnet 192.168.0.0/24
    amnimo(cfg-ips-sa-sa01)# remote subnet 192.168.10.0/24
    amnimo(cfg-ips-sa-sa01)# enable
    amnimo(cfg-ips-sa-sa01)# exit
    amnimo(cfg)#
  7. 設定を保存します。

    amnimo(cfg)# config file save

各コマンドの詳細は、次の節を参照してください。

完成した設定

それぞれの本製品の管理者モード(amnimo#)で貼り付けます。secret の値は、お客様の事前共有鍵(両拠点で同じ値)に置き換えてください。

拠点 1(192.168.1.254、gw1.example.com):

configure
ipsec ike ike01
local address 192.168.1.254
local id fqdn gw1.example.com
remote address 192.168.1.10
remote id fqdn gw2.example.com
version 2
authentication pre-shared-key secret dGVzdA==
transform encryption aes128 integrity sha256 prf sha256 dh-group 14
lifetime 3h
dpd action restart
dpd interval 150s
dpd timeout 30s
exit
ipsec sa sa01
key-exchange ike ike01
negotiation-mode initiate
rekey
type esp
mode tunnel
transform encryption aes128 integrity sha256 pfs 14
lifetime 1h
local subnet 192.168.0.0/24
remote subnet 192.168.10.0/24
enable
exit
config file save

拠点 2(192.168.1.10、gw2.example.com):

configure
ipsec ike ike01
local address 192.168.1.10
local id fqdn gw2.example.com
remote address 192.168.1.254
remote id fqdn gw1.example.com
version 2
authentication pre-shared-key secret dGVzdA==
transform encryption aes128 integrity sha256 prf sha256 dh-group 14
lifetime 3h
dpd action restart
dpd interval 150s
dpd timeout 30s
exit
ipsec sa sa01
key-exchange ike ike01
negotiation-mode initiate
rekey
type esp
mode tunnel
transform encryption aes128 integrity sha256 pfs 14
lifetime 1h
local subnet 192.168.10.0/24
remote subnet 192.168.0.0/24
enable
exit
config file save
ほかの機能と組み合わせる場合

IPsec の設定ページ(6.7)には、パケットフィルタリングや NAT の設定は含まれていません。次の設定をしている場合は、あわせて設定を見直してください。

合致条件の書式は『6.6.2 パケット合致条件を設定する』を参照してください。

確認方法
  1. IKE と SA の設定を表示します(6.7.4 IPsecの設定を表示する)。

    amnimo# show config ipsec ike ike01
    amnimo# show config ipsec sa sa01
    • 見どころ: 両拠点で、アドレスと ID が互いに逆になっていること。トランスフォーム、version が一致していること。SA が enable で、local subnet と remote subnet が互いに逆になっていること。
  2. IPsec のステータスを表示します(6.7.1 IPsecのステータスを表示する)。

    amnimo# show ipsec status sa01

    正常に接続している場合の表示例(拠点 1。6.7.1 の実行例から sa01 に関係する行を抜粋):

    Connections:
            sa01:  192.168.1.254...192.168.1.10  IKEv2, dpddelay=150s
            sa01:   local:  [gw1.example.com] uses pre-shared key authentication
            sa01:   remote: [gw2.example.com] uses pre-shared key authentication
            sa01:   child:  192.168.0.0/24 === 192.168.10.0/24 TUNNEL, dpdaction=restart
    Security Associations (1 up, 0 connecting):
            sa01[1]: ESTABLISHED 10 seconds ago, 192.168.1.254[gw1.example.com]...192.168.1.10[gw2.example.com]
            sa01[1]: IKE proposal: AES_CBC_128/HMAC_SHA2_256_128/PRF_HMAC_SHA2_256/MODP_2048
            sa01{1}:  INSTALLED, TUNNEL, reqid 1, ESP SPIs: cee4939e_i ca99e852_o
            sa01{1}:  AES_CBC_128/HMAC_SHA2_256_128/MODP_2048, 0 bytes_i, 0 bytes_o, rekeying in 43 minutes
            sa01{1}:   192.168.0.0/24 === 192.168.10.0/24
    行見どころ
    Security Associations (1 up, 0 connecting)up の数が 1 以上であること。0 up のままの場合は、IKE が確立していません。
    sa01[1]: ESTABLISHEDIKE(鍵交換)が確立していること。両端のアドレスと ID が正しいこと。
    IKE proposal:合意した IKE の暗号アルゴリズム。AES_CBC_128、SHA2_256、MODP_2048 であること。
    sa01{1}: INSTALLED, TUNNELSA(暗号化する通信)が確立していること。
    192.168.0.0/24 === 192.168.10.0/24暗号化する通信のサブネットが正しいこと。
    bytes_i、bytes_o受信・送信したバイト数。通信すると増えます。
  3. 拠点 1 の LAN の端末から、拠点 2 の LAN の端末に ping を実行し、応答があることを確認します。その後、もう一度 show ipsec status sa01 を実行し、bytes_i、bytes_o が増えていることを確認します。
よくある失敗
症状確認すること
0 up のまま、ESTABLISHED にならない両拠点の WAN 側のアドレスどうしで通信できるか。remote address と remote id が相手側の local address と local id に一致しているか。事前共有鍵が両拠点で同じか。version とトランスフォームが一致しているか。input のデフォルトポリシーを drop にしている場合は、IKE と ESP を許可しているか。
ESTABLISHED になるが、INSTALLED にならないSA のトランスフォーム(PFS を含む)と、local subnet/remote subnet が、両拠点で対応しているか。
INSTALLED になるが、LAN の端末どうしで通信できない端末のゲートウェイが本製品になっているか。動的SNAT で、対向の LAN 宛ての通信が変換されていないか。

詳しい切り分けは『G3.3 IPsecがつながらない』を参照してください。IPsec のログの詳細度は、『ログレベルを設定する』で変更できます。