文档

FortiGate防火墙

更新时间:

使用IPsec-VPN建立站点到站点的连接时,在阿里云侧完成VPN网关的配置后,您还需在本地站点的网关设备中添加VPN配置。本文以FortiGate防火墙为例介绍如何在本地站点的网关设备中添加VPN配置。

场景示例

华三配置场景示例本文以上图场景为例。某公司在阿里云拥有一个专有网络VPC(Virtual Private Cloud),VPC网段为192.168.10.0/24,VPC中使用云服务器ECS(Elastic Compute Service)部署了应用服务。同时该公司在本地拥有一个数据中心IDC(Internet Data Center),本地IDC网段为192.168.66.0/24。公司因业务发展,需要本地IDC与云上VPC互通,实现资源互访。该公司计划使用VPN网关产品,在本地IDC与云上VPC之间建立IPsec-VPN连接,实现云上和云下的互通。

本文涉及的网络配置详情请参见下表。

配置项

示例值

VPC

待和本地IDC互通的私网网段

192.168.10.0/24

VPN网关

VPN网关公网IP地址

101.XX.XX.127

本地IDC

待和VPC互通的私网网段

192.168.66.0/24

本地网关设备的公网IP地址

122.XX.XX.248

本地网关设备连接公网的接口

WAN

本地网关设备连接本地IDC的接口

LAN

前提条件

  • 您已在阿里云侧完成创建VPN网关、创建用户网关、创建IPsec连接、配置VPN网关路由的操作。具体操作,请参见建立VPC到本地数据中心的连接(单隧道模式)

  • 您已下载IPsec连接的配置。具体操作,请参见下载IPsec连接配置

    本文IPsec连接的配置如下表所示。

    配置项

    示例值

    预共享密钥

    ff123TT****

    IKE配置

    IKE版本

    ikev1

    协商模式

    main

    加密算法

    aes

    认证算法

    sha1

    DH分组

    group2

    SA生存周期(秒)

    86400

    IPsec配置

    加密算法

    aes

    认证算法

    sha1

    DH分组

    group2

    SA生存周期(秒)

    43200

开始配置

说明

下文以FortiOS 7.0为例介绍如何配置FortiGate防火墙。以下内容仅作示例使用,具体配置命令请以厂商的配置手册为准。

  1. 登录FortiGate防火墙命令行配置界面。

  2. 为FortiGate防火墙添加IPsec-VPN第一阶段配置。

    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 psksecret ff123TT****
        next
    end
  3. 为FortiGate防火墙添加IPsec-VPN第二阶段配置。

    config vpn ipsec phase2-interface
        edit "to_AliCloud"
            set phase1name "to_AliCloud"
            set proposal aes128-sha1
            set dhgrp 2
            set keylifeseconds 43200
            set auto-negotiate enable
            set src-subnet 192.168.66.0 255.255.255.0
            set dst-subnet 192.168.10.0 255.255.255.0
        next
    end
  4. 配置防火墙策略。

    onfig firewall address
        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"
            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"
            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
  5. 配置访问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
  6. 为FortiGate配置Local-in policy。

    重要

    为FortiGate配置Local-in policy,在没有IKE会话建立的情况下,丢弃阿里云侧发来的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
  • 本页导读 (1)
文档反馈