以前写过总部与两个分支机构、三台华为防火墙配置ipsec,都是同一个品牌,相对来说配置比较简单。
今天这个案例,分支机构采用的是飞塔的防火墙,接入链路是电信的PPPOE拨号宽带,没有固定的公网IP;总部则是华为防火墙,有固定的公网IP。
一、客户需求
华为防火墙作为总部的企业网关,以模板方式与分支机构的飞塔防火墙建立IPSec隧道;由于分支机构的飞塔防火墙的出口公网地址不固定,因此,只能是分支主动发起协商建立IPSec隧道,总部不能主动发起协商。
IPSec配置参数规划如下图所示:
二、配置过程
1、华为防火墙的配置
华为防火墙采用模板方式的IPSec策略,不要求对端IP地址固定,且不管有多少分支,总部只需要配置1个IPSec策略,1个IKE对等体,配置较为简单;如果采用策略方式的IPSec策略,有N个分支,则总部需要配置N个IPSec策略,N个IKE对等体,配置较为复杂。
(1)配置接口,并将接口加入相应的安全区域。
配置口GE1/0/3接口,并将接口加入untrust安全区域。
[HUAWEI]interfaceGigabitEthernet1/0/3
[HUAWEI-GigabitEthernet1/0/3]ipaddress.xx.xx.
[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]ipaddress...
[HUAWEI-GigabitEthernet1/0/5]quit
[HUAWEI]firewallzonetrust
[HUAWEI-zone-trust]addinterfaceGigabitEthernet1/0/5
[HUAWEI-zone-trust]quit
(2)配置安全策略。
配置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-address..60.
[HUAWEI-policy-security-rule-1]destination-address...
[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-address...
[HUAWEI-policy-security-rule-2]destination-address..60.
[HUAWEI-policy-security-rule-2]actionpermit
[HUAWEI-policy-security-rule-2]quit
(3)配置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-address.xx.xx.
[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]destination-address.xx.xx.
[HUAWEI-policy-security-rule-4]actionpermit
[HUAWEI-policy-security-rule-4]quit
(4)配置路由。
配置连接到Internet的缺省路由
[HUAWEI]iproute-static0.0.0.00.0.0.0.xx.xx.49
(5)配置ACL
源地址为...0/24,目的地址为..60.0/24的报文,需要经过IPSec隧道传输。
[HUAWEI]acl
[HUAWEI-acl-adv-]rulepermitipsource...00.0.0.destination..60.00.0.0.
[HUAWEI-acl-adv-]quit
(6)配置IKESA。
配置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版本、预共享密钥。
[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
hcit[HUAWEI-ike-peer-fortigate]quit
(7)配置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
(8)配置模板及策略,绑定IKE对等体、IPSe安全提议、ACL。
[HUAWEI]ipsecpolicy-templatetem1
[HUAWEI-ipsec-policy-template-tem-1]securityacl
[HUAWEI-ipsec-policy-template-tem-1]proposaltran1
[HUAWEI-ipsec-policy-template-tem-1]ike-peerfortigate
[HUAWEI-ipsec-policy-template-tem-1]ipsecpolicymap11isakmptemplatetem
[HUAWEI-ipsec-policy-template-tem-1]quit
(9)在接口上应用IPSec策略。
[HUAWEI]interfaceGigabitEthernet1/0/3
[HUAWEI-GigabitEthernet1/0/3]ipsecpolicymap1
[HUAWEI-GigabitEthernet1/0/3]quit
2、飞塔防火墙的配置
(1)配置接口
配置接口port03的宽带连接
Fortigate#configsysteminterface
Fortigate(interface)#editport03
Fortigate(port03)#setmodepppoe
Fortigate(port03)#setusernamexxxxxx
Fortigate(port03)#setpasswordxxxxxx
Fortigate(port03)#setdistance5
*注意管理距离(distance),固定IP的distance值为10,PPPoE拨号的distance值为5
Fortigate(port03)#setdns-server-overrideenable
Fortigate(port03)#end
配置接口port10。
Fortigate#configsysteminterface
Fortigate(interface)#editport10
Fortigate(port10)#setip..60.1/24
Fortigate(port10)#setallowaccessping