案例 | 防火墙华为与Fortine对接,以ISAKMP方式建立IPSec隧道。

本文涉及的产品
云防火墙,500元 1000GB
简介: 案例 | 防火墙华为与Fortine对接,以ISAKMP方式建立IPSec隧道。


组网需求

如图1所示,华为防火墙和Fortinet防火墙分别作为总部和分支的企业网关连接Internet。现企业需要在华为防火墙和Fortinet防火墙之间建立IPSec隧道,实现总部和分支安全互通。由于华为防火墙与和Fortinet防火墙的出口公网地址固定,可以采用ISAKMP方式建立IPSec隧道。此方式下,两端都可以主动发起协商建立IPSec隧道。


图2-7 以ISAKMP方式建立IPSec隧道

数据规划


配置思路

  1. 配置华为防火墙:
  • 配置接口IP地址,并将接口加入安全区域;
  • 配置域间安全策略,允许IKE协商报文、IPSec封装前和解封装后的原始报文能通过华为防火墙;
  • 配置华为防火墙到Internet的缺省路由;
  • 配置IPSec策略,包括定义需要保护的数据流、配置IPSec安全提议、创建IKE安全提议、配置IKE对等体;
  • 在接口上应用IPSec策略。
  1. 配置Fortinet防火墙:
  • 配置接口的IP地址;
  • 配置IKE SA、IPSec SA;
  • 将Tunnel口加入到untrust区域中;
  • 配置安全策略,允许IKE协商报文、IPSec封装前和解封装后的原始报文能通过Fortinet防火墙;
  • 配置路由,将流量引入到Tunnel接口;
  • 配置连接到Internet的缺省路由。

配置注意事项

  • IPSec的对接关键在于通信双方的对接参数必须完全一致,配置时必须按照数据规划表,保持两端对接参数一致。
  • 在Fortinet防火墙中,没有提供命令设置IKE的版本、封装模式、安全协议,默认值分别为V1、隧道模式、ESP,在华为防火墙侧不要设置错误,否则隧道协商不成功。
  • 华为防火墙、Fortinet防火墙中定义的被保护数据流必须互为镜像,华为防火墙中通过配置ACL定义被保护的数据流,而Fortinet防火墙中执行dst-subnet、src-subnet定义被保护的数据流,相当于华为防火墙中的配置ACL。

操作步骤

1. 配置华为防火墙。

a、配置接口,并将接口加入安全区域。

配置口GE1/0/3接口,并将接口加入untrust安全区域。

[HUAWEI]interfaceGigabitEthernet1/0/3 [HUAWEI-GigabitEthernet1/0/3]ipaddress1.1.1.124 [HUAWEI-GigabitEthernet1/0/3]quit [HUAWEI]firewallzoneuntrust [HUAWEI-zone-untrust]addinterfaceGigabitEthernet1/0/3 [HUAWEI-zone-untrust]quit

配置GE1/0/5接口,并将接口加入trust安全区域。

[HUAWEI]interfaceGigabitEthernet1/0/5 [HUAWEI-GigabitEthernet1/0/5]ipaddress192.168.10.124 [HUAWEI-GigabitEthernet1/0/5]quit [HUAWEI]firewallzonetrust [HUAWEI-zone-trust]addinterfaceGigabitEthernet1/0/5 [HUAWEI-zone-trust]quit

b、配置安全策略。

配置untrust和trust之间的安全策略。

配置策略1,保证分支能够访问总部;配置策略2,保证总部能够访问分支。

[HUAWEI]security-policy [HUAWEI-policy-security]rulename1 [HUAWEI-policy-security-rule-1]source-zoneuntrust [HUAWEI-policy-security-rule-1]destination-zonetrust [HUAWEI-policy-security-rule-1]source-address192.168.0.024 [HUAWEI-policy-security-rule-1]destination-address192.168.10.024 [HUAWEI-policy-security-rule-1]actionpermit [HUAWEI-policy-security-rule-1]quit [HUAWEI-policy-security]rulename2 [HUAWEI-policy-security-rule-2]source-zonetrust [HUAWEI-policy-security-rule-2]destination-zoneuntrust [HUAWEI-policy-security-rule-2]source-address192.168.10.024 [HUAWEI-policy-security-rule-2]destination-address192.168.0.024 [HUAWEI-policy-security-rule-2]actionpermit [HUAWEI-policy-security-rule-2]quit

配置local与untrust之间的安全策略。

配置策略3,保证华为防火墙能够发起IPSec隧道建立请求;配置策略4,保证华为防火墙能够接收IPSec隧道建立请求,源、目的IP地址为两端的出口公网地址。

[HUAWEI-policy-security]rulename3 [HUAWEI-policy-security-rule-3]source-zonelocal [HUAWEI-policy-security-rule-3]destination-zoneuntrust [HUAWEI-policy-security-rule-3]source-address1.1.1.124 [HUAWEI-policy-security-rule-3]destination-address2.2.2.224 [HUAWEI-policy-security-rule-3]actionpermit [HUAWEI-policy-security-rule-3]quit [HUAWEI-policy-security]rulename4 [HUAWEI-policy-security-rule-4]source-zoneuntrust [HUAWEI-policy-security-rule-4]destination-zonelocal [HUAWEI-policy-security-rule-4]source-address2.2.2.224 [HUAWEI-policy-security-rule-4]destination-address1.1.1.124 [HUAWEI-policy-security-rule-4]actionpermit [HUAWEI-policy-security-rule-4]quit

c、配置路由。

配置连接到Internet的缺省路由,假设下一跳为1.1.1.2。

[HUAWEI]iproute-static0.0.0.00.0.0.01.1.1.2

d、配置ACL,定义被保护的流量。

源地址为192.168.10.0/24,目的地址为192.168.0.0/24的报文,需要经过IPSec隧道传输。

[HUAWEI]acl3000 [HUAWEI-acl-adv-3000]rulepermitipsource192.168.10.00.0.0.255destination192.168.0.00.0.0.255 [HUAWEI-acl-adv-3000]quit

说明:

华为防火墙发起协商请求时,将根据路由找到出接口,根据安全策略2判断流量是否可以透传,根据ACL判断是否是走IPSec的流 量,根据安全策略3判断是否能够发起协商,如果判断结果都为“是”,华为防火墙才能正式发起协商。华为防火墙接收协商请求时,将根据ACL判断对方的流量是否是受保护流量,根据安全策略4判断是否接受协商,如果判断结果都为“是”,则开始与对方协商,否则将丢弃协商报文。

e、配置 IKE SA。

配置IKE安全提议,指定加密算法、认证算法、DH。

[HUAWEI]ikeproposal1 [HUAWEI-ike-proposal-1]encryption-algorithm3des [HUAWEI-ike-proposal-1]authentication-algorithmsha1 [HUAWEI-ike-proposal-1]dhgroup2 [HUAWEI-ike-proposal-1]quit

配置IKE对等体,指定协商模式、IKE版本、预共享密钥,对端IP地址。

[HUAWEI]ikepeerfortigate [HUAWEI-ike-peer-fortigate]exchange-modemain [HUAWEI-ike-peer-fortigate]undoversion2 [HUAWEI-ike-peer-fortigate]ike-proposal1 [HUAWEI-ike-peer-fortigate]pre-shared-keyKey@123 [HUAWEI-ike-peer-fortigate]remote-address2.2.2.2 [HUAWEI-ike-peer-fortigate]quit

说明:

Fortinet防火墙中没有提供设置IKE版本的命令,默认使用V1,所以必须执行undo version 2将华为防火墙的IKE版本设置为V1。

f、配置IPSec安全提议,指定封装模式、安全协议,加密算法、认证算法。[HUAWEI]ipsecproposaltran1

[HUAWEI-ipsec-proposal-tran1]transformesp [HUAWEI-ipsec-proposal-tran1]encapsulation-modetunnel [HUAWEI-ipsec-proposal-tran1]espencryption-algorithm3des [HUAWEI-ipsec-proposal-tran1]espauthentication-algorithmsha1 [HUAWEI-ipsec-proposal-tran1]quit

g、配置IPSec策略,绑定IKE对等体、IPSec安全提议、ACL。

[HUAWEI]ipsecpolicymap11isakmp [HUAWEI-ipsec-policy-isakmp-map1-1]ike-peerfortigate [HUAWEI-ipsec-policy-isakmp-map1-1]proposaltran1 [HUAWEI-ipsec-policy-isakmp-map1-1]securityacl3000 [HUAWEI-ipsec-policy-isakmp-map1-1]quith、在接口上应用IPSec策略。[HUAWEI]interfaceGigabitEthernet1/0/3 [HUAWEI-GigabitEthernet1/0/3]ipsecpolicymap1 [HUAWEI-GigabitEthernet1/0/3]quit

2. 配置Fortinet防火墙。

a、配置接口IP地址。

配置接口port03。

Fortigate#configsysteminterface Fortigate(interface)#editport03 Fortigate(port03)#setip2.2.2.2/24 Fortigate(port03)#setallowaccesspinghttpssshsnmphttptelnet Fortigate(port03)#end

配置接口port10。

Fortigate#configsysteminterface Fortigate(interface)#editport10 Fortigate(port10)#setip192.168.0.1/24 Fortigate(port10)#setallowaccesspinghttpssshsnmphttptelnet Fortigate(port10)#end

说明:

Fortinet防火墙中,可以直接针对物理接口配置安全策略,因此无需将接口加入安全区域。也可以将物理接口加入安全区域,然后针对安全区域配置安全策略。

但对于Tunnel接口,必须先将Tunnel接口加入安全区域,才能针对安全区域(Tunnel接口)配置安全策略。

Fortinet防火墙中,执行完配置命令后,必须执行end配置才能生效。

b、配置IKE SA,指定IKE SA的名称、绑定的接口、协商模式、加密算法、认证算法、预共享密钥、对端地址、DH。

Fortigate#configvpnipsecphase1-interface Fortigate(phase1-interface)#editfirewall newentry'firewall'added Fortigate(firewall)#setinterfaceport03 Fortigate(firewall)#setmodemain Fortigate(firewall)#setproposal3des-sha1 Fortigate(firewall)#setpsksecretKey@123 Fortigate(firewall)#setremote-gw1.1.1.1 Fortigate(firewall)#setdhgrp2 Fortigate(firewall)#end

说明:Fortinet防火墙中没有提供设置IKE版本的命令,默认使用V1。

执行set interface将IKE SA绑定到指定的端口上,相当于在华为防火墙中将IPSec策略应用到接口。

执行set proposal 3des-sha1设置IKE SA的加密算法(3des)、认证算法(sha1)。

c、配置IPSec SA,指定IPSec SA的名称、绑定的IKE SA、加密算法、认证算法,DH。

Fortigate#configvpnipsecphase2-interface Fortigate(phase2-interface)#editfirewall newentry'firewall'added Fortigate(firewall)#setphase1namefirewall Fortigate(firewall)#setdhgrp2 Fortigate(firewall)#setproposal3des-sha1 Fortigate(firewall)#setdst-subnet192.168.10.0255.255.255.0 Fortigate(firewall)#setsrc-subnet192.168.0.0255.255.255.0 Fortigate(firewall)#end

说明;

Fortinet防火墙中没有提供设置封装模式、安全协议的命令,默认使用隧道模式、ESP。

执行set phase1name指定IPSec SA引用的IKE SA。

执行set proposal 3des-sha1设置IPSec SA的加密算法(3des)、认证算法(sha1)。

执行dst-subnet、src-subnet定义被保护的数据流,相当于在华为防火墙中配置ACL。

d、将Tunnel口加入到untrust区域中。

Fortigate#configsystemzone Fortigate(zone)#edituntrust Fortigate(untrust)#setinterfacefirewall Fortigate(untrust)#end

说明:

IKE SA配置成功后,设备中将自动生成与IKE SA同名的Tunnel接口,受保护流量将经过该Tunnel接口。Fortinet防火墙中,必须将Tunnel接口加入安全区域后,才能针对安全区域(Tunnel接口)配置安全策略。

e、配置安全策略。

配置port03与port10之间的安全策略。

配置策略66,保证总部能够正常访问分支;配置策略99,保证分支能够访问总部。

Fortigate#configfirewallpolicy Fortigate(policy)#edit66 Fortigate(66)#setsrcintfport03 Fortigate(66)#setdstintfport10 Fortigate(66)#setsrcaddrall Fortigate(66)#setdstaddrall Fortigate(66)#setactionaccept Fortigate(66)#setschedulealways Fortigate(66)#setserviceANY Fortigate(66)#end Fortigate#configfirewallpolicy Fortigate(policy)#edit99 Fortigate(99)#setsrcintfport10 Fortigate(99)#setdstintfport03 Fortigate(99)#setsrcaddrall Fortigate(99)#setdstaddrall Fortigate(99)#setactionaccept Fortigate(99)#setschedulealways Fortigate(99)#setserviceANY Fortigate(99)#end

配置untrust与port10的安全策略,也就是Tunnel接口与port10之间的安全策略。

配置策略96,保证经过Tunnel接口的流量能够进入分支内网;配置策略76,保证经过Tunnel接口的流量能够透传到外网。

Fortigate#configfirewallpolicy Fortigate(policy)#edit96 Fortigate(96)#setsrcintfuntrust Fortigate(96)#setdstintfport10 Fortigate(96)#setsrcaddrall Fortigate(96)#setdstaddrall Fortigate(96)#setactionaccept Fortigate(96)#setschedulealways Fortigate(96)#setserviceANY Fortigate(96)#end Fortigate#configfirewallpolicy Fortigate(policy)#edit76 Fortigate(76)#setsrcintfport10 Fortigate(76)#setdstintfuntrust Fortigate(76)#setsrcaddrall Fortigate(76)#setdstaddrall Fortigate(76)#setactionaccept Fortigate(76)#setschedulealways Fortigate(76)#setserviceANY Fortigate(76)#end

说明:

Fortinet防火墙中,无需配置untrust和local之间的安全策略。

f、配置路由。

配置静态路由,将流量引入到Tunnel接口。

Fortigate#configroutestatic Fortigate(static)#edit76 Fortigate(76)#setdevicefirewall Fortigate(76)#setdst192.168.10.0255.255.255.0 Fortigate(76)#end

配置连接到Internet的缺省路由,下一跳为2.2.2.3,经过端口port03。

Fortigate#configrouterstatic Fortigate(static)#edit33 Fortigate(33)#setdst0.0.0.00.0.0.0 Fortigate(33)#setgateway2.2.2.3 Fortigate(33)#setdeviceport03 Fortigate(33)#end

结果验证

1. 验证总部是否可以主动与分支建立IPSec隧道。

a、在总部的PC1中Ping分支网络中的PC2。b、在总部华为防火墙中,执行display ike sa命令,若显示如下信息,表明IKE SA建立成功。

<HUAWEI>displayikesa currentikesanumber:2 -------------------------------------------------------------------------------------------------- conn-idpeerflagphasevpn -------------------------------------------------------------------------------------------------- 122.2.2.2RD|ST|Av1:2public 112.2.2.2RD|ST|Av1:1public flagmeaning RD--READYST--STAYALIVERL--REPLACEDFD--FADINGTO--TIMEOUT TD--DELETINGNEG--NEGOTIATINGD--DPDM--ACTIVES--STANDBY A--ALONEa、

在总部的PC1中Ping分支网络中的PC2。b、在总部华为防火墙中,执行display ike sa命令,若显示如下信息,表明IKE SA建立成功。

<HUAWEI>displayikesa currentikesanumber:2 -------------------------------------------------------------------------------------------------- conn-idpeerflagphasevpn -------------------------------------------------------------------------------------------------- 122.2.2.2RD|ST|Av1:2public 112.2.2.2RD|ST|Av1:1public flagmeaning RD--READYST--STAYALIVERL--REPLACEDFD--FADINGTO--TIMEOUT TD--DELETINGNEG--NEGOTIATINGD--DPDM--ACTIVES--STANDBY A--ALONEd、

登录到分支Fortinet防火墙的Web管理界面中查看IPSec隧道建立情况。

如果隧道的状态显示为绿色向上的箭头,表明IPSec隧道建立成功。

也可以在分支Fortinet防火墙中执行get ipsec tunnel list查看IPSec隧道建立情况,如果状态为up,则IPSec隧道建立成功。

2. 验证分支是否可以主动与总部建立IPSec隧道。

a、在总部的华为防火墙中执行reset ike sa命令,断开IPSec隧道。b、在分支的PC2中Ping总部网络中的PC1,参照上述方法验证是否可以建立IPSec隧道。

相关文章
|
4月前
|
安全 网络协议 Shell
【内网安全】 域防火墙&入站出站规则&不出网隧道上线&组策略对象同步
【内网安全】 域防火墙&入站出站规则&不出网隧道上线&组策略对象同步
|
5月前
|
网络协议 安全 网络安全
二层交换机与防火墙对接上网配置示例
二层交换机指的是仅能够进行二层转发,不能进行三层转发的交换机。也就是说仅支持二层特性,不支持路由等三层特性的交换机。 二层交换机一般部署在接入层,不能作为用户的网关
|
5月前
|
网络协议 网络安全 网络虚拟化
三层交换机与防火墙对接上网配置示例
三层交换机是具有路由功能的交换机,由于路由属于OSI模型中第三层网络层的功能,所以称为三层交换机。 三层交换机既可以工作在二层也可以工作在三层,可以部署在接入层,也可以部署在汇聚层,作为用户的网关。
|
安全 网络安全
简述防火墙安全区域划分和组网模式及小实验案例
简述防火墙安全区域划分和组网模式及小实验案例
202 1
简述防火墙安全区域划分和组网模式及小实验案例
|
网络安全 网络虚拟化 数据安全/隐私保护
ASA防火墙和路由器配置IPSec VPN
ASA防火墙和路由器配置IPSec VPN
ASA防火墙和路由器配置IPSec VPN
|
网络协议 Linux 网络安全
【Linux】iptables之防火墙的应用及案例、策略、备份与还原(2)
实验环境:为网关、Web 服务器配置防火墙规则 需求描述: 1、为网站服务器编写入站规则
463 0
【Linux】iptables之防火墙的应用及案例、策略、备份与还原(2)
|
网络协议 测试技术 网络安全
iptables防火墙规则导致端口不通的案例分析
iptables防火墙规则导致服务器的8080端口访问不通,telnet连接测试提示 No route to host
23652 0
|
安全 算法 网络安全
如何在ASA防火墙上实现ipsec ***
如何在ASA防火墙上实现ipsec *** 2017-05-30 22:10:51 防火墙 ASA 实现 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。
1185 0
下一篇
无影云桌面