Strongswan侧的配置与之前写的 通过BGP与Google Cloud Router建立高可用链接 文中的过程, 使用到的脚本基本上保持一致, 本文主要介绍FortiGate侧的配置步骤.
目前正在使用的FortiOS版本为 v7.0.17
登录FortiGate, 选择 VPN -> IPSec Tunnels, 点击 Create New, 在下拉菜单中选择 IPSec Tunnel
会自动打开 IPSec Wizard. Template type 选择 Custom, 填写一个名字, 然后点下一步
在打开的新页面中, Network部分做如下配置:
Remote Gateway 选择 Static IP Address, IP Address 填入对端的地址, Interface 选择外网直接的接口, 勾选 Local Gateway 并选择 Primary IP.
NAT Traversal 调整至 Enable
Dead Peer Detection 调整至 On Idle
Advanced 菜单展开, 确保 Add Route 选项是 Enabled
配置 Authentication
Method 选择 Pre-shared Key, 填入 PSK
IKE Version 调整至 2
配置 Phase 1 Proposal
删掉不需要的Encryption配置, 保留 Encryption: AES256GCM, PRF: PRFSHA512.
Diffie-Hellman Group 注意只勾选需要的组.
配置 Phase 2 Selectors
Local Address 选择 Subnet, 0.0.0.0/0.0.0.0
Remote Address 选择 Subnet, 填入端到端的IP. /24 CIDR 段使用 255.255.255.0 作为 mask, /30 CIDR 段使用 255.255.255.252.
展开 Advanced, 去掉不需要的 Encryption, 保留 AES256GCM
确保 Enable Replay Detection 勾选
确保 Enable Perfect Forward Secrecy (PFS) 勾选
Diffie-Hellman Group 注意只勾选需要的组.
点击 OK 保存配置, 回到 IPsec Tunnels 页面, 点击新的隧道一行的 Status 列, 在新打开的页面中, 找到对应的隧道(会高亮), 右键 在打开的菜单中选择 Bring Up -> All Phase 2 Selectors
打开 Policy & Objects -> Firewall Policy, 配置防火墙策略
打开 Policy & Objects -> Central SNAT, 配置出网NAT
打开 Network -> Static Routes, 将端到端的IP CIDR添加为静态路由.
打开 Network -> DNS Servers, DNS Service on Interface 栏点击 Create New, 在新打开的页面中 Interface 选择新创建的隧道, Mode 选择 Recursive, 点击 OK 保存配置
(可选) 打开 Network -> Interfaces, 找到新创建的隧道, 双击打开新页面. 在 Address 栏中, IP 填入端到端的本端IP, 注意不需要填写CIDR后缀或mask. 对端IP填写端到端的对端IP+mask, 使用空格分开.
参考
Route-Based VPN Tunnel FortiGate <-> Cisco ASA
Phase 2 configuration | FortiGate / FortiOS 7.6.4 | Fortinet Document Library