古河電工ネットワーク機器の総合ブランド ファイテルネット
古河電工
FITELnetトップ製品ラインナップイベント&セミナーセールス&サポート
Routing to the Future FITELnet
お問い合わせはこちら
 
設定例
Amazon Virtual Private Cloud (Amazon VPC) とVPN接続する
概要
Amazon Virtual Private Cloud(Amazon VPC)に接続するための設定例です。
補足・注意点
Amazon Virtual Private Cloud(Amazon VPC)では、Amazon Web Services(AWS)Cloud のプライベートで孤立したセクションをプロビジョンすることができます。
詳細はWebで提供されている技術資料をご覧ください。
構成図
Amazon VPCの設定

下記の文書にしたがってAmazon VPCを設定します。

http://docs.amazonwebservices.com/AmazonVPC/latest/GettingStartedGuide/


以下、主要な設定画面について説明していきます

1.VPCタブを選択・リージョンを選択

VPC等はリージョンごとに独立しています。
AWS Management Console上から実行するウィザードで基本的な設定はほとんど行うことができます。

設定画面#1

2.「Amazon VPC Console Dashboard」から「Get started creating a VPC」というボタンを押す。

設定画面#2

3.ネットワーク構成の選択

「VPC with a Private Subnet Only and Hardware VPN Access」を選び、「Continue」ボタンを押します。

設定画面#3

4.ルーターのIPアドレスの設定

VPN接続のためのユーザ側アドレスの入力を求められるので、「Customer Gateway:」にルータのEWAN側IPアドレスを入力し、「Continue」ボタンを押します。

設定画面#4

5.設定の確認

VPCとVPN接続の設定確認が表示されるので、問題がなければ「CreateVPC」ボタンを押します。

設定画面#5

6.VPCの生成

VPCとVPN接続の生成処理が行われ、完了画面が表示されます。
「Download Configuration」ボタンを押して、カスタマー側のルータに適用する設定をダウンロードします。

設定画面#6

7.設定のダウンロード

VPN接続作成のウィザードの最後に、カスタマー側のルータに適用する設定を「Yes, Download」ボタンを押して、ダウンロードします。
「Vender:」は「Generic」を選択してください。
確認済みメーカー(Cisco/Juniper/Yamaha)用の設定は各社のコンフィグ形式に合わせたものがダウンロードできますが、IKE, IPsec, Tunnel, BGPといった必須となる構成要素の部分だけの設定となりますので、手動での調整が必要です。
Generic用設定がテキスト形式ファイルでダウンロードできるので、作業用PCに保存して内容を確認してください。

注意点
・Pre-Shared Key:IKE SAの事前共有鍵(テキスト形式)
                  Amazon側のVPN接続を作りなおすたびに変更されます。
・ Outside IP Address:SAを張るアドレス
    “ Virtual Private Gateway”がSAのピアとなるAmazon側のアドレス
    “Customer Gateway”はF200のWAN側アドレスが入っています。
・ Inside IP Address:IPsecインターフェイスのアドレス
    “Customer Gateway”がF200のIPsecインターフェイスに設定すべきアドレス

設定画面#7

8.Amazon VPC側設定完了確認

VPC設定画面-VPN Connections で確認できます。 ※下記画面は、ルータ側が未設定のためDOWN状態となっています。

設定画面#8
ルータ設定の例
ルータへの設定パラメータはダウンロードしたGeneric用設定の内容を適用する必要があります。
IPsec設定 〜Phase1〜
認証方式:Pre-Shared Key
事前共有鍵の形式:プレインテキスト
認証アルゴリズム:SHA-1
暗号化アルゴリズム:AES-128-CBC
ネゴシエーションモード:Main
DH group:Group 2
ライフタイム:28800 sec
Pre-Shared Key:Amazon側のVPN接続を作りなおすたびに変更されます。
VPNピア IPアドレス:Virtual Private Gatewayを指定します。
crypto isakmp policy 1
 authentication prekey
 encryption aes 128
 group 2
 hash sha
 key ascii ********************************
 lifetime 28800
 negotiation-mode main
 peer-identity address 27.0.1.16
exit
crypto isakmp policy 2
 authentication prekey
 encryption aes 128
 group 2
 hash sha
 key ascii ################################
 lifetime 28800
 negotiation-mode main
 peer-identity address 27.0.1.144
exit
IPsec設定 〜VPNセレクタ・Phase2・IPsecif〜
認証方式:Pre-Shared Key
事前共有鍵の形式:プレインテキスト
認証アルゴリズム:SHA-1
暗号化アルゴリズム:AES-128-CBC
ネゴシエーションモード:Main
DH group:Group 2
ライフタイム:28800 sec
IPsecインターフェイスのアドレス:Inside IP AddressのCustomer Gatewayを指定します。

(以下、推奨設定)
・DPDを有効にする
    Interval:10 sec
    リトライ回数:3
・その他
    TCP MSS Adjustment:1396 bytes
    DFビット消去:有効
    フラグメント:暗号化の前(pre-fragment)
ipsec access-list 1 ipsec ip any any
ipsec access-list 2 ipsec ip any any
ipsec access-list 64 bypass ip any any
ipsec transform-set AES128-SHA esp-aes-128 esp-sha-hmac

crypto map MAP1 1
 match address 1
 set peer address 27.0.1.16
 set security-association lifetime seconds 3600
 set security-association always-up
 set transform-set AES128-SHA
exit
crypto map MAP2 2
 match address 2
 set peer address 27.0.1.144
 set security-association lifetime seconds 3600
 set security-association always-up
 set transform-set AES128-SHA
exit
crypto security-association
 ikealive retry max 3
 ikealive retry timer 10
 ikealive freq 10
exit

interface ipsecif 1
 crypto map MAP1
 ip address 169.254.252.18 255.255.255.252
 ip mtu 1390
exit
interface ipsecif 2
 crypto map MAP2
 ip address 169.254.252.22 255.255.255.252
 ip mtu 1390
exit
BGP設定
・カスタマー側ネットワークとVPC側ネットワークの経路交換に使用されます。
・トンネル内で、トンネルの内側のIPアドレスを用いてピアを張ります。
・一方のトンネルが障害等によりダウンすると、もう一方のトンネルに経路が切り替わります。

設定パラメータ(Generic設定ファイルより)
  カスタマーゲートウェイのASN:65000
  仮想プライベートゲートウェイのASN:10124
  ネイバーのIPアドレス:169.254.252.17, 169.254.252.21
  ネイバーのHold Time:30 sec
  default-originate でデフォルト経路広告
  soft-reconfiguration inbound

BGP設定
interface loopback 1		# ループバックのアドレスはBGPのrouter-idとして使用する
 ip address 192.168.100.254
exit

router bgp 65000
 bgp router-id 192.168.100.254		# Loopback1に設定したアドレスに設定
 neighbor 169.254.252.17 activate enable
 neighbor 169.254.252.17 default-originate
 neighbor 169.254.252.17 ebgp-multihop
 neighbor 169.254.252.17 remote-as 10124
 neighbor 169.254.252.17 soft-reconfiguration inbound
 neighbor 169.254.252.17 timers 10 30
 neighbor 169.254.252.21 activate enable
 neighbor 169.254.252.21 default-originate
 neighbor 169.254.252.21 ebgp-multihop
 neighbor 169.254.252.21 remote-as 10124
 neighbor 169.254.252.21 soft-reconfiguration inbound
 neighbor 169.254.252.21 timers 10 30
 network 192.168.100.0 255.255.255.0
exit

9.Amazon VPCへのVPN接続確立

VPN接続が確立するとStatusがUPの状態になります。

VPN接続確立

10.ルーティング情報確認

IPsec SAが確立しBGPセッションも確立すると、自分のVPCへの経路がBGPで広告されます。
NexthopはIPsecトンネルのAmazon側端点となります。

CGW-F200#show ip route
Max entry: 10000 (Commonness in IPv4 and IPv6)
Active entry:7 (IPv4), 2 (IPv6)  Peak:7

Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF
       B - BGP, I - IKE, U - SA-UP, D - REDUNDANCY, E - EventAction
       A - AutoConfig, > - selected route, * - FIB route, p - stale info.

B> * 10.0.0.0/16 [20/0] via 169.254.252.17, IPSECIF1, 00:11:56
S> * 27.0.1.16/32 [1/0] via 218.xx.xx.xx, EWAN1
S> * 27.0.1.144/32 [1/0] via 218.xx.xx.xx, EWAN1
C> * 127.0.0.0/8 is directly connected, LOOP0
C> * 169.254.252.16/30 is directly connected, IPSECIF1
C> * 169.254.252.20/30 is directly connected, IPSECIF2

10.疎通確認

ルータ配下のPCより、Amazon VPCのインスタンスへのPINGによる疎通確認をおこないます。
インスタンスの起動の仕方については、Amazon VPCの技術情報を参照してください。 PING疎通確認先はインスタンスが持つアドレス(プライベートアドレス)となります。

C:\Users\st>ping 10.0.1.10

10.0.1.10 に ping を送信しています 32 バイトのデータ:
10.0.1.10 からの応答: バイト数 =32 時間 =12ms TTL=61
10.0.1.10 からの応答: バイト数 =32 時間 =9ms TTL=61
10.0.1.10 からの応答: バイト数 =32 時間 =9ms TTL=61
10.0.1.10 からの応答: バイト数 =32 時間 =11ms TTL=61

10.0.1.10 の ping 統計:
    パケット数: 送信 = 4、受信 = 4、損失 = 0 (0% の損失)、
ラウンド トリップの概算時間 (ミリ秒):
    最小 = 9ms、最大 = 12ms、平均 = 10ms

11.トンネル冗長 切り替わりの確認

11-1.正常時

トンネル冗長の切り替わり

正常時(トンネル2本up)の経路情報

CGW-F200#show ip route
Max entry: 10000 (Commonness in IPv4 and IPv6)
Active entry:7 (IPv4), 2 (IPv6)  Peak:7

Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF
       B - BGP, I - IKE, U - SA-UP, D - REDUNDANCY, E - EventAction
       A - AutoConfig, > - selected route, * - FIB route, p - stale info.

B> * 10.0.0.0/16 [20/0] via 169.254.252.17, IPSECIF1, 00:02:36  ←VPC宛ての経路がTunnel#1を向いています。
S> * 27.0.1.16/32 [1/0] via 218.xx.xx.xx, EWAN1
S> * 27.0.1.144/32 [1/0] via 218.xx.xx.xx, EWAN1
C> * 127.0.0.0/8 is directly connected, LOOP0
C> * 169.254.252.16/30 is directly connected, IPSECIF1
C> * 169.254.252.20/30 is directly connected, IPSECIF2
C> * 192.168.100.0/24 is directly connected, LAN

11-2.Tunnel#1 障害発生時

discard crypto isakmp idコマンドを実行して、Amazon VPCへの経路に使用されているIPsecトンネル(Tunnel#1)を強制的にdownさせます。

トンネル冗長の切り替わり

Tunnel#1 down後のBGPネイバ状態

Router#show ip bgp summary
BGP router identifier 192.168.100.254, local AS number 10124
  BGP AS-PATH entries
  BGP community entries

 
Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
169.254.252.17  4 10124      25      33        0    0    0 00:00:23 Active  ←Tunnel#1側のBGPがdownします。
169.254.252.21  4 10124      34      36        0    0    0 00:04:37        1

Tunnel#1 down後の経路情報

CGW-F200#show ip route
Max entry: 10000 (Commonness in IPv4 and IPv6)
Active entry:6 (IPv4), 2 (IPv6)  Peak:7

Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF
       B - BGP, I - IKE, U - SA-UP, D - REDUNDANCY, E - EventAction
       A - AutoConfig, > - selected route, * - FIB route, p - stale info.

B> * 10.0.0.0/16 [20/0] via 169.254.252.21, IPSECIF2, 00:00:54 ←VPC宛ての経路がTunnel#2に切り替わります。
S> * 27.0.1.16/32 [1/0] via 218.xx.xx.xx, EWAN1
S> * 27.0.1.144/32 [1/0] via 218.xx.xx.xx, EWAN1
C> * 127.0.0.0/8 is directly connected, LOOP0
C> * 169.254.252.20/30 is directly connected, IPSECIF2
C> * 192.168.100.0/24 is directly connected, LAN

11-3.Tunnel#1 復旧

no discard crypto isakmpコマンドを実行して、Amazon VPCへの経路に使用されているIPsecトンネル(Tunnel#1)を復旧させます。

Tunnel#1 復旧後のBGPネイバ状態

Router#show ip bgp summary
BGP router identifier 192.168.100.254, local AS number 10124
  BGP AS-PATH entries
  BGP community entries

 Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
169.254.252.17  4 10124      36      45        0    0    0 00:00:57        1 ←Tunnel#1側のBGPがUPします。
169.254.252.21  4 10124      46      48        0    0    0 00:06:29        1

Tunnel#1 復旧後の経路情報

CGW-F200#show ip route
Max entry: 10000 (Commonness in IPv4 and IPv6)
Active entry:7 (IPv4), 2 (IPv6)  Peak:7

Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF
       B - BGP, I - IKE, U - SA-UP, D - REDUNDANCY, E - EventAction
       A - AutoConfig, > - selected route, * - FIB route, p - stale info.

B> * 10.0.0.0/16 [20/0] via 169.254.252.21, IPSECIF2, 00:02:45←VPC宛ての経路はTunnel#2向きのまま
S> * 27.0.1.16/32 [1/0] via 218.xx.xx.xx, EWAN1
S> * 27.0.1.144/32 [1/0] via 218.xx.xx.xx, EWAN1
C> * 127.0.0.0/8 is directly connected, LOOP0
C> * 169.254.252.16/30 is directly connected, IPSECIF1
C> * 169.254.252.20/30 is directly connected, IPSECIF2
C> * 192.168.100.0/24 is directly connected, LAN

11-4.Tunnel#2 障害発生時

discard crypto isakmpコマンドを実行して、Amazon VPCへの経路に使用されているIPsecトンネル(Tunnel#2)を強制的にdownさせます。

Tunnel#2 down後のBGPネイバ状態

Router#show ip bgp summary
BGP router identifier 192.168.100.254, local AS number 10124
  BGP AS-PATH entries
  BGP community entries

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
169.254.252.17  4 10124      76      85        0    0    0 00:07:16        1
169.254.252.21  4 10124      80      85        0    0    0 00:00:18 Active ←Tunnel#2側のBGPがdownします。

Tunnel#2 down後の経路情報

CGW-F200#show ip route
Max entry: 10000 (Commonness in IPv4 and IPv6)
Active entry:6 (IPv4), 2 (IPv6)  Peak:7

Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF
       B - BGP, I - IKE, U - SA-UP, D - REDUNDANCY, E - EventAction
       A - AutoConfig, > - selected route, * - FIB route, p - stale info.

B> * 10.0.0.0/16 [20/0] via 169.254.252.17, IPSECIF1, 00:00:35 ←VPC宛ての経路がTunnel#1に切り替わります。
S> * 27.0.1.16/32 [1/0] via 218.xx.xx.xx, EWAN1
S> * 27.0.1.144/32 [1/0] via 218.xx.xx.xx, EWAN1
C> * 127.0.0.0/8 is directly connected, LOOP0
C> * 169.254.252.16/30 is directly connected, IPSECIF1
C> * 192.168.100.0/24 is directly connected, LAN

11-5.Tunnel#2 復旧

no discard crypto isakmpコマンドを実行して、Amazon VPCへの経路に使用されているIPsecトンネル(Tunnel#2)を復旧させます。

Tunnel#2 復旧後のBGPネイバ状態

Router#show ip bgp summary
BGP router identifier 192.168.100.254, local AS number 10124
  BGP AS-PATH entries
  BGP community entries

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
169.254.252.17  4 10124      88      97        0    0    0 00:09:08        1
169.254.252.21  4 10124      90      95        0    0    0 00:00:48        1 ←Tunnel#2側のBGPがupします。

Tunnel#2 復旧後の経路情報

CGW-F200#show ip route
Max entry: 10000 (Commonness in IPv4 and IPv6)
Active entry:7 (IPv4), 2 (IPv6)  Peak:7

Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF
       B - BGP, I - IKE, U - SA-UP, D - REDUNDANCY, E - EventAction
       A - AutoConfig, > - selected route, * - FIB route, p - stale info.

B> * 10.0.0.0/16 [20/0] via 169.254.252.17, IPSECIF1, 00:02:29 ←VPC宛ての経路はTunnel#1向きのまま
S> * 27.0.1.16/32 [1/0] via 218.xx.xx.xx, EWAN1
S> * 27.0.1.144/32 [1/0] via 218.xx.xx.xx, EWAN1
C> * 127.0.0.0/8 is directly connected, LOOP0
C> * 169.254.252.16/30 is directly connected, IPSECIF1
C> * 169.254.252.20/30 is directly connected, IPSECIF2
C> * 192.168.100.0/24 is directly connected, LAN

ページトップへ

All Rights Reserved, Copyright(C) FURUKAWA ELECTRIC CO., LTD. 2013