9
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

OCI IPSec VPN Ciscoルータを使用した冗長構成の検証

Last updated at Posted at 2022-07-05

概要

パブリッククラウドへのネットワーク接続手段は様々な方法がありますが、オンプレDCやオフィスから安価に安全にLAN-to-LAN接続する方法としてルータを使用したIPSec VPNが挙げられます。IPSec VPNはオンプレにルータを1台設置して構築するだけでなく、可用性を高めるため冗長構成を構築することも可能です。
今回はパブリッククラウド接続先はOracle Cloud(OCI), オンプレ側をルータ2台設置して冗長構成を検証しました。

検証構成

image.png

【OCI】

【オンプレ】

  • CPE IPSecルータ Cisco892J 2台
     IPSecパラメータはこちらを参考にしました
    https://docs.oracle.com/ja-jp/iaas/Content/Network/Reference/ciscoiosCPE.htm
  • Internet回線 1回線
     2回線準備できなかったためNATルータを設置してCisco892J 2台はNAT配下に設置しました
      OCIはCPEがNAT配下にあってもIPSec構築可能です。Internet回線が2回線または2Global IP準備可能であればNATルータは不要です

構成のポイント

  • IPSecはIKEV2でルーティングはBGPを使用します。
  • OCIは1CPEあたり2VPN作成されます。2CPE構成の場合合計4VPN作成されます。VPN上でBGPを稼働させますがデフォルトでは当コストになるため非対称ルーティングになる可能性が高いです。オンプレでBGPを構成する場合は優先制御でMED値を使うことがありますが、OCIではMED値設定ではなくAS Path prependを使用することができるため、今回はこの方法を採用してIPSecrouter1(Active)を常に優先するようルーティング制御を行います。
    (NetworkSEとしては非対称ルーティングはやはり気になりますので改善方法あるのはありがたいです..)
  • IPSec断を検知するためDPDを設定します。これがないとインターネット上で通信断が発生してもIPSecでは検知できないため通信が回復してもIPSec通信が回復せずBGP再確立しませんでした。
  • CPEからOCIへのルート配布は必要なセグメントのみとしています。この辺は通信要件によって変わると思います。
  • CPE2台の間はHSRPを設定します。
  • CPEからOCIに通信する際のMSSを検証環境の制約で1350に設定しています。こちらは通信環境によって異なるためフラグメントを発生させない範囲で適切な値を設定していただければと思います。

検証結果

  • 通常時のOCI側ルーティングテーブルは優先ルート1(K-IPSec11-tun1)からのルートが採用されています。
    image.png
  • 通常時においてはIPSecrouter1(Active)の優先ルート1を経由して通信します。
  • OCI側の原因で優先ルート1が消失した場合は優先ルート2に迂回して通信が可能です。
  • IPSecrouter1(Active)がHW障害の場合はIPSecrouter2(Standby)に迂回して優先ルート3に迂回して通信が可能です。

Ciscoルータ サンプル

【注意】
IPSecパラメータの一部(認証アルゴリズム SHA-1)はサポート対象外のため変更が必要です。
変更前
crypto ipsec transform-set oracle-vpn-transform esp-aes 256 esp-sha-hmac
mode tunnel
変更後
crypto ipsec transform-set oracle-vpn-transform esp-aes 256 esp-sha256-hmac
mode tunnel

サポートされているIPSecパラメータ

Activeルータ IPSecrouter1 configサンプル

#暗号化設定

crypto ikev2 proposal oracle_v2_proposal
encryption aes-cbc-256
integrity sha384
group 5
!
crypto ikev2 policy oracle_v2_policy
proposal oracle_v2_proposal
!
crypto ikev2 keyring oci-keyring1
peer OCI_Global_IP1
address OCI_Global_IP1
pre-shared-key local シークレットキー
pre-shared-key remote シークレットキー
!
!
crypto ikev2 keyring oci-keyring2
peer OCI_Global_IP2
address OCI_Global_IP2
pre-shared-key local シークレットキー
pre-shared-key remote シークレットキー
!
!
crypto ikev2 profile oracle-vpn-OCI_Global_IP1
match identity remote address OCI_Global_IP1 255.255.255.255
identity local address 192.168.100.201
authentication remote pre-share
authentication local pre-share
keyring local oci-keyring1
lifetime 28800
dpd 10 5 on-demand
!
crypto ikev2 profile oracle-vpn-OCI_Global_IP2
match identity remote address OCI_Global_IP2 255.255.255.255
identity local address 192.168.100.201
authentication remote pre-share
authentication local pre-share
keyring local oci-keyring2
lifetime 28800
dpd 10 5 on-demand
!
crypto ipsec security-association replay window-size 128
!
crypto ipsec transform-set oracle-vpn-transform esp-aes 256 esp-sha-hmac
mode tunnel
crypto ipsec df-bit clear
!
!
crypto ipsec profile oracle_v2_ipsec_profile_tunnel1
set transform-set oracle-vpn-transform
set pfs group5
set ikev2-profile oracle-vpn-OCI_Global_IP1
!
crypto ipsec profile oracle_v2_ipsec_profile_tunnel2
set transform-set oracle-vpn-transform
set pfs group5
set ikev2-profile oracle-vpn-OCI_Global_IP2
!

#GRE設定

interface Tunnel1
ip address 192.168.2.2 255.255.255.252
ip virtual-reassembly in
ip tcp adjust-mss 1350
#mssはインターネット種類や暗号化パラメータによって異なります。
#フラグメントが発生する場合はさらに小さい値をご検討ください
tunnel source 192.168.100.201
tunnel mode ipsec ipv4
tunnel destination OCI_Global_IP1
tunnel protection ipsec profile oracle_v2_ipsec_profile_tunnel1
!
interface Tunnel2
ip address 192.168.2.6 255.255.255.252
ip virtual-reassembly in
ip tcp adjust-mss 1350
#mssはインターネット種類や暗号化パラメータによって異なります。
#フラグメントが発生する場合はさらに小さい値をご検討ください
tunnel source 192.168.100.201
tunnel mode ipsec ipv4
tunnel destination OCI_Global_IP2
tunnel protection ipsec profile oracle_v2_ipsec_profile_tunnel2
!
#Interface設定

track 1 interface GigabitEthernet0 line-protocol
!
interface FastEthernet8
description LAN
ip address 192.168.1.2 255.255.255.0
standby 1 ip 192.168.1.1
standby 1 priority 110
standby 1 preempt
standby 1 track 1 decrement 30
duplex auto
speed auto
!
interface GigabitEthernet0
ip address 192.168.100.201 255.255.255.0
duplex auto
speed auto
!

#BGP設定

router bgp 64513
bgp log-neighbor-changes
redistribute connected
redistribute static
neighbor 192.168.1.3 remote-as 64513
neighbor 192.168.2.1 remote-as 31898
neighbor 192.168.2.1 ebgp-multihop 255
neighbor 192.168.2.1 soft-reconfiguration inbound
neighbor 192.168.2.1 distribute-list 10 out

neighbor 192.168.2.5 remote-as 31898
neighbor 192.168.2.5 ebgp-multihop 255
neighbor 192.168.2.5 soft-reconfiguration inbound
neighbor 192.168.2.5 distribute-list 20 out
neighbor 192.168.2.5 route-map routemap-2-in in
neighbor 192.168.2.5 route-map routemap-2-out out
!

route-map routemap-2-in permit 10
set as-path prepend 31898
!
route-map routemap-2-out permit 10
set as-path prepend 64513
!
!
access-list 10 permit 192.168.1.0 0.0.0.255
access-list 10 permit 192.168.2.0 0.0.0.3
access-list 10 deny any
access-list 20 permit 192.168.1.0 0.0.0.255
access-list 20 permit 192.168.2.4 0.0.0.3
access-list 20 deny any
!

#ルーティング

ip route 0.0.0.0 0.0.0.0 192.168.100.1
!

Standbyルータ IPSecrouter2 configサンプル

#暗号化設定

crypto ikev2 proposal oracle_v2_proposal
encryption aes-cbc-256
integrity sha384
group 5
!
crypto ikev2 policy oracle_v2_policy
proposal oracle_v2_proposal
!
crypto ikev2 keyring oci-keyring1
peer OCI_Global_IP3
address OCI_Global_IP3
pre-shared-key local シークレットキー
pre-shared-key remote シークレットキー
!
!
crypto ikev2 keyring oci-keyring2
peer OCI_Global_IP4
address OCI_Global_IP4
pre-shared-key local シークレットキー
pre-shared-key remote シークレットキー
!
!
crypto ikev2 profile oracle-vpn-OCI_Global_IP1
match identity remote address OCI_Global_IP1 255.255.255.255
identity local address 192.168.100.202
authentication remote pre-share
authentication local pre-share
keyring local oci-keyring1
lifetime 28800
dpd 10 5 on-demand
!
crypto ikev2 profile oracle-vpn-OCI_Global_IP2
match identity remote address OCI_Global_IP2 255.255.255.255
identity local address 192.168.100.202
authentication remote pre-share
authentication local pre-share
keyring local oci-keyring2
lifetime 28800
dpd 10 5 on-demand
!
crypto ipsec security-association replay window-size 128
!
crypto ipsec transform-set oracle-vpn-transform esp-aes 256 esp-sha-hmac
mode tunnel
crypto ipsec df-bit clear
!
!
crypto ipsec profile oracle_v2_ipsec_profile_tunnel1
set transform-set oracle-vpn-transform
set pfs group5
set ikev2-profile oracle-vpn-OCI_Global_IP3
!
crypto ipsec profile oracle_v2_ipsec_profile_tunnel2
set transform-set oracle-vpn-transform
set pfs group5
set ikev2-profile oracle-vpn-OCI_Global_IP4
!

#GRE設定

interface Tunnel1
ip address 192.168.2.10 255.255.255.252
ip virtual-reassembly in
ip tcp adjust-mss 1350
#mssはインターネット種類や暗号化パラメータによって異なります。
#フラグメントが発生する場合はさらに小さい値をご検討ください
tunnel source 192.168.100.202
tunnel mode ipsec ipv4
tunnel destination OCI_Global_IP3
tunnel protection ipsec profile oracle_v2_ipsec_profile_tunnel1
!
interface Tunnel2
ip address 192.168.2.14 255.255.255.252
ip virtual-reassembly in
ip tcp adjust-mss 1350
#mssはインターネット種類や暗号化パラメータによって異なります。
#フラグメントが発生する場合はさらに小さい値をご検討ください
tunnel source 192.168.100.202
tunnel mode ipsec ipv4
tunnel destination OCI_Global_IP4
tunnel protection ipsec profile oracle_v2_ipsec_profile_tunnel2
!

#Interface設定

track 1 interface GigabitEthernet0 line-protocol
!
interface FastEthernet8
description LAN
ip address 192.168.1.3 255.255.255.0
standby 1 ip 192.168.1.1

standby 1 preempt
standby 1 track 1 decrement 30
duplex auto
speed auto
!
interface GigabitEthernet0
ip address 192.168.100.202 255.255.255.0
duplex auto
speed auto
!

#BGP設定

router bgp 64513
bgp log-neighbor-changes
redistribute connected
redistribute static
neighbor 192.168.1.2 remote-as 64513
neighbor 192.168.2.9 remote-as 31898
neighbor 192.168.2.9 ebgp-multihop 255
neighbor 192.168.2.9 soft-reconfiguration inbound
neighbor 192.168.2.9 distribute-list 10 out
neighbor 192.168.2.9 route-map routemap-3-in in
neighbor 192.168.2.9 route-map routemap-3-out out
neighbor 192.168.2.13 remote-as 31898
neighbor 192.168.2.13 ebgp-multihop 255
neighbor 192.168.2.13 soft-reconfiguration inbound
neighbor 192.168.2.13 distribute-list 20 out
neighbor 192.168.2.13 route-map routemap-4-in in
neighbor 192.168.2.13 route-map routemap-4-out out
!

route-map routemap-3-in permit 10
set as-path prepend 31898 31898
!
route-map routemap-3-out permit 10
set as-path prepend 64514 64514
!
route-map routemap-4-in permit 10
set as-path prepend 31898 31898 31898
!
route-map routemap-4-out permit 10
set as-path prepend 64514 64514 64514
!
!
access-list 10 permit 192.168.1.0 0.0.0.255
access-list 10 permit 192.168.2.8 0.0.0.3
access-list 10 deny any
access-list 20 permit 192.168.1.0 0.0.0.255
access-list 20 permit 192.168.2.12 0.0.0.3
access-list 20 deny any
!

#ルーティング

ip route 0.0.0.0 0.0.0.0 192.168.100.1
!

9
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?