一、组网需求

如图所示,通过IPsec VPN将2个局域网连接起来,IPsec VPN隧道需要采用证书认证方式来协商,实现192.168.0.0/24与192.168.1.0/24两个网段的通信


二、网络拓扑

        

三、配置要点

1、为FortiGate1和FortiGate2颁发数字证书

    1)使用FortiAuthenticator为FortiGate1-BJ和FortiGate2-SH颁发并导入数字证书

    2)使用Windows Server 2008为FortiGate1-BJ和FortiGate2-SH颁发并导入数字证书


2、配置FortiGate1

    1)基本上网配置
    2)根据模板配置IPsec VPN(默认即为IPSEC接口模式)
    3)针对模板配置的优化建议

    4)IPsec VPN模板里面具体配置了什么?


3、配置FortiGate2

    1)基本上网配置
    2)根据模板配置IPsec VPN(默认即为IPSEC接口模式)
    3)针对模板配置的优化建议

    4)IPsec VPN模板里面具体配置了什么?

说明:如果要删除IPSEC VPN第一阶段、第二阶段时,需要先删除被调用的路由与防火墙安全策略。


四、配置步骤

1、使用FortiAuthenticator为FortiGate1-BJ和FortiGate2-SH颁发数字证书 

1.1)  使用FortiAuthenticator为FortiGate1-BJ和FortiGate2-SH颁发数字证书        


FAC为FortiGate1(BJ)颁发证书:





同理为FortiGate2_SH颁发数字证书(省略此步骤截图)

最终得到 FortiGate1_BJ(Center防火墙用户证书)、FortiGate2_SH(Side1防火墙用户证书)、TACROOTCA(FAC的根证书)这三张证书

1.2)  导入使用FortiAuthenticator为FortiGate1-BJ和FortiGate2-SH颁发的数字证书   

导入FortiGate1_BJ的本地用户数字证书:



在上FortiGate1_BJ导入FortiAuthenticator的CA根证书:



导入FortiGate2_SH的本地用户数字证书和远端CA根证书(和FortiGate1相同的操作步骤,此处省略过程截图),下为导入证书后的结果截图:


本地用户证书和远端的CA根证书均成功导入到FGT本地,这是IPsec  VPN证书认证的前提条件。必须要把相应的证书准确成功的导入到了FGT本地,后续才有可能进行对应的证书协商和认证。

  

2、使用Windows Server 2008为FortiGate1-BJ和FortiGate2-SH颁发数字证书       

2.1)使用Windows Server 2008为FortiGate1-BJ和FortiGate2-SH颁发数字证书

低端设备需要在“可见功能”中打开“证书”功能,默认是GUI是隐藏的:


在FortiGate生成一个证书请求,在本地产生一个私钥,同时产生一个“base-64 编码的 CMC 或 PKCS #10 证书申请”:





打开Windows Server 2008 CA申请界面,通过Windows CA服务器申请数字证书:


下载申请的FortiGate1_BJ的用户证书:


下载CA颁发机构的根证书:


同样的步骤为FortiGate2_SH申请并颁发数字证书(省略此步骤截图)

最终得到 FortiGate1_BJ(Center防火墙用户证书)、FortiGate2_SH(Side1防火墙用户证书)、Windows Server 2008(CA的根证书) 这三张证书


2.2)  导入使用Windows Server 2008为FortiGate1-BJ和FortiGate2-SH颁发的数字证书        

导入FortiGate1_BJ的本地用户数字证书:



在上FortiGate1_BJ导入Windows Server 2008的CA根证书:




导入FortiGate2_SH的本地用户数字证书和远端CA根证书(和FortiGate1相同的操作步骤,此处省略过程截图),下为导入证书后的结果截图:

          

本地用户证书和远端的CA根证书均成功导入到FGT本地,这是IPsec  VPN证书认证的前提条件。必须要把相应的证书准确成功的导入到了FGT本地,后续才有可能进行对应的证书协商和认证。

  

3、配置FortiGate1 (BJ)

1) 基本上网配置

配置详细过程请参照 "路由模式典型功能--单线上网--静态地址线路上网配置"一节:

接口IP配置如下:

路由配置如下

2) 根据模板配置IPsec VPN

进入:虚拟专网--IPSEC隧道--"新建"

可以选择根据向导进行相应的IPsec VPN模板进行配置:




3) 针对模板配置的优化建议

优化建议一:在第一阶段中开启DPD周期性检测(每隔10s检测一次Peer状态),实现快速的检测并切换VPN隧道的目的。

相关命令行:
config vpn ipsec phase1-interface
 edit "VPN-TO-SH"
   set dpd on-idle
 next
end

优化建议二:开启自动协商,主动让隧道UP起来,而非使用VPN业务的时候再去触发VPN的协商,这样可以减少业务的丢包,同时可快速的感知VPN隧道的状态。


config vpn ipsec phase2-interface
  edit "VPN-TO-SH"
   set auto-negotiate enable
   next

end

----FortiGate1(BJ)的配置全部完成----   

4)IPsec VPN模板里面具体配置了什么?

4.1) IPsec VPN的配置:


第一阶段配置:  FortiGate1_BeiJing # config user peer
FortiGate1_BeiJing (peer) # show
config user peer
    edit "VPN-TO-BJ_peer"
        set ca "CA_Cert_1"
    next
end 
FortiGate1_BeiJing # config vpn ipsec phase1-interface
FortiGate1_BeiJing (phase1-interface) # show
config vpn ipsec phase1-interface
    edit "VPN-TO-SH"
        set interface "wan1"
        set authmethod signature
        set proposal aes128-sha256 aes256-sha256 aes128-sha1 aes256-sha1
        set dpd on-idle
        set comments "VPN: VPN-TO-SH (Created by VPN wizard)"
        set remote-gw 200.1.1.2
        set certificate "FortiGate1_BJ"
        set peer "VPN-TO-SH_peer"
    next
end
FortiGate1_BeiJing(phase1-interface) # show full-configuration // 可看到所有默认参数和配置
第二阶段配置:
FortiGate1_BeiJing # config vpn ipsec phase2-interface
FortiGate1_BeiJing (phase2-interface) #
FortiGate1_BeiJing (phase2-interface) # show
config vpn ipsec phase2-interface
    edit "VPN-TO-SH"
        set phase1name "VPN-TO-SH"
        set proposal aes128-sha1 aes256-sha1 aes128-sha256 aes256-sha256 aes128gcm aes256gcm chacha20poly1305
        set comments "VPN: VPN-TO-SH (Created by VPN wizard)"
        set src-addr-type name
        set dst-addr-type name
        set src-name "VPN-TO-SH_local"
        set dst-name "VPN-TO-SH_remote"
    next
end
FG100E4Q16003872 (phase2-interface) # show full-configuration // 可看到所有默认参数和配置
IP地址对象和对象组:
config firewall address
    edit "VPN-TO-SH_local_subnet_1"
        set allow-routing enable
        set subnet 192.168.0.0 255.255.255.0
    next
    edit "VPN-TO-SH_remote_subnet_1"
        set allow-routing enable
        set subnet 192.168.1.0 255.255.255.0
    next
end
config firewall addrgrp
    edit "VPN-TO-SH_local"
        set member "VPN-TO-SH_local_subnet_1"
        set comment "VPN: VPN-TO-SH (Created by VPN wizard)"
        set allow-routing enable
    next
    edit "VPN-TO-SH_remote"
        set member "VPN-TO-SH_remote_subnet_1"
        set comment "VPN: VPN-TO-SH (Created by VPN wizard)"
        set allow-routing enable
    next
end

4.2) IPsec VPN策略的配置:

配置 LAN内网接口道VPN隧道接口的策略 和 VPN隧道接口到内网LAN接口的策略,在策略的配置中“VPN-TO-SH”就像是一个普通接口一样调用即可:


config firewall policy
    edit 0
        set name "vpn_VPN-TO-SH_local"
        set srcintf "lan"
        set dstintf "VPN-TO-SH"
        set srcaddr "VPN-TO-SH_local"
        set dstaddr "VPN-TO-SH_remote"
        set action accept
        set schedule "always"
        set service "ALL"
        set comments "VPN: VPN-TO-SH (Created by VPN wizard)"
    next
    edit 0
        set name "vpn_VPN-TO-SH_remote"
        set srcintf "VPN-TO-SH"
        set dstintf "lan"
        set srcaddr "VPN-TO-SH_remote"
        set dstaddr "VPN-TO-SH_local"
        set action accept
        set schedule "always"
        set service "ALL"
        set comments "VPN: VPN-TO-SH (Created by VPN wizard)"
    next
end


4.3) IPsec VPN路由的配置:配置 到对方业务网段的路由指向VPN隧道接口“VPN-TO-SHA”,在路由的配置中“VPN-TO-SH”就像是一个普通接口一样调用即可
        

config router static
    edit 0
        set device "VPN-TO-SH"
        set comment "VPN: VPN-TO-SH (Created by VPN wizard)"
        set dstaddr "VPN-TO-SH_remote"
    next
    edit 0
        set distance 254   // 管理距离 254
        set comment "VPN: VPN-TO-SH (Created by VPN wizard)"
        set blackhole enable
        set dstaddr "VPN-TO-SH_remote"
    next
end

说明:相关VPN的路由配置中“黑洞路由的意义”:

你可能会遇到以下的VPN业务问题:通过VPN的SIP电话,时不时中断,无法向服务器成功注册 ?通过VPN的Radius认证无法经常会无法认证成功? 通过VPN的AP注册到总部时不时会中断?持续的PRGT监控ping总部的服务器,时不时会显示中断? 
VPN有时候会因为各种原因重新连接,比如互联网不稳定,PPPOE重新连接更换公网IP地址等,VPN tunnel此时会出现短暂的DOWN,而去往对方的VPN业务网段的路由也会短暂消失,此时VPN的业务流量(SIP注册请求/Radius/Capwap/ICMP)会因为查询到了默认路由而走向了  WAN1(Internet),从而产生了错误的UDP-NAT-Seesion,此时即便VPN tunnel再次UP,VPN业务网段的路由再次恢复,SIP等VPN旧的业务流量依旧会走到错误的Session上去,从而引起该业务异常。 
排查思路:通过diagnose sniffer pa “port 5060”4 以及查看session (diagnose sys session list)去判断问题。 
解决此类问题的办法有三种:
办法一:配置去往VPN业务网段的“黑洞路由”,管理距离为254,VPN正常的情况下此黑洞路由不生效,而当VPN中断的时候,黑洞路由浮起来并且生效,将VPN中断时候的VPN流量丢弃,避免将流量转发互联网产生错误的session。
办法二:配置源接口:LAN,目的接口:WAN1,源IP:本地内网网段,目的IP:对端内网网段,动作:丢包的策略。将此去往Internet的私网(无用的)流量丢弃掉,避免FGT产生这种错误的session,从而避免了UDP业务时不时中断的问题。
办法三:在全局下开启“set snat-route-change enable”,一旦路由发生变化,将相关的会话flag置位为“Dirty”,清除路由缓存并重新查找目的IP的下一跳地址,这样VPN隧道恢复的时候,流量也会相应的切换到VPN隧道里面来。
FortiGate1_BeiJing # config system global
FortiGate1_BeiJing (global) # set snat-route-change enable
FortiGate1_BeiJing (global) # end

3、配置FortiGate2 (SH)

1) 基本上网配置
配置详细过程请参照 "路由模式典型功能--单线上网--静态地址线路上网配置"一节:
接口IP配置如下:

路由配置如下

2) 根据模板配置IPsec VPN(默认即为IPSEC接口模式)

进入:虚拟专网--IPSEC隧道--"新建"

可以选择根据向导进行相应的IPsec VPN模板进行配置:




3) 针对模板配置的优化建议
优化建议一:在第一阶段中开启DPD周期性检测(每隔10s检测一次Peer状态),实现快速的检测并切换VPN隧道的目的。

相关命令行:
config vpn ipsec phase1-interface    
  edit "VPN-TO-BJ"        
    set dpd on-idle   
  next
end

优化建议二:开启自动协商,主动让隧道UP起来,而非使用VPN业务的时候再去触发VPN的协商,这样可以减少业务的丢包,同时可快速的感知VPN隧道的状态。


config vpn ipsec phase2-interface
    edit "VPN-TO-BJ"
        set auto-negotiate enable
    next
end
----FortiGate2(SH)的配置全部完成----
    

4)IPsec VPN模板里面具体配置了什么
4.1) IPsec VPN的配置:

第一阶段配置:
FortiGate2_ShangHai # config user peer
FortiGate2_ShangHai (peer) # show
config user peer
    edit "VPN-TO-BJ_peer"
        set ca "CA_Cert_1"
    next
end

FortiGate2_ShangHai # config vpn ipsec phase1-interface
FortiGate2_ShangHai (phase1-interface) # show
config vpn ipsec phase1-interface
    edit "VPN-TO-BJ"
        set interface "wan1"
        set authmethod signature
        set proposal aes128-sha256 aes256-sha256 aes128-sha1 aes256-sha1
        set dpd on-idle
        set comments "VPN: VPN-TO-BJ (Created by VPN wizard)"
        set remote-gw 100.1.1.2
        set certificate "FortiGate2_SH"
        set peer "VPN-TO-BJ_peer"
    next
end
FortiGate2_ShangHai (phase1-interface) # show full-configuration # show full-configuration // 可看到所有默认参数和配置

第二阶段配置:
FortiGate2_ShangHai # config vpn ipsec phase2-interface
FortiGate2_ShangHai (phase2-interface) # show
config vpn ipsec phase2-interface
    edit "VPN-TO-BJ"
        set phase1name "VPN-TO-BJ"
        set proposal aes128-sha1 aes256-sha1 aes128-sha256 aes256-sha256
        set comments "VPN: VPN-TO-BJ (Created by VPN wizard)"
        set src-addr-type name
        set dst-addr-type name
        set src-name "VPN-TO-BJ_local"
        set dst-name "VPN-TO-BJ_remote"
    next
end
FortiGate2_ShangHai (phase2-interface) #  show full-configuration // 可看到所有默认参数和配置

IP地址对象和对象组:
config firewall address
    edit "VPN-TO-BJ_local_subnet_1"
        set allow-routing enable
        set subnet 192.168.1.0 255.255.255.0
    next
    edit "VPN-TO-BJ_remote_subnet_1"
        set allow-routing enable
        set subnet 192.168.0.0 255.255.255.0
    next 
end
config firewall addrgrp
    edit "VPN-TO-BJ_local"
        set member "VPN-TO-BJ_local_subnet_1"
        set comment "VPN: VPN-TO-BJ (Created by VPN wizard)"
        set allow-routing enable
    next
    edit "VPN-TO-BJ_remote"
        set member "VPN-TO-BJ_remote_subnet_1"
        set comment "VPN: VPN-TO-BJ (Created by VPN wizard)"
        set allow-routing enable
    next
end


4.2) IPsec VPN策略的配置:
配置 LAN内网接口道VPN隧道接口的策略 和 VPN隧道接口到内网LAN接口的策略,在策略的配置中“VPN-TO-SH”就像是一个普通接口一样调用即可:


config firewall policy
    edit 0
        set name "vpn_VPN-TO-BJ_local"
        set srcintf "internal"
        set dstintf "VPN-TO-BJ"
        set srcaddr "VPN-TO-BJ_local"
        set dstaddr "VPN-TO-BJ_remote"
        set action accept
        set schedule "always"
        set service "ALL"
        set comments "VPN: VPN-TO-BJ (Created by VPN wizard)"
    next
    edit 0
        set name "vpn_VPN-TO-BJ_remote"
        set srcintf "VPN-TO-BJ"
        set dstintf "internal"
        set srcaddr "VPN-TO-BJ_remote"
        set dstaddr "VPN-TO-BJ_local"
        set action accept
        set schedule "always"
        set service "ALL"
        set comments "VPN: VPN-TO-BJ (Created by VPN wizard)"
    next
end


4.3) IPsec VPN路由的配置:
配置 到对方业务网段的路由指向VPN隧道接口“VPN-TO-SHA”,在路由的配置中“VPN-TO-SH”就像是一个普通接口一样调用即可


config router static
    edit 0
        set device "VPN-TO-BJ"
        set comment "VPN: VPN-TO-BJ (Created by VPN wizard)"
        set dstaddr "VPN-TO-BJ_remote"
    next
    edit 0
        set distance 254    // 管理距离254
        set comment "VPN: VPN-TO-BJ (Created by VPN wizard)"
        set blackhole enable
        set dstaddr "VPN-TO-BJ_remote"
    next
end

说明:
相关VPN的路由配置中“黑洞路由的意义”:

你可能会遇到以下的VPN业务问题:通过VPN的SIP电话,时不时中断,无法向服务器成功注册 ?通过VPN的Radius认证无法经常会无法认证成功? 通过VPN的AP注册到总部时不时会中断?持续的PRGT监控ping总部的服务器,时不时会显示中断?

VPN有时候会因为各种原因重新连接,比如互联网不稳定,PPPOE重新连接更换公网IP地址等,VPN tunnel此时会出现短暂的DOWN,而去往对方的VPN业务网段的路由也会短暂消失,此时VPN的业务流量(SIP注册请求/Radius/Capwap/ICMP)会因为查询到了默认路由而走向了WAN1(Internet),从而产生了错误的UDP-NAT-Seesion,此时即便VPN tunnel再次UP,VPN业务网段的路由再次恢复,SIP等VPN旧的业务流量依旧会走到错误的Session上去,从而引起该业务异常。

排查思路:通过diagnose sniffer pa “port 5060”4 以及查看session (diagnose sys session list)去判断问题。

解决此类问题的办法有三种:
办法一:配置去往VPN业务网段的“黑洞路由”,管理距离为254,VPN正常的情况下此黑洞路由不生效,而当VPN中断的时候,黑洞路由浮起来并且生效,将VPN中断时候的VPN流量丢弃,避免将流量转发互联网产生错误的session。
办法二:配置源接口:LAN,目的接口:WAN1,源IP:本地内网网段,目的IP:对端内网网段,动作:丢包的策略。将此去往Internet的私网(无用的)流量丢弃掉,避免FGT产生这种错误的session,从而避免了UDP业务时不时中断的问题。
办法三:在全局下开启“set snat-route-change enable”,一旦路由发生变化,将相关的会话flag置位为“Dirty”,清除路由缓存并重新查找目的IP的下一跳地址,这样VPN隧道恢复的时候,流量也会相应的切换到VPN隧道里面来。
FortiGate2_ShangHai # config system global
FortiGate2_ShangHai (global) # set snat-route-change enable
FortiGate2_ShangHai (global) # end

五、检查配置结果
VPN业务测试:

查看监视器,观察状态: 监视器----IPsec监视器:


两个网络采用 ping测试方式,192.168.0.0/24和192.168.1.0/24两个内网可以相互访问。
  
从FortiGate1_BeiJing到FortoGate2_ShangHai:


FortoGate2_ShangHaiFortiGate1_BeiJing

   


FortiGate1_BeiJing # diagnose sniffer packet any "host 192.168.1.111 and icmp" 4
interfaces=[any]
filters=[host 192.168.1.111 and icmp]
3.572632 lan in 192.168.0.111 -> 192.168.1.111: icmp: echo request
3.572702 VPN-TO-SH out 192.168.0.111 -> 192.168.1.111: icmp: echo request
3.573386 VPN-TO-SH in 192.168.1.111 -> 192.168.0.111: icmp: echo reply
3.573418 lan out 192.168.1.111 -> 192.168.0.111: icmp: echo reply

4.576875 lan in 192.168.0.111 -> 192.168.1.111: icmp: echo request
4.576940 VPN-TO-SH out 192.168.0.111 -> 192.168.1.111: icmp: echo request
4.577643 VPN-TO-SH in 192.168.1.111 -> 192.168.0.111: icmp: echo reply
4.577674 lan out 192.168.1.111 -> 192.168.0.111: icmp: echo reply

5.590891 lan in 192.168.0.111 -> 192.168.1.111: icmp: echo request
5.590934 VPN-TO-SH out 192.168.0.111 -> 192.168.1.111: icmp: echo request
5.591673 VPN-TO-SH in 192.168.1.111 -> 192.168.0.111: icmp: echo reply
5.591700 lan out 192.168.1.111 -> 192.168.0.111: icmp: echo reply

6.604824 lan in 192.168.0.111 -> 192.168.1.111: icmp: echo request
6.604869 VPN-TO-SH out 192.168.0.111 -> 192.168.1.111: icmp: echo request
6.605548 VPN-TO-SH in 192.168.1.111 -> 192.168.0.111: icmp: echo reply
6.605576 lan out 192.168.1.111 -> 192.168.0.111: icmp: echo reply

FortiGate1_BeiJing # diagnose sniffer packet any "host 200.1.1.2" 4
interfaces=[any]
filters=[host 200.1.1.2]
3.282015 wan1 out 100.1.1.2 -> 200.1.1.2: ESP(spi=0xd7b56919,seq=0xa)
3.283160 wan1 in 200.1.1.2 -> 100.1.1.2: ESP(spi=0xd9f36896,seq=0xa)

4.285467 wan1 out 100.1.1.2 -> 200.1.1.2: ESP(spi=0xd7b56919,seq=0xb)
4.286371 wan1 in 200.1.1.2 -> 100.1.1.2: ESP(spi=0xd9f36896,seq=0xb)

5.299488 wan1 out 100.1.1.2 -> 200.1.1.2: ESP(spi=0xd7b56919,seq=0xc)
5.300167 wan1 in 200.1.1.2 -> 100.1.1.2: ESP(spi=0xd9f36896,seq=0xc)

6.313449 wan1 out 100.1.1.2 -> 200.1.1.2: ESP(spi=0xd7b56919,seq=0xd)
6.314078 wan1 in 200.1.1.2 -> 100.1.1.2: ESP(spi=0xd9f36896,seq=0xd)

设备相关VPN状态的查看,仅仅在FortiGate1(BJ)上查看:
FortiGate1_BeiJing #  get router  info routing-table all

Routing table for VRF=0
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
       O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default

S*      0.0.0.0/0 [10/0] via 100.1.1.254, wan1
C       100.1.1.0/24 is directly connected, wan1
C       192.168.0.0/24 is directly connected, lan
S       192.168.1.0/24 [10/0] is directly connected, VPN-TO-SH

FortiGate1_BeiJing #  diagnose vpn ike gateway list

vd: root/0
name: VPN-TO-SH
version: 1
interface: wan1 7
addr: 100.1.1.2:500 -> 200.1.1.2:500
created: 248s ago
peer-id: C = CN, L = BeiJing, O = Fortinet, OU = TAC, CN = FortiGate2_SH, emailAddress = support@fortinet.com
peer-id-auth: yes
IKE SA: created 1/1  established 1/1  time 160/160/160 ms
IPsec SA: created 2/2  established 3/3  time 30/23/40 ms

  id/spi: 0 fe7fd6a90f3de578/6dfff2f6baf563fc
  direction: initiator
  status: established 248-248s ago = 160ms
  proposal: aes128-sha256
  key: 4113f7d557f61c16-8a94349fed7c5d20
  lifetime/rekey: 86400/85851
  DPD sent/recv: 00000000/00000053
  peer-id: C = CN, L = BeiJing, O = Fortinet, OU = TAC, CN = FortiGate2_SH, emailAddress = support@fortinet.com

FortiGate1_BeiJing #  diagnose vpn tunnel list
list all ipsec tunnel in vd 0
------------------------------------------------------
name=VPN-TO-SH ver=1 serial=9 100.1.1.2:0->200.1.1.2:0
bound_if=7 lgwy=static/1 tun=intf/0 mode=auto/1 encap=none/0
proxyid_num=1 child_num=0 refcnt=10 ilast=6 olast=6 ad=/0
stat: rxp=12 txp=12 rxb=1440 txb=720
dpd: mode=on-idle on=1 idle=20000ms retry=3 count=0 seqno=145
natt: mode=none draft=0 interval=0 remote_port=0
proxyid=VPN-TO-SH proto=0 sa=2 ref=3 serial=2 auto-negotiate
  src: 0:192.168.0.0/255.255.255.0:0
  dst: 0:192.168.1.0/255.255.255.0:0
  SA:  ref=3 options=18227 type=00 soft=0 mtu=1438 expire=42586/0B replaywin=1024
       seqno=d esn=0 replaywin_lastseq=00000000 itn=0
  life: type=01 bytes=0/0 timeout=42898/43200
  dec: spi=d9f36895 esp=aes key=16 774fd8a1db194ff89aaf03a717f29433
       ah=sha1 key=20 181443befa2629dd623370f1b9d87ee25e9a3ed7
  enc: spi=d7b56919 esp=aes key=16 5ffa81b777b0a37e72bf1e3750fccca1
       ah=sha1 key=20 796dd733b030eea3be46a2ffb0bcdea4412b8e01
  dec:pkts/bytes=0/0, enc:pkts/bytes=12/1440
  npu_flag=00 npu_rgwy=200.1.1.2 npu_lgwy=100.1.1.2 npu_selid=5 dec_npuid=0 enc_npuid=0
  SA:  ref=3 options=18227 type=00 soft=0 mtu=1438 expire=42617/0B replaywin=1024
       seqno=1 esn=0 replaywin_lastseq=0000000d itn=0
  life: type=01 bytes=0/0 timeout=42929/43200
  dec: spi=d9f36896 esp=aes key=16 aa6ea0fbebaefd98d3f71fc7f9065a27
       ah=sha1 key=20 785e9ab9187c955499b906029f69b0c4b7a90ea8
  enc: spi=d7b56918 esp=aes key=16 497fd147f0dbc95a1f2028623b48c164
       ah=sha1 key=20 a6e814d4be64831bb87c2b99a9d7ed2526e382f6
  dec:pkts/bytes=12/720, enc:pkts/bytes=0/0
  npu_flag=00 npu_rgwy=200.1.1.2 npu_lgwy=100.1.1.2 npu_selid=5 dec_npuid=0 enc_npuid=0


FortiGate1_BeiJing #   get vpn ike gateway

vd: root/0
name: VPN-TO-SH
version: 1
interface: wan1 7
addr: 100.1.1.2:500 -> 200.1.1.2:500
created: 340s ago
peer-id: C = CN, L = BeiJing, O = Fortinet, OU = TAC, CN = FortiGate2_SH, emailAddress = support@fortinet.com
peer-auth: yes
IKE SA  created: 1/1  established: 1/1  time: 160/160/160 ms
IPsec SA  created: 2/2  established: 3/3  time: 30/23/40 ms

  id/spi: 0 fe7fd6a90f3de578/6dfff2f6baf563fc
  direction: initiator
  status: established 340-340s ago = 160ms
  proposal: aes-128-sha256
  key: 4113f7d557f61c16-8a94349fed7c5d20
  lifetime/rekey: 86400/85759
  DPD sent/recv: 00000000/00000057

FortiGate1_BeiJing # get vpn ipsec tunnel details

gateway
  name: 'VPN-TO-SH'
  type: route-based
  local-gateway: 100.1.1.2:0 (static)
  remote-gateway: 200.1.1.2:0 (static)
  mode: ike-v1
  interface: 'wan1' (7)
  rx  packets: 12  bytes: 1440  errors: 0
  tx  packets: 12  bytes: 720  errors: 0
  dpd: on-idle/negotiated  idle: 20000ms  retry: 3  count: 0
  selectors
    name: 'VPN-TO-SH'
    auto-negotiate: enable
    mode: tunnel
    src: 0:192.168.0.0/255.255.255.0:0
    dst: 0:192.168.1.0/255.255.255.0:0
    SA
      lifetime/rekey: 43200/42530  
      mtu: 1438
      tx-esp-seq: d
      replay: enabled
      inbound
        spi: d9f36895
        enc:  aes-cb  774fd8a1db194ff89aaf03a717f29433
        auth:   sha1  181443befa2629dd623370f1b9d87ee25e9a3ed7
      outbound
        spi: d7b56919
        enc:  aes-cb  5ffa81b777b0a37e72bf1e3750fccca1
        auth:   sha1  796dd733b030eea3be46a2ffb0bcdea4412b8e01
      NPU acceleration: none
    SA
      lifetime/rekey: 43200/42561  
      mtu: 1438
      tx-esp-seq: 1
      replay: enabled
      inbound
        spi: d9f36896
        enc:  aes-cb  aa6ea0fbebaefd98d3f71fc7f9065a27
        auth:   sha1  785e9ab9187c955499b906029f69b0c4b7a90ea8
      outbound
        spi: d7b56918
        enc:  aes-cb  497fd147f0dbc95a1f2028623b48c164
        auth:   sha1  a6e814d4be64831bb87c2b99a9d7ed2526e382f6
      NPU acceleration: none

说明:关于sniffer抓VPN业务和ESP的包
抓取IPsec VPN的IKE协商包:
diagnose sniffer packet any "host 202.1.1.2 and (port 500 or port 4500)" 4

抓取IPsec VPN的ESP加密数据包:
diagnose sniffer packet any "host 200.1.1.2 and esp" 4

抓取IPsec VPN的明文业务数据包:
diagnose sniffer packet any "host 192.168.1.111 and icmp" 4

注意:由于存在IPsec VPN芯片加速,因此可能数据包会抓不完全,主要指“ESP数据和明文业务数据”抓不全,因此有时候需要将VPN隧道的NP加速关闭:
FortiGate1_BeiJing # config vpn ipsec phase1-interface        
FortiGate1_BeiJing (phase1-interface) # edit VPN-TO-SH        
FortiGate1_BeiJing (VPN-TO-SH) # set npu-offload disable                                                                        
FortiGate1_BeiJing (VPN-TO-SH) # end    

Windows_CA_证书服务器配置.pdf img_10006.jpg img_10350.jpg img_10844.jpg img_11980.jpg img_12239.jpg img_13924.jpg img_14199.jpg img_14541.jpg img_15384.jpg img_15492.jpg img_15618.jpg img_15712.jpg img_16040.jpg img_16561.jpg img_17342.jpg img_17776.jpg img_19095.jpg img_19402.jpg img_23483.jpg img_25191.jpg img_26200.jpg img_2647.jpg img_2670.jpg img_27841.jpg img_27936.jpg img_28290.jpg img_28325.jpg img_28505.jpg img_29855.jpg img_30643.jpg img_30742.jpg img_30858.jpg img_31036.jpg img_3164.jpg img_32301.jpg img_32736.jpg img_3523.jpg img_5893.jpg img_6038.jpg img_6767.jpg img_7523.jpg img_8234.jpg img_8266.jpg img_9034.jpg img_9088.jpg img_9290.jpg