すべてのプロダクト
Search
ドキュメントセンター

VPN Gateway:FortiGateファイアウォールの設定

最終更新日:Oct 22, 2024

IPsec-VPNを使用してデータセンターをAlibaba Cloud仮想プライベートクラウド (VPC) に接続するには、Alibaba cloudでVPNゲートウェイを設定し、データセンターのゲートウェイデバイスにVPN設定を追加する必要があります。 このトピックでは、FortiGateファイアウォールにVPN設定を追加する方法について説明します。

シナリオ

image

この例では、企業がAlibaba CloudにVPCをデプロイしています。 VPCのCIDRブロックは10.0.0.0/16です。 アプリケーションは、VPCのECS (Elastic Compute Service) インスタンスにデプロイされます。 同社には、VPCと通信するためにCIDRブロック192.168.0.0/16を使用する必要があるデータセンターがあります。 同社は、相互リソースアクセスを実装するために、データセンターとクラウド上のVPC間にIPsec-VPN接続を確立したいと考えています。

重要

このシナリオでは、データセンターのFortiGateファイアウォールが、パブリックIPアドレスを使用してデュアルトンネルモードでAlibaba CloudへのIPsec-VPN接続を確立します。 シングルトンネルモードでIPsec-VPN接続を確立する場合は、このトピックの「シングルトンネルを使用するFortiGateファイアウォールの構成」をご参照ください。

CIDRブロックプランとサンプルVPN設定

CIDRブロックプラン

リソース

CIDRブロック

IPアドレス

データセンター

VPCと通信する必要があるCIDRブロック: 192.168.0.0/16

サーバーIPアドレス: 192.168.10.211

FortiGateファイアウォール

インターフェイスのCIDRブロック: 192.168.0.0/16

  • パブリックIPアドレス122.XX. XX.248で設定されているFortiGateファイアウォール: port1でインターネットに接続する物理インターフェイス

  • FortiGateファイアウォールのデータセンターに接続する物理インターフェイス: ポート4。プライベートIPアドレス192.168.10.221/24

VPC

プライマリCIDRブロック: 10.0.0.0/16

vSwitch 1: 10.0.10.0/24

vSwitch 2: 10.0.20.0/24

ECS IPアドレス: 10.0.10.247

パブリックVPNゲートウェイ

非該当

  • IPsecアドレス1: 8.XX. XX.146

  • IPsecアドレス2: 8.XX. XX.74

説明

VPNゲートウェイを作成すると、システムはVPNゲートウェイにIPアドレスを自動的に割り当てます。

BGP動的ルーティングのCIDRブロックプラン

このトピックでは、静的ルーティングに加えて、Border Gateway Protocol (BGP) 動的ルーティングを使用するIPsec-VPN接続を確立するようにFortiGateファイアウォールを構成する方法についても説明します。 BGP動的ルーティングを使用する必要がない場合は、このセクションをスキップしてください。 次の表に、BGP動的ルーティングのCIDRブロックプランを示します。

リソース

トンネル

BGPトンネルCIDRブロック

BGP IPアドレス

BGPローカルASN

VPN ゲートウェイ

トンネル1

169.254.10.0/30

説明

VPNゲートウェイでは、各トンネルのCIDRブロックは一意である必要があります。

169.254.10.1

65535

トンネル2

169.254.20.0/30

169.254.20.1

FortiGateファイアウォール

トンネル1

169.254.10.0/30

169.254.10.2

65500

トンネル2

169.254.20.0/30

169.254.20.2

サンプルVPN設定

  • この例では、トンネル1はアクティブトンネルであり、トンネル2はスタンバイトンネルである。 2つのトンネルは同じサンプル値を使用する。

  • Alibaba CloudとFortiGateファイアウォールのVPN設定は、各トンネルで同じである必要があります。

パラメーター

Alibaba Cloudのサンプル値

FortiGateファイアウォールのサンプル値

事前共有キー

123456 ****

123456 ****

インターネットキー交換 (IKE) 設定

IKE バージョン

ikev2

ikev2

ネゴシエーションモード

メイン

メイン

暗号化アルゴリズム

des

des

説明

このシナリオでFortiGateファイアウォールで使用されるソフトウェアバージョンは、Advanced Encryption Standard (AES) アルゴリズムをサポートしていません。 したがって、この例では、データ暗号化標準 (DES) アルゴリズムが使用される。 AESアルゴリズムの使用を推奨します。

認証アルゴリズム

sha1

sha1

Diffie-Hellman (DH) グループ

group2

group2

セキュリティアソシエーション (SA) ライフサイクル (秒)

86400

86400

IPsec設定

暗号化アルゴリズム

des

des

説明

このシナリオでFortiGateファイアウォールで使用されるソフトウェアバージョンは、AESアルゴリズムをサポートしていません。 したがって、この例ではDESアルゴリズムが使用される。 AESアルゴリズムの使用を推奨します。

認証アルゴリズム

sha1

sha1

DH グループ

group2

group2

SAライフサイクル (秒)

86400

86400

前提条件

このトピックでは、FortiGateファイアウォールにVPN設定を追加する方法についてのみ説明します。 Alibaba CloudでVPNゲートウェイを設定する手順は省略します。 FortiGateファイアウォールを設定する前に、VPNゲートウェイの作成、カスタマーゲートウェイの作成、IPsec-VPN接続の作成、およびVPNゲートウェイのルーティングの設定を完了していることを確認してください。

説明

このシナリオでは、データセンターのFortiGateファイアウォールが、パブリックIPアドレスを使用してAlibaba CloudへのIPsec-VPN接続をデュアルトンネルモードで確立します。 したがって、カスタマーゲートウェイを1つだけ作成する必要があります。 IPsec-VPN接続を作成すると、2つのトンネルを同じカスタマーゲートウェイに関連付けることができます。

手順

説明

この例では、FortiOS V6.2.4を使用してFortiGateファイアウォールの設定方法を説明します。 次の内容は参照だけのためです。 特定のコマンドの詳細については、製造元のマニュアルを参照してください。

静的ルーティング

  1. FortiGateファイアウォールのCLIに移動します。

  2. フェーズ1のIPsec-VPN設定 (IKE設定とも呼ばれます) をFortiGateファイアウォールに追加します。

    # Add Phase 1 IPsec-VPN configurations for Tunnel 1.
    config vpn ipsec phase1-interface
     edit "to_aliyun_test1"
     set interface "port1"             # Set the interface to port1, which is the public network egress. 
     set ike-version 2
     set peertype any
     set net-device disable
     set proposal des-sha1             
     set localid-type address          # Set the format of localid to IP address, which is the same as that of remoteid of Tunnel 1 on Alibaba Cloud. 
     set dhgrp 2
     set remote-gw 8.XX.XX.146         # Set the remote address of Tunnel 1 to IPsec address 1 of the VPN gateway. 
     set psksecret 123456****          # Specify the pre-shared key for Tunnel 1. The pre-shared key on Alibaba Cloud must be the same as that on the FortiGate firewall. 
     next
    end
    
    # Add Phase 2 IPsec-VPN configurations for Tunnel 2.
    config vpn ipsec phase1-interface
     edit "to_aliyun_test2"
     set interface "port1"             # Set the interface to port1, which is the public network egress. 
     set ike-version 2
     set peertype any
     set net-device disable
     set proposal des-sha1             
     set localid-type address          # Set the format of localid to IP address, which is the same as that of remoteid of Tunnel 2 on Alibaba Cloud. 
     set dhgrp 2
     set remote-gw 8.XX.XX.74          # Set the remote address of Tunnel 2 to IPsec address 2 of the VPN gateway. 
     set psksecret 123456****          # Specify the pre-shared key for Tunnel 2. The pre-shared key on Alibaba Cloud must be the same as that on the FortiGate firewall. 
     next
    end
  3. フェーズ2 IPsec-VPN設定 (IPsec設定とも呼ばれます) をFortiGateファイアウォールに追加します。

    # Add Phase 2 IPsec-VPN configurations for Tunnel 1.
    config vpn ipsec phase2-interface
        edit "to_aliyun_test1"
            set phase1name "to_aliyun_test1"    # Associate the interface with phase1-interface of Tunnel 1. 
            set proposal des-sha1
            set dhgrp 2
            set auto-negotiate enable
            set keylifeseconds 86400
        next
    end
    
    # Add Phase 2 IPsec-VPN configurations for Tunnel 2.
    config vpn ipsec phase2-interface       
        edit "to_aliyun_test2"       
            set phase1name "to_aliyun_test2"     # Associate the interface with phase1-interface of Tunnel 2. 
            set proposal des-sha1
            set dhgrp 2
            set auto-negotiate enable
            set keylifeseconds 86400
        next
    end
  4. ファイアウォールポリシーを設定します。

    config firewall policy
        edit 1
            set name "forti_to_aliyun1"       # Specify the traffic that is allowed from the FortiGate firewall to Alibaba Cloud over Tunnel 1. 
            set srcintf "port4"
            set dstintf "to_aliyun_test1"
            set srcaddr "all"
            set dstaddr "all"
            set action accept
            set schedule "always"
            set service "ALL"
        next
        edit 2
            set name "aliyun_to_forti1"       # Specify the traffic that is allowed from Alibaba Cloud to the FortiGate firewall over Tunnel 1. 
            set srcintf "to_aliyun_test1"
            set dstintf "port4"
            set srcaddr "all"
            set dstaddr "all"
            set action accept
            set schedule "always"
            set service "ALL"
        next
        edit 3
            set name "forti_to_aliyun2"        # Specify the traffic that is allowed from the FortiGate firewall to Alibaba Cloud over Tunnel 2. 
            set srcintf "port4"
            set dstintf "to_aliyun_test2"
            set srcaddr "all"
            set dstaddr "all"
            set action accept
            set schedule "always"
            set service "ALL"
        next
        edit 4
            set name "aliyun_to_forti2"        # Specify the traffic that is allowed from Alibaba Cloud to the FortiGate firewall over Tunnel 2. 
            set srcintf "to_aliyun_test2"
            set dstintf "port4"
            set srcaddr "all"
            set dstaddr "all"
            set action accept
            set schedule "always"
            set service "ALL"
        next
    end
  5. VPCへの静的ルートを設定します。

    config router static
        edit 1
            set dst 10.0.0.0 255.255.0.0
            set priority 0 
            set device "to_aliyun_test1"
        next
        edit 2
            set dst 10.0.0.0 255.255.0.0
            set priority 10                   # Decrease the priority of the route pointing to Tunnel 2. This way, traffic is preferentially transmitted over Tunnel 1. 
            set device "to_aliyun_test2"
        next
    end

BGP動的ルーティング

  1. FortiGateファイアウォールのCLIに移動します。

  2. フェーズ1のIPsec-VPN設定 (IKE設定とも呼ばれます) をFortiGateファイアウォールに追加します。

    # Add Phase 1 IPsec-VPN configurations for Tunnel 1.
    config vpn ipsec phase1-interface
     edit "to_aliyun_test1"
     set interface "port1"             # Set the interface to port1, which is the public network egress. 
     set ike-version 2
     set peertype any
     set net-device disable
     set proposal des-sha1             
     set localid-type address          # Set the format of localid to IP address, which is the same as that of remoteid of Tunnel 1 on Alibaba Cloud. 
     set dhgrp 2
     set remote-gw 8.XX.XX.146         # Set the remote address of Tunnel 1 to IPsec address 1 of the VPN gateway. 
     set psksecret 123456****          # Specify the pre-shared key for Tunnel 1. The pre-shared key on Alibaba Cloud must be the same as that on the FortiGate firewall. 
     next
    end
    
    # Add Phase 2 IPsec-VPN configurations for Tunnel 2.
    config vpn ipsec phase1-interface
     edit "to_aliyun_test2"
     set interface "port1"             # Set the interface to port1, which is the public network egress. 
     set ike-version 2
     set peertype any
     set net-device disable
     set proposal des-sha1             
     set localid-type address          # Set the format of localid to IP address, which is the same as that of remoteid of Tunnel 2 on Alibaba Cloud. 
     set dhgrp 2
     set remote-gw 8.XX.XX.74          # Set the remote address of Tunnel 2 to IPsec address 2 of the VPN gateway. 
     set psksecret 123456****          # Specify the pre-shared key for Tunnel 2. The pre-shared key on Alibaba Cloud must be the same as that on the FortiGate firewall. 
     next
    end
  3. フェーズ2 IPsec-VPN設定 (IPsec設定とも呼ばれます) をFortiGateファイアウォールに追加します。

    # Add Phase 2 IPsec-VPN configurations for Tunnel 1.
    config vpn ipsec phase2-interface
        edit "to_aliyun_test1"
            set phase1name "to_aliyun_test1"    # Associate the interface with phase1-interface of Tunnel 1. 
            set proposal des-sha1
            set dhgrp 2
            set auto-negotiate enable
            set keylifeseconds 86400
        next
    end
    
    # Add Phase 2 IPsec-VPN configurations for Tunnel 2.
    config vpn ipsec phase2-interface       
        edit "to_aliyun_test2"       
            set phase1name "to_aliyun_test2"     # Associate the interface with phase1-interface of Tunnel 2. 
            set proposal des-sha1
            set dhgrp 2
            set auto-negotiate enable
            set keylifeseconds 86400
        next
    end
  4. ファイアウォールポリシーを設定します。

    config firewall policy
        edit 1
            set name "forti_to_aliyun1"       # Specify the traffic that is allowed from the FortiGate firewall to Alibaba Cloud over Tunnel 1. 
            set srcintf "port4"
            set dstintf "to_aliyun_test1"
            set srcaddr "all"
            set dstaddr "all"
            set action accept
            set schedule "always"
            set service "ALL"
        next
        edit 2
            set name "aliyun_to_forti1"       # Specify the traffic that is allowed from Alibaba Cloud to the FortiGate firewall over Tunnel 1. 
            set srcintf "to_aliyun_test1"
            set dstintf "port4"
            set srcaddr "all"
            set dstaddr "all"
            set action accept
            set schedule "always"
            set service "ALL"
        next
        edit 3
            set name "forti_to_aliyun2"        # Specify the traffic that is allowed from the FortiGate firewall to Alibaba Cloud over Tunnel 2. 
            set srcintf "port4"
            set dstintf "to_aliyun_test2"
            set srcaddr "all"
            set dstaddr "all"
            set action accept
            set schedule "always"
            set service "ALL"
        next
        edit 4
            set name "aliyun_to_forti2"        # Specify the traffic that is allowed from Alibaba Cloud to the FortiGate firewall over Tunnel 2. 
            set srcintf "to_aliyun_test2"
            set dstintf "port4"
            set srcaddr "all"
            set dstaddr "all"
            set action accept
            set schedule "always"
            set service "ALL"
        next
    end
  5. トンネルインターフェイスのBGP IPアドレスを設定します。

    config system interface
        edit "to_aliyun_test1"
            set ip 169.254.10.2 255.255.255.255          # Configure a BGP IP address for the interface of Tunnel 1. 
            set remote-ip 169.254.10.1 255.255.255.255   # Configure a remote BGP IP address for Tunnel 1. 
        next
        edit "to_aliyun_test2"
            set ip 169.254.20.2 255.255.255.255          # Configure a BGP IP address for the interface of Tunnel 2. 
            set remote-ip 169.254.20.1 255.255.255.255   # Configure a remote BGP IP address for Tunnel 2. 
        next
    end
  6. BGP動的ルーティングを設定します。

    config router bgp
        set as 65500
        set router-id 122.XX.XX.248
        config neighbor
            edit "169.254.10.1"                       # Specify the BGP peer for Tunnel 1. 
                set remote-as 65535
            edit "169.254.20.1"
                set remote-as 65535                   # Specify the BGP peer for Tunnel 2. 
            next
        end
        config network
            edit 1
                set prefix 192.168.0.0 255.255.0.0    # Specify the CIDR block in the data center that needs to communicate with the VPC. 
            next
        end
            config redistribute "connected"           # Redistribute the route of the directly-connected interface to BGP. 
            set status enable
        end
    end

単一のトンネルを使用するようにFortiGateファイアウォールを設定する

サンプル設定

シナリオ

image

この例では、企業がAlibaba CloudにVPCをデプロイしています。 VPCのCIDRブロックは192.168.10.0/24です。 アプリケーションはVPCのECSインスタンスにデプロイされます。 同社にはデータセンターもあり、そのCIDRブロック192.168.66.0/24はVPCと通信したいと考えています。 同社は、相互リソースアクセスを実装するために、データセンターとクラウド上のVPC間にIPsec-VPN接続を確立したいと考えています。

CIDRブロックプランとサンプルVPN設定

CIDRブロックプラン

リソース

VPC

データセンターと通信する必要があるプライベートCIDRブロック

192.168.10.0/24

パブリックVPNゲートウェイ

VPNゲートウェイのパブリックIPアドレス

101.XX.XX.127

データセンター

VPCと通信する必要があるプライベートCIDRブロック

192.168.66.0/24

FortiGateファイアウォールのパブリックIPアドレス

122.XX.XX.248

FortiGateファイアウォールでインターネットに接続する物理インターフェイス

パブリックIPアドレス122.XX. XX.248で設定されているWAN

FortiGateファイアウォール上のデータセンターに接続する物理インターフェイス

プライベートIPアドレス192.168.66.125/24で設定されているLAN

サンプルVPN設定

パラメーター

Alibaba Cloudのサンプル値

FortiGateファイアウォールのサンプル値

事前共有キー

ff123TT ****

ff123TT ****

IKE設定

IKE バージョン

ikev1

ikev1

ネゴシエーションモード

メイン

メイン

暗号化アルゴリズム

aes

aes

認証アルゴリズム

sha1

sha1

DH グループ

group2

group2

SAライフサイクル (秒)

86400

86400

IPsec設定

暗号化アルゴリズム

aes

aes

認証アルゴリズム

sha1

sha1

DH グループ

group2

group2

SAライフサイクル (秒)

86400

86400

前提条件

このトピックでは、FortiGateファイアウォールにVPN設定を追加する方法についてのみ説明します。 Alibaba CloudでVPNゲートウェイを設定する手順は省略します。 この例では。 静的ルーティングが使用されます。 FortiGateファイアウォールを設定する前に、VPNゲートウェイの作成、カスタマーゲートウェイの作成、IPsec-VPN接続の作成、およびVPNゲートウェイのルーティングの設定を完了していることを確認してください。 詳細については、「シングルトンネルモードでVPCをデータセンターに接続する」をご参照ください。

手順

説明

この例では、FortiOS V7.0を使用してFortiGateファイアウォールの設定方法を説明します。 次の内容は参照だけのためです。 特定のコマンドの詳細については、製造元のマニュアルを参照してください。

  1. FortiGateファイアウォールのCLIに移動します。

  2. フェーズ1のIPsec-VPN設定 (IKE設定とも呼ばれます) をFortiGateファイアウォールに追加します。

    config vpn ipsec phase1-interface
        edit "to_AliCloud"
            set interface "wan"
            set peertype any
            set net-device disable
            set proposal aes128-sha1
            set dpd on-idle
            set dhgrp 2
            set keylife 86400
            set remote-gw 101.XX.XX.127        # Set the remote address of the tunnel to the public IP address of the VPN gateway. 
            set psksecret ff123TT****          # Specify the pre-shared key for the tunnel. The pre-shared key on Alibaba Cloud must be the same as that on the FortiGate firewall. 
        next
    end
  3. フェーズ2 IPsec-VPN設定 (IPsec設定とも呼ばれます) をFortiGateファイアウォールに追加します。

config vpn ipsec phase2-interface
    edit "to_AliCloud"
        set phase1name "to_AliCloud"            # Associate the interface with phase1-interface of the tunnel. 
        set proposal aes128-sha1
        set dhgrp 2
        set keylifeseconds 86400
        set auto-negotiate enable
    next
end
  1. ファイアウォールポリシーを設定します。

    config firewall address                             # Define CIDR blocks.
        edit "Local_192.168.66.0/24"
            set subnet 192.168.66.0 255.255.255.0
        next
        edit "Remote_192.168.10.0/24"
            set subnet 192.168.10.0 255.255.255.0
        next
        edit "AliCloud_VPN_Gateway"
            set subnet 101.XX.XX.127 255.255.255.255
        next
    end
    
    config firewall policy
        edit 4
            set srcintf "lan"
            set dstintf "to_AliCloud"                  # Specify the traffic that is allowed from the FortiGate firewall to Alibaba Cloud over the tunnel. 
            set action accept
            set srcaddr "Local_192.168.66.0/24"
            set dstaddr "Remote_192.168.10.0/24"
            set schedule "always"
            set service "ALL"
        next
        edit 5
            set srcintf "to_AliCloud"                   # Specify the traffic that is allowed from Alibaba Cloud to the FortiGate firewall over the tunnel. 
            set dstintf "lan"
            set action accept
            set srcaddr "Remote_192.168.10.0/24"
            set dstaddr "Local_192.168.66.0/24"
            set schedule "always"
            set service "ALL"
        next
    end
  2. VPCへの静的ルートを設定します。

    config router static
        edit 3
            set dst 192.168.10.0 255.255.255.0   
            set device "to_AliCloud"
        next
        edit 4
            set dst 192.168.10.0 255.255.255.0
            set distance 254
            set blackhole enable
        next
    end
  3. FortiGateファイアウォールのローカルインポリシーを設定します。

    重要

    ローカルインポリシーを設定した後、IKEセッションが確立されていない場合、Alibaba CloudからのIKEネゴシエーションパケットはドロップされます。 ローカルインポリシーが設定されていることを確認します。 そうしないと、IPsec-VPN接続が中断された後に接続を再開できません。

    config firewall local-in-policy
        edit 1
            set intf "wan"
            set srcaddr "AliCloud_VPN_Gateway"
            set dstaddr "all"
            set service "IKE"
            set schedule "always"
            set action deny
        next
    end