0
0

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 3 years have passed since last update.

Transit Gatewayを使ってAWS Site-to-Site VPNを構築

Posted at

オンプレミス(オンプレミスと見立てたVPC)とAWSを拠点間VPNで接続する環境を構築する。
オンプレミスのVPNサーバーはWindows Serverで構築する。
参考資料では、仮想プライベートゲートウェイを使って拠点間VPNを構築していたが、代わりにTransit Gatewayを使って作成してみた。

参考

環境

以下のような環境を構築する。

Untitled Diagram.png

  • オンプレミス
  • ネットワーク - 172.31.0.0/16
  • ルートテーブルの設定 - 0.0.0.0/0 Internet Gateway, 172.31.0.0/16 VPNサーバー, 172.31.0.0/16 local
  • セキュリティグループ - ICMP、RDPを許可する。
  • VPNサーバー - Windows Server 2019
  • AWS
  • ネットワーク - 10.0.0.0/16
  • ルートテーブルの設定 - 172.31.0.0/16 Transit Gateway, 10.0.0.0/16 local
  • セキュリティグループ - 172.31.0.0/16からのICMP、SSHを許可する。

手順

準備

  • VPNサーバーをWindows Serverで構築する。
  • Windows ServerにElastic IPを割り当てる。
  • AWSマネージメントコンソールでEC2のインスタンス画面を開く。一覧よりWindows Serverのインスタンスを選択し、[アクション] > [ネットワーク] > [ソース/宛先チェック]を開き、設定を無効に変更する。
    sdcheck.PNG
  • Windows Serverにリモートデスクトップ接続し、[コントロールパネル] > [デバイスマネージャー]を開いて、ネットワークアダプターのChecksum OffloadをDisabledに設定する。
    ChecksumOffload.PNG
    IPv4 Checksum Offload = Disabled

    TCP Checksum Offload (IPv4) = Disabled

    UDP Checksum Offload (IPv4) = Disabled

AWS側の設定

  • Customer Gatewayを作成する。Windows ServerのパブリックIPアドレスをセットする。
    CustomerGateway.PNG
  • Transit Gatewayを作成する。
    TransitGateway.PNG
  • AWSとオンプレミスそれぞれに対して、Transit Gateway attachmentsを作成する。
    TGWattachments.PNG
  • Transit GatewayルートテーブルにAWSとオンプレミスのルートを登録する。
    TGWRouteTables.PNG
  • VPCのルートテーブルにも互いのネットワークへのルートを登録する。
    オンプレミス
    RouteTable1.PNG
    AWS
    RouteTable2.PNG
  • サイト間のVPN接続を作成する。
    VPN.PNG
  • Windows Server 2012R2用の設定ファイルをダウンロードする。

オンプレミス側の設定

  • Windows Serverを設定する。
  • ダウンロードした設定ファイルにnetshスクリプトが含まれているので、必要なプレースホルダー([]で囲まれた文字列)を置換し、Windows Serverで実行する。
    script.PNG
    [Windows_Server_Private_IP_address] = 172.31.0.104

    [Your_Static_Route_IP_Prefix] = "172.31.0.0/16"

    [Your_VPC_CIDR_Block] = "10.0.0.0/16"

テスト

  • テスト用インスタンスをAwSネットワークに作成する。
  • Windows Serverからテスト用インスタンスにpingを送信し、返事が返ってくることを確認する。
    ping.PNG
    何度か実行すると返事が返ってくるようになる。
  • Windows Serverからテスト用インスタンスにSSH接続できることを確認する。
    ssh.PNG
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?