防火墙在核心网PS域中的应用
简介
本案例介绍了防火墙在核心网PS域中的应用。通过分析移动核心网面临的安全问题,本案例给出了典型的应用方案。
基于Eudemon200E-N&Eudemon1000E-N&Eudemon8000E-X V500R005C00版本写作,可供Eudemon200E-N&Eudemon1000E-N&Eudemon8000E-X V500R005C00、Eudemon200E-G&Eudemon1000E-G V600R006C00及后续版本参考。不同版本之间可能存在差异,请以实际版本为准。
方案简介
移动核心网简介
移动网络架构如图1-1所示,数据从移动终端到达Internet,需要经过移动接入/汇聚网络(又叫RAN)和移动核心网络。
2G/3G的移动核心网络分为CS域(Circuit Switch,电路交换)和PS域(Packet Switch,分组交换)。CS域主要用来处理语音业务(如打电话);PS域主要用来提供数据业务(如上网)。
LTE(Long Term Evolution)是3G的演进技术,目前主流运营商都把LTE作为4G网络的发展方向。LTE包括E-UTRAN(无线接入子系统)和SAE(核心网子系统)。LTE架构完全建立在分组交换域之上,取消了2G/3G的CS域。LTE核心网也被称为EPC(Evolved Packet Core)。
FW在移动核心网中的应用
由于IPv4网络公网地址资源有限,移动终端在核心网分配的一般是私网地址,很少会直接分配公网地址,当移动终端访问Internet时需要进行地址转换。
如图1-1所示,FW部署在移动核心网的Internet出口(2G/3G的Internet出口叫做Gi口,4G的Internet出口叫做SGi口)。FW主要提供NAT功能,除此之外,还有域间隔离和边界防护的作用。
流量模型
FW上的流量主要是来自Gi/SGi口,这些流量一部分直接到Internet,另外一部分到WAP网关(通过WAP网关再到Internet)。从移动终端直接到Internet的流量称为Internet业务,从移动终端到WAP网关的流量称为WAP业务。Internet业务和WAP业务也统称为Gi/SGi流量。
除了Gi/SGi流量外,有时Gn流量也会经过防火墙。Gn流量是指本地的GGSN(P-GW)和SGSN(S-GW)之间通信的流量。
各种业务流量路径示意如下:
- Internet业务
移动终端 > SGSN(S-GW) > GGSN(P-GW) > 防火墙 > 骨干网 > Internet
移动终端的报文经过接入/汇聚网络和核心网络后到达Gi/SGi口,然后在FW上进行NAT转换后到达Internet。这种情况下FW处理的是来自移动终端的原始TCP/UDP报文。
- WAP业务
移动终端 > SGSN(S-GW) > GGSN(P-GW) > 防火墙 > 骨干网 > WAP网关
GGSN(P-GW)和WAP网关直接建立GRE隧道,流量被送到WAP网关上,通过WAP做代理访问Internet上的业务。这种情况下FW处理的是GRE报文。4G网络下该业务萎缩。
方案设计
典型组网
组网图
FW部署在移动核心网Gi/SGi出口时的典型组网如图1-2业务接口工作在三层,到骨干网和GGSN/P-GW都通过路由器连接。
FW在此组网中部署如下功能:
- 在FW配置HRP功能,使两台FW以主备备份方式工作,提高网络可靠性,避免单点故障。防火墙之间互连线作为心跳线,协商主备关系和备份状态数据。
备份数据较大时,建议部署多条心跳线。通常一条10GE接口作为HRP备份通道时可以承载5万/秒的新建速率、或者500万并发会话、或者5G的业务流量,可以根据现网业务实际流量大小来评估备份通道所需的接口数量,推荐用N+1的方式增加冗余。比如业务流量有1000万并发会话,至少需要2个10GE口作为备份通道,规划时则用3个10GE口捆绑增加冗余。
- 防火墙与上下行设备间部署OSPF协议,其中与上行骨干网间运行在OSPF1进程;与下行GGSN网络运行在OSPF2进程。
配置hrp adjust ospf-cost enable命令,启动根据主备状态调整OSPF的COST值功能,用于HRP和OSPF联动。正常情况下,备用防火墙发布OSPF路由时COST值都加上65500,使路由优先选择走主用防火墙。当FW的接口或整机发生故障时,触发双机倒换,调整COST值,原主用链路OSPF路由COST值加上65500,原备用防火墙COST值减小,路由优先选择原备用防火墙,实现路由切换,从而保证业务不中断。
- FW上下行接口配置hrp track功能监控此上下行接口。
- 在OSPF2进程中配置非强制下发缺省路由,引导流量从防火墙转发到骨干网。
- 在FW与上下行设备间有传输设备的情况下,通过配置hrp track bfd功能,用于监控链路故障。
通过配置命令bfd cfg-name bind peer-ip peer-ip [ interface interface-type interface-number ],创建BFD会话绑定,指定需要检测链路。同时,配置process-interface-status命令,使当前BFD会话与其绑定的接口进行状态联动。
如果对端设备不支持BFD,可通过配置IP-Link来保证此类故障情况下的主备倒换。
可靠性分析
当主用防火墙FW_A整机发生故障时,故障切换如图1-3所示。具体过程如下:
- 故障切换:
FW_A整机故障,FW_B切换为主用防火墙,同时RouterA、RouterC与FW_A的OSPF邻居关系断开,路由切换到FW_B上。
- 故障恢复:
FW_A故障恢复后,FW_A与RouterA、RouterC邻居关系恢复,并抢占为主用防火墙,路由重新指向FW_A,流量也重新切换回FW_A。
当与主用防火墙FW_A相连的链路发生故障时(到骨干网侧的链路或者到GGSN/P-GW的链路),故障切换如图1-4所示。具体过程如下:
- 故障切换:
链路发生故障时,FW_A切换为备用防火墙,同时与RouterA(RouterC)邻居关系断开,FW_B切换为主用防火墙,调整OSPF路由Cost值,优选右侧路由,流量切换到右侧。
- 故障恢复:
链路故障恢复后,FW_A抢占为主用防火墙,FW_A与RouterA(RouterC)邻居关系也恢复正常,路由切换回FW_A,流量切换回左侧链路。
业务规划
接口和安全区域
为了避免心跳接口故障导致双机通信异常,心跳接口建议使用Eth-trunk接口。对于支持扩展多个接口卡的设备(具体支持情况,请查阅硬件指南),必须使用跨板Eth-Trunk接口,即一个Eth-Trunk的成员接口来自于不同的接口板,这样既提高了可靠性,又增加了备份通道的带宽。对于无接口扩展能力无法使用跨板Eth-Trunk的设备,可能存在一块接口卡故障导致所有HRP备份通道不可用、业务受损。
上下行物理链路的带宽必须保持一致,且带宽要大于峰值流量,避免在流量突发的情况下,导致流量拥塞影响业务。
FW上的接口和安全区域规划如表1-1所示。
FW_A |
FW_B |
描述 |
---|---|---|
Eth-Trunk0:
|
Eth-Trunk0:
|
HRP备份接口。 |
Eth-Trunk1:
|
Eth-Trunk1:
|
连接Internet的接口。 |
Eth-Trunk2:
|
Eth-Trunk2:
|
Eth-Trunk2是用来连接Gi/SGi业务的接口。 |
安全策略
FW上的安全策略规划如表1-2所示。
项目 |
源安全区域 |
目的安全区域 |
说明 |
---|---|---|---|
Local - Trust |
Local |
Trust |
FW自身访问Trust区域的安全策略,可以配置为允许所有报文通过。如果要配置更加精细化的策略,注意需要允许OSPF报文通过。 |
Trust |
Local |
Trust区域访问FW的安全策略,可以配置为:
|
|
Local - Untrust |
Local |
Untrust |
FW自身访问Untrust区域的安全策略,可以配置为允许所有报文通过。如果要配置更加精细化的策略,注意需要允许OSPF报文通过。 |
Untrust |
Local |
Untrust区域访问FW的安全策略,可以配置为:
|
|
Local - hrpzone |
Local |
hrpzone |
主备防火墙的备份接口之间的安全策略,配置后可用于防火墙之间的跳转登录。 |
hrpzone |
local |
主备防火墙的备份接口之间的安全策略,配置后可用于防火墙之间的跳转登录。 |
|
Trust - Untrust |
Trust |
Untrust |
|
Untrust |
Trust |
针对GRE隧道的WAP侧终点路由器和起点GGSN配置包过滤。 |
路由
路由规划要点如下:
- 防火墙上针对NAT地址配置黑洞路由,通过引入静态路由方式发布路由,同时可以避免环路。
- 防火墙从Internet侧设备学习到默认路由,并将默认路由通过OSPF非强制下发方式发布到核心网侧设备。另外还需要配置路由策略,防火墙和Internet侧引入静态路由时,仅发布NAT地址池路由,其他私网地址不发布。
- 防火墙从核心网侧设备学习到内网服务器,及终端用户IP地址,并将服务器的路由发布到Internet侧设备。防火墙和核心网侧设备配置过滤策略,不要从下面学习默认路由。
FW上的路由规划如表1-3所示。
FW_A |
FW_B |
描述 |
---|---|---|
|
|
通过OSPF学习到的缺省路由。 |
|
|
通过OSPF学习到的去往GGSN侧网络的路由 |
|
|
黑洞路由,防止路由环路。 |
NAT
移动终端用户如果获取的IP地址为私网地址,需要在FW上进行NAT转换,采用转换后的公网地址后访问Internet业务。通过NAT转换减少了公网地址的占用,同时也提高了内网的安全性。
FW通常采用NAT PAT方式,根据经验,一个NAT地址大概可以支持5000~10000私网IP地址做NAT转换。NAT地址池规划如表1-4所示,主备防火墙的规划保持一致。
NAT策略规划如表1-5所示。
项目 |
FW_A |
FW_B |
---|---|---|
安全区域 |
Trust - Untrust |
Trust - Untrust |
方向 |
Outbound |
Outbound |
匹配条件 |
匹配来自10.10.0.0/16网段的所有报文 |
匹配来自10.10.0.0/16网段的所有报文 |
动作 |
source-nat |
source-nat |
NAT地址池编号 |
1 |
1 |
移动终端去往Internet的FTP、RTSP、PPTP多通道业务流量,经过FW时做了NAT,需要在Gi/SGi接口所在的区域和Untrust区域之间配置ASPF功能,确保这些应用能正常运行。
攻击防范
在FW上开启攻击防范功能进行安全防护。推荐配置如下:
firewall defend land enable
firewall defend smurf enable
firewall defend fraggle enable
firewall defend ip-fragment enable
firewall defend tcp-flag enable
firewall defend winnuke enable
firewall defend source-route enable
firewall defend teardrop enable
firewall defend route-record enable
firewall defend time-stamp enable
firewall defend ping-of-death enable
网管(SNMP)
简单网络管理协议(SNMP)是目前TCP/IP网络中应用最为广泛的网络管理协议。请在FW上配置SNMP代理以便通过网管服务器对此设备进行管理。
日志(elog)
通过elog日志服务器采集NAT会话日志,用于溯源。请在FW上配置向elog服务器输出会话日志,以及日志的输出格式和源地址、源端口等信息。
注意事项
双机热备
- 推荐配置VGMP管理组的抢占延迟时间为300秒。
- 双机热备仅支持OSPF和BGP路由调整,不支持ISIS。如果配置了OSPF或BGP路由调整,需要在域间配置允许OSPF或BGP报文通过。
双机热备组网中,上行运行BGP协议,下行运行OSPF协议,OSPF中使用default-route-advertise产生默认路由的情况下,为避免环路,需进行如下配置:
- 要把BGP路由的优先级修改为大于10小于150。
区域内路由的默认优先级是10(优先级最高),默认路由是外部路由,默认优先级是150,BGP路由的默认优先级是255(优先级最低),如果采用默认优先级,则BGP路由无法生效。
- 配置路由过滤,避免从下行OSPF学习默认路由。
如果上行设备学习了下行的默认路由,则上行设备的流量无法到达外网。
- 要把BGP路由的优先级修改为大于10小于150。
- HRP和路由协议联动调整COST值,其中路由支持情况如表1-6所示:
表1-6 HRP联动的BGP/OSPF路由
项目
支持情况
支持HRP联动的BGP路由
按路由类型划分
- BGP IPv4单播路由
- BGP VPNv4路由
- BGP IPv6单播路由
按路由来源划分
- 从IBGP邻居学来的路由
- 从EBGP邻居学来的路由
- 从其他协议引入的路由
- 自己发布的默认路由
支持HRP联动的OSPF路由
按路由来源划分
- Network的直连路由
- 引入的外部路由
- 自己发布的缺省路由
按LSA类型划分
- Type 1 LSA:router LSA
- Type 3 LSA:summary LSA
- Type 5 LSA:AS-external-LSA
- Type 7 LSA:NSSA AS-external-LSA
安全策略
从安全角度考虑,域间安全策略按照安全策略规划来设计,严禁放开所有域间安全策略。
攻击防范
攻击防范按照推荐配置进行配置。
NAT
- 规划NAT地址池时,公网地址和私网地址按照1:5,000左右规划。
- 如果核心网内部有服务器提供给外网访问,建议配置NAT Server时基于端口进行映射,不要做IP地址一对一映射。
- NAT模式建议使用默认方式即五元组NAT,若客户要求使用三元组NAT,需要提交服务或研发重新评估方案。
- 在负载分担双机热备份模式下,两台设备都会承载业务流量。当设备上配置了NAT功能时,在NAPT模式下有可能两台设备分配的公网端口出现冲突。为了避免这种可能存在的冲突,需要在两台设备上分别配置各自可使用的NAT端口资源。可以在主设备上配置hrp nat resource primary-group命令,备设备上会自动生成hrp nat resource secondary-group命令
- 建议针对NAT地址池配置黑洞路由,以免出现路由环路等问题。
GRE
当满足如下条件时,推荐开启使用GRE内层报文HASH选择CPU功能,以保证流量均匀的分布在多个CPU上。
- 所有的流量都经过一条或几条GRE隧道封装。
- 单个GRE隧道所在的CPU会话数大于100万条。
执行firewall gre inner hash enable命令,开启根据GRE内层报文信息计算的HASH选择CPU的功能。
性能
在负载分担双机热备份模式下,流量切换到单边后确保不超过接口带宽利用率和业务板CPU处理能力的70%。可通过display interface命令查看接口带宽利用率,display cpu-usage命令查看业务板CPU处理。
方案配置
配置步骤
操作步骤
- 配置接口和安全区域
- 配置FW_A的接口和安全区域。
# 创建Eth-Trunk0,配置Eth-Trunk0的IP地址。
<FW_A> system-view [FW_A] interface Eth-Trunk 0 [FW_A-Eth-Trunk0] description To_FW_B [FW_A-Eth-Trunk0] ip address 192.168.3.1 24 [FW_A-Eth-Trunk0] undo service-manage enable [FW_A-Eth-Trunk0] quit
# 创建Eth-Trunk1,配置Eth-Trunk1的IP地址。
[FW_A] interface Eth-Trunk 1 [FW_A-Eth-Trunk1] description To_Backbone [FW_A-Eth-Trunk1] ip address 1.1.1.1 24 [FW_A-Eth-Trunk1] undo service-manage enable [FW_A-Eth-Trunk1] quit
# 创建Eth-Trunk2,配置Eth-Trunk2的IP地址。
[FW_A] interface Eth-Trunk 2 [FW_A-Eth-Trunk2] description To_GI [FW_A-Eth-Trunk2] ip address 10.14.1.1 24 [FW_A-Eth-Trunk2] undo service-manage enable [FW_A-Eth-Trunk2] quit
# 将接口GigabitEthernet1/0/1和GigabitEthernet2/0/1加入Eth-Trunk0。
[FW_A] interface GigabitEthernet 1/0/1 [FW_A-GigabitEthernet2/0/0] Eth-Trunk 0 [FW_A-GigabitEthernet2/0/0] quit [FW_A] interface GigabitEthernet 2/0/1 [FW_A-GigabitEthernet2/0/1] Eth-Trunk 0 [FW_A-GigabitEthernet2/0/1] quit
# 将接口GigabitEthernet2/0/2和GigabitEthernet2/0/3加入Eth-Trunk1。
[FW_A] interface GigabitEthernet 2/0/2 [FW_A-GigabitEthernet2/0/2] Eth-Trunk 1 [FW_A-GigabitEthernet2/0/2] quit [FW_A] interface GigabitEthernet 2/0/3 [FW_A-GigabitEthernet2/0/3] Eth-Trunk 1 [FW_A-GigabitEthernet2/0/3] quit
# 将接口GigabitEthernet2/0/4和GigabitEthernet2/0/5加入Eth-Trunk2。
[FW_A] interface GigabitEthernet 2/0/4 [FW_A-GigabitEthernet2/0/4] Eth-Trunk 2 [FW_A-GigabitEthernet2/0/4] quit [FW_A] interface GigabitEthernet 2/0/5 [FW_A-GigabitEthernet2/0/5] Eth-Trunk 2 [FW_A-GigabitEthernet2/0/5] quit
# 将Eth-Trunk0加入hrpzone区域。
[FW_A] firewall zone name hrpzone [FW_A-zone-hrpzone] set priority 65 [FW_A-zone-hrpzone] add interface Eth-Trunk 0 [FW_A-zone-hrpzone] quit
# 将Eth-Trunk1加入untrust区域。
[FW_A] firewall zone untrust [FW_A-zone-untrust] add interface Eth-Trunk 1 [FW_A-zone-untrust] quit
# 将Eth-Trunk2加入trust区域。
[FW_A] firewall zone trust [FW_A-zone-trust] add interface Eth-Trunk 2 [FW_A-zone-trust] quit
- 配置FW_B的接口和安全区域。
# 创建Eth-Trunk0,配置Eth-Trunk0的IP地址。
<FW_B> system-view [FW_B] interface Eth-Trunk 0 [FW_B-Eth-Trunk0] description To_FW_A [FW_B-Eth-Trunk0] ip address 192.168.3.2 24 [FW_B-Eth-Trunk0] undo service-manage enable [FW_B-Eth-Trunk0] quit
# 创建Eth-Trunk1,配置Eth-Trunk1的IP地址。
[FW_B] interface Eth-Trunk 1 [FW_B-Eth-Trunk1] description To_Backbone [FW_B-Eth-Trunk1] ip address 1.1.2.1 24 [FW_B-Eth-Trunk1] undo service-manage enable [FW_B-Eth-Trunk1] quit
# 创建Eth-Trunk2,配置Eth-Trunk2的IP地址。
[FW_B] interface Eth-Trunk 2 [FW_B-Eth-Trunk2] description To_GI [FW_B-Eth-Trunk2] ip address 10.14.2.1 24 [FW_B-Eth-Trunk2] undo service-manage enable [FW_B-Eth-Trunk2] quit
# 将接口GigabitEthernet1/0/1和GigabitEthernet2/0/1加入Eth-Trunk0。
[FW_B] interface GigabitEthernet 1/0/1 [FW_B-GigabitEthernet2/0/0] Eth-Trunk 0 [FW_B-GigabitEthernet2/0/0] quit [FW_B] interface GigabitEthernet 2/0/1 [FW_B-GigabitEthernet2/0/1] Eth-Trunk 0 [FW_B-GigabitEthernet2/0/1] quit
# 将接口GigabitEthernet2/0/2和GigabitEthernet2/0/3加入Eth-Trunk1。
[FW_B] interface GigabitEthernet 2/0/2 [FW_B-GigabitEthernet2/0/2] Eth-Trunk 1 [FW_B-GigabitEthernet2/0/2] quit [FW_B] interface GigabitEthernet 2/0/3 [FW_B-GigabitEthernet2/0/3] Eth-Trunk 1 [FW_B-GigabitEthernet2/0/3] quit
# 将接口GigabitEthernet2/0/4和GigabitEthernet2/0/5加入Eth-Trunk2。
[FW_B] interface GigabitEthernet 2/0/4 [FW_B-GigabitEthernet2/0/4] Eth-Trunk 2 [FW_B-GigabitEthernet2/0/4] quit [FW_B] interface GigabitEthernet 2/0/5 [FW_B-GigabitEthernet2/0/5] Eth-Trunk 2 [FW_B-GigabitEthernet2/0/5] quit
# 将Eth-Trunk0加入hrpzone区域。
[FW_B] firewall zone name hrpzone [FW_B-zone-hrpzone] set priority 65 [FW_B-zone-hrpzone] add interface Eth-Trunk 0 [FW_B-zone-hrpzone] quit
# 将Eth-Trunk1加入untrust区域。
[FW_B] firewall zone untrust [FW_B-zone-untrust] add interface Eth-Trunk 1 [FW_B-zone-untrust] quit
# 将Eth-Trunk2加入trust区域。
[FW_B] firewall zone trust [FW_B-zone-trust] add interface Eth-Trunk 2 [FW_B-zone-trust] quit
- 配置FW_A的接口和安全区域。
- 配置安全策略
- 配置FW_A的安全策略。
# 配置Local和Trust域间的安全策略。
[FW_A] security-policy [FW_A-policy-security] rule name local_trust_outbound [FW_A-policy-security-rule-local_trust_outbound] source-zone local [FW_A-policy-security-rule-local_trust_outbound] destination-zone trust [FW_A-policy-security-rule-local_trust_outbound] source-address 10.14.1.0 24 [FW_A-policy-security-rule-local_trust_outbound] action permit [FW_A-policy-security-rule-local_trust_outbound] quit [FW_A-policy-security] rule name local_trust_inbound [FW_A-policy-security-rule-local_trust_inbound] source-zone trust [FW_A-policy-security-rule-local_trust_inbound] destination-zone local [FW_A-policy-security-rule-local_trust_inbound] destination-address 10.14.1.0 24 [FW_A-policy-security-rule-local_trust_inbound] action permit [FW_A-policy-security-rule-local_trust_inbound] quit
# 配置Local和Untrust域间的安全策略。
[FW_A-policy-security] rule name local_untrust_outbound [FW_A-policy-security-rule-local_untrust_outbound] source-zone local [FW_A-policy-security-rule-local_untrust_outbound] destination-zone untrust [FW_A-policy-security-rule-local_untrust_outbound] source-address 1.1.1.0 24 [FW_A-policy-security-rule-local_untrust_outbound] action permit [FW_A-policy-security-rule-local_untrust_outbound] quit [FW_A-policy-security] rule name local_untrust_inbound [FW_A-policy-security-rule-local_untrust_inbound] source-zone untrust [FW_A-policy-security-rule-local_untrust_inbound] destination-zone local [FW_A-policy-security-rule-local_untrust_inbound] destination-address 1.1.1.0 24 [FW_A-policy-security-rule-local_untrust_inbound] action permit [FW_A-policy-security-rule-local_untrust_inbound] quit
# 配置Local和hrpzone域间的安全策略。
[FW_A-policy-security] rule name local_hrpzone_outbound [FW_A-policy-security-rule-local_hrpzone_outbound] source-zone local [FW_A-policy-security-rule-local_hrpzone_outbound] destination-zone hrpzone [FW_A-policy-security-rule-local_hrpzone_outbound] source-address 192.168.3.0 24 [FW_A-policy-security-rule-local_hrpzone_outbound] action permit [FW_A-policy-security-rule-local_hrpzone_outbound] quit [FW_A-policy-security] rule name local_hrpzone_inbound [FW_A-policy-security-rule-local_hrpzone_inbound] source-zone hrpzone [FW_A-policy-security-rule-local_hrpzone_inbound] destination-zone local [FW_A-policy-security-rule-local_hrpzone_inbound] destination-address 192.168.3.0 24 [FW_A-policy-security-rule-local_untrust_inbound] action permit [FW_A-policy-security-rule-local_untrust_inbound] quit
# 配置Trust和Untrust域间的安全策略,允许移动终端访问WAP网关的隧道报文通过。请根据实际场景配置更加精细的安全策略。
[FW_A-policy-security] rule name trust_untrust_outbound1 [FW_A-policy-interzone-trust_untrust_outbound1] source-zone trust [FW_A-policy-interzone-trust_untrust_outbound1] destination-zone untrust [FW_A-policy-interzone-trust_untrust_outbound1] action permit [FW_A-policy-interzone-trust_untrust_outbound1] quit [FW_A-policy-security] rule name trust_untrust_inbound1 [FW_A-policy-interzone-trust_untrust_inbound1] source-zone untrust [FW_A-policy-interzone-trust_untrust_inbound1] destination-zone trust [FW_A-policy-interzone-trust_untrust_inbound1] action permit [FW_A-policy-interzone-trust_untrust_inbound1] quit
# 配置Trust和Untrust域间的安全策略,允许移动终端访问Internet的报文通过。此处以匹配来自10.10.0.0/16网段的所有报文为例进行介绍,在具体应用中,请根据实际情况增加规则。
[FW_A-policy-security] rule name trust_untrust_outbound2 [FW_A-policy-security-rule-trust_untrust_outbound2] source-zone trust [FW_A-policy-security-rule-trust_untrust_outbound2] destination-zone untrust [FW_A-policy-security-rule-trust_untrust_outbound2] source-address 10.10.0.0 16 [FW_A-policy-security-rule-trust_untrust_outbound2] action permit [FW_A-policy-security-rule-trust_untrust_outbound2] quit
- 配置FW_B的安全策略。
# 配置Local和Trust域间的安全策略。
[FW_B] security-policy [FW_B-policy-security] rule name local_trust_outbound [FW_B-policy-security-rule-local_trust_outbound] source-zone local [FW_B-policy-security-rule-local_trust_outbound] destination-zone trust [FW_B-policy-security-rule-local_trust_outbound] source-address 10.14.2.0 24 [FW_B-policy-security-rule-local_trust_outbound] action permit [FW_B-policy-security-rule-local_trust_outbound] quit [FW_B-policy-security] rule name local_trust_inbound [FW_B-policy-security-rule-local_trust_inbound] source-zone trust [FW_B-policy-security-rule-local_trust_inbound] destination-zone local [FW_B-policy-security-rule-local_trust_inbound] destination-address 10.14.2.0 24 [FW_B-policy-security-rule-local_trust_inbound] action permit [FW_B-policy-security-rule-local_trust_inbound] quit
# 配置Local和Untrust域间的安全策略。
[FW_B-policy-security] rule name local_untrust_outbound [FW_B-policy-security-rule-local_untrust_outbound] source-zone local [FW_B-policy-security-rule-local_untrust_outbound] destination-zone untrust [FW_B-policy-security-rule-local_untrust_outbound] source-address 1.1.2.0 24 [FW_B-policy-security-rule-local_untrust_outbound] action permit [FW_B-policy-security-rule-local_untrust_outbound] quit [FW_B-policy-security] rule name local_untrust_inbound [FW_B-policy-security-rule-local_untrust_inbound] source-zone untrust [FW_B-policy-security-rule-local_untrust_inbound] destination-zone local [FW_B-policy-security-rule-local_untrust_inbound] destination-address 1.1.2.0 24 [FW_B-policy-security-rule-local_untrust_inbound] action permit [FW_B-policy-security-rule-local_untrust_inbound] quit
# 配置Local和hrpzone域间的安全策略。
[FW_B-policy-security] rule name local_hrpzone_outbound [FW_B-policy-security-rule-local_hrpzone_outbound] source-zone local [FW_B-policy-security-rule-local_hrpzone_outbound] destination-zone hrpzone [FW_B-policy-security-rule-local_hrpzone_outbound] source-address 192.168.3.0 24 [FW_B-policy-security-rule-local_hrpzone_outbound] action permit [FW_B-policy-security-rule-local_hrpzone_outbound] quit [FW_B-policy-security] rule name local_hrpzone_inbound [FW_B-policy-security-rule-local_hrpzone_inbound] source-zone hrpzone [FW_B-policy-security-rule-local_hrpzone_inbound] destination-zone local [FW_B-policy-security-rule-local_hrpzone_inbound] destination-address 192.168.3.0 24 [FW_B-policy-security-rule-local_untrust_inbound] action permit [FW_B-policy-security-rule-local_untrust_inbound] quit
# 配置trust和untrust域间的安全策略,允许移动终端访问wap网关的隧道报文通过。请根据实际场景配置更加精细的安全策略。
[FW_B-policy-security] rule name trust_untrust_outbound1 [FW_B-policy-interzone-trust_untrust_outbound1] source-zone trust [FW_B-policy-interzone-trust_untrust_outbound1] destination-zone untrust [FW_B-policy-interzone-trust_untrust_outbound1] action permit [FW_B-policy-interzone-trust_untrust_outbound1] quit [FW_B-policy-security] rule name trust_untrust_inbound1 [FW_B-policy-interzone-trust_untrust_inbound1] source-zone untrust [FW_B-policy-interzone-trust_untrust_inbound1] destination-zone trust [FW_B-policy-interzone-trust_untrust_inbound1] action permit [FW_B-policy-interzone-trust_untrust_inbound1] quit
# 配置trust和untrust域间的安全策略,允许移动终端访问Internet的报文通过。此处以匹配来自10.10.0.0/16网段的所有报文为例进行介绍,在具体应用中,请根据实际情况增加规则。
[FW_B-policy-security] rule name trust_untrust_outbound2 [FW_B-policy-security-rule-trust_untrust_outbound2] source-zone trust [FW_B-policy-security-rule-trust_untrust_outbound2] destination-zone untrust [FW_B-policy-security-rule-trust_untrust_outbound2] source-address 10.10.0.0 16 [FW_B-policy-security-rule-trust_untrust_outbound2] action permit [FW_B-policy-security-rule-trust_untrust_outbound2] quit
- 配置FW_A的安全策略。
- 配置路由
主备防火墙需要为OSPF进程指定不同的router-id,防止OSPF路由震荡。
- 配置FW_A的OSPF路由。
# 配置路由策略,FW和骨干网侧相连侧引入静态路由时,仅引入NAT地址池地址,其他私网地址不发布。
[FW_A] ip ip-prefix natAddress permit 1.1.10.10 32 [FW_A] ip ip-prefix natAddress permit 1.1.10.11 32 [FW_A] ip ip-prefix natAddress permit 1.1.10.12 32 [FW_A] ip ip-prefix natAddress permit 1.1.10.13 32 [FW_A] ip ip-prefix natAddress permit 1.1.10.14 32 [FW_A] ip ip-prefix natAddress permit 1.1.10.15 32 [FW_A] route-policy PS_NAT permit node 10 [FW_A-route-policy] if-match ip-prefix natAddress [FW_A-route-policy] quit [FW_A] ospf 1 router-id 1.1.1.1 [FW_A-ospf-1] import-route static route-policy PS_NAT [FW_A-ospf-1] area 0.0.0.0 [FW_A-ospf-1-area-0.0.0.0] network 1.1.1.0 0.0.0.255 [FW_A-ospf-1-area-0.0.0.0] quit [FW_A-ospf-1] quit
# FW和核心网相连侧配置路由过滤策略,不要从下面学习默认路由。
[FW_A] ip ip-prefix no-default deny 0.0.0.0 0 [FW_A] ip ip-prefix no-default permit 0.0.0.0 0 less-equal 32 [FW_A] ospf 2 router-id 10.14.1.1 [FW_A-ospf-2] filter-policy ip-prefix no-default import [FW_A-ospf-2] default-route-advertise [FW_A-ospf-2] area 0.0.0.0 [FW_A-ospf-2-area-0.0.0.0] network 10.14.1.0 0.0.0.255 [FW_A-ospf-2-area-0.0.0.0] quit [FW_A-ospf-2] quit
# 配置黑洞路由。
[FW_A] ip route-static 1.1.10.10 32 NULL 0 [FW_A] ip route-static 1.1.10.11 32 NULL 0 [FW_A] ip route-static 1.1.10.12 32 NULL 0 [FW_A] ip route-static 1.1.10.13 32 NULL 0 [FW_A] ip route-static 1.1.10.14 32 NULL 0 [FW_A] ip route-static 1.1.10.15 32 NULL 0
- 配置FW_B的OSPF路由。
# 配置路由策略,FW和骨干网侧相连侧引入静态路由时,仅引入NAT地址池地址,其他私网地址不发布。
[FW_B] ip ip-prefix natAddress permit 1.1.10.10 32 [FW_B] ip ip-prefix natAddress permit 1.1.10.11 32 [FW_B] ip ip-prefix natAddress permit 1.1.10.12 32 [FW_B] ip ip-prefix natAddress permit 1.1.10.13 32 [FW_B] ip ip-prefix natAddress permit 1.1.10.14 32 [FW_B] ip ip-prefix natAddress permit 1.1.10.15 32 [FW_B] route-policy PS_NAT permit node 10 [FW_B-route-policy] if-match ip-prefix natAddress [FW_B-route-policy] quit [FW_B] ospf 1 router-id 1.1.2.1 [FW_B-ospf-1] import-route static route-policy PS_NAT [FW_B-ospf-1] area 0.0.0.0 [FW_B-ospf-1-area-0.0.0.0] network 1.1.2.0 0.0.0.255 [FW_B-ospf-1-area-0.0.0.0] quit [FW_B-ospf-1] quit
# FW和核心网相连侧配置路由过滤策略,不要从下面学习默认路由。
[FW_B] ip ip-prefix no-default deny 0.0.0.0 0 [FW_B] ip ip-prefix no-default permit 0.0.0.0 0 less-equal 32 [FW_B] ospf 2 router-id 10.14.2.1 [FW_B-ospf-2] filter-policy ip-prefix no-default import [FW_B-ospf-2] default-route-advertise [FW_B-ospf-2] area 0 [FW_B-ospf-2-area-0.0.0.0] network 10.14.2.0 0.0.0.255 [FW_B-ospf-2-area-0.0.0.0] quit [FW_B-ospf-2] quit
# 配置黑洞路由。
[FW_B] ip route-static 1.1.10.10 32 NULL 0 [FW_B] ip route-static 1.1.10.11 32 NULL 0 [FW_B] ip route-static 1.1.10.12 32 NULL 0 [FW_B] ip route-static 1.1.10.13 32 NULL 0 [FW_B] ip route-static 1.1.10.14 32 NULL 0 [FW_B] ip route-static 1.1.10.15 32 NULL 0
- 配置FW_A的OSPF路由。
- 可靠性配置
- 完成FW_A的双机热备配置。
#配置HRP监控连接骨干网和核心网的接口。
[FW_A] hrp track interface Eth-Trunk 1 [FW_A] hrp track interface Eth-Trunk 2
# 配置根据HRP状态调整OSPF的cost值。
[FW_A] hrp adjust ospf-cost enable
# 配置心跳口。
[FW_A] hrp interface Eth-Trunk 0 remote 192.168.3.2
# 开启HRP功能。
[FW_A] hrp enable
# 配置VGMP管理组的抢占延迟时间为300秒。
[FW_A] hrp preempt delay 300
- 完成FW_B的双机热备配置。
# 配置HRP监控上、下行接口。
[FW_B] hrp track interface Eth-Trunk 1 [FW_B] hrp track interface Eth-Trunk 2
# 配置根据HRP状态调整OSPF的cost值。
[FW_B] hrp adjust ospf-cost enable
# 配置心跳口。
[FW_B] hrp interface Eth-Trunk 0 remote 192.168.3.1
# 开启HRP功能。
[FW_B] hrp enable
#配置当前设备为备用设备
[FW_B] hrp standby-device
- 完成FW_A的双机热备配置。
- 配置NAT和ASPF
双机热备状态形成后,FW_A上的NAT和ASPF配置将会自动备份到FW_B,无需在FW_B上单独配置。
# 创建NAT地址池。
- 配置FW_A的NAT
HRP_M[FW_A] nat address-group addressgroup1 HRP_M[FW_A-address-group-addressgroup1] section 1.1.10.10 1.1.10.15 HRP_M[FW_A-address-group-addressgroup1] quit
# 配置NAT策略。此处以转换10.10.0.0/16网段的所有报文的源地址为例进行介绍,在具体应用中,请根据实际情况增加规则。
HRP_M[FW_A] nat-policy HRP_M[FW_A-policy-nat] rule name trust_untrust_outbound HRP_M[FW_A-policy-nat-rule-trust_untrust_outbound] source-zone trust HRP_M[FW_A-policy-nat-rule-trust_untrust_outbound] destination-zone untrust HRP_M[FW_A-policy-nat-rule-trust_untrust_outbound] source-address 10.10.0.0 0.0.255.255 HRP_M[FW_A-policy-nat-rule-trust_untrust_outbound] action source-nat address-group addressgroup1 HRP_M[FW_A-policy-nat-rule-trust_untrust_outbound] quit HRP_M[FW_A-policy-nat] quit
- 配置FW_A的ASPF。
HRP_M[FW_A] firewall interzone trust untrust HRP_M[FW_A-interzone-trust-untrust] detect rtsp HRP_M[FW_A-interzone-trust-untrust] detect ftp HRP_M[FW_A-interzone-trust-untrust] detect pptp HRP_M[FW_A-interzone-trust-untrust] quit
- 配置FW_A的NAT
- 配置攻击防范
双机热备状态形成后,FW_A上的攻击防范配置将会自动备份到FW_B,无需在FW_B上单独配置。
配置FW_A的攻击防范。
HRP_M[FW_A] firewall defend land enable HRP_M[FW_A] firewall defend smurf enable HRP_M[FW_A] firewall defend fraggle enable HRP_M[FW_A] firewall defend ip-fragment enable HRP_M[FW_A] firewall defend tcp-flag enable HRP_M[FW_A] firewall defend winnuke enable HRP_M[FW_A] firewall defend source-route enable HRP_M[FW_A] firewall defend teardrop enable HRP_M[FW_A] firewall defend route-record enable HRP_M[FW_A] firewall defend time-stamp enable HRP_M[FW_A] firewall defend ping-of-death enable
- 配置网管(SNMP)
- 配置FW_A的网管(SNMP)
# 配置FW上SNMP的版本。本步骤为可选配置,缺省情况下,SNMP的版本为SNMPv3版本。如果版本不为SNMPv3,请配置本步骤。
HRP_M[FW_A] snmp-agent sys-info version v3
# 配置SNMPv3用户组。
HRP_M[FW_A] snmp-agent group v3 NMS1 privacy
# 配置SNMPv3用户。
HRP_M[FW_A] snmp-agent usm-user v3 Admin123 NMS1 authentication-mode md5 Admin@123 privacy-mode aes256 Admin@456
# 配置联系人信息。
HRP_M[FW_A] snmp-agent sys-info contact Mr.zhang
# 配置位置信息。
HRP_M[FW_A] snmp-agent sys-info location Beijing
# 配置FW上SNMP的告警功能。
HRP_M[FW_A] snmp-agent target-host trap address udp-domain 10.1.1.1 params securityname Admin123 v3 privacy private-netmanager HRP_M[FW_A] snmp-agent trap enable Warning: All switches of SNMP trap/notification will be open. Continue? [Y/N]:y
- FW_B的网管(SNMP)
# 配置FW上SNMP的版本。本步骤为可选配置,缺省情况下,SNMP的版本为SNMPv3版本。如果版本不为SNMPv3,请配置本步骤。
HRP_S[FW_B] snmp-agent sys-info version v3
# 配置SNMPv3用户组。
HRP_S[FW_B] snmp-agent group v3 NMS1 privacy
# 配置SNMPv3用户。
HRP_S[FW_B] snmp-agent usm-user v3 Admin123 NMS1 authentication-mode md5 Admin@123 privacy-mode aes256 Admin@456
# 配置联系人信息。
HRP_S[FW_B] snmp-agent sys-info contact Mr.zhang
# 配置位置信息。
HRP_S[FW_B] snmp-agent sys-info location Beijing
# 配置FW上SNMP的告警功能。
HRP_S[FW_B] snmp-agent target-host trap address udp-domain 10.1.1.1 params securityname Admin123 v3 privacy private-netmanager HRP_M[FW_B] snmp-agent trap enable Warning: All switches of SNMP trap/notification will be open. Continue? [Y/N]:y
- 配置FW_A的网管(SNMP)
- 配置LogCenter
LogCenter日志服务器的配置请参见LogCenter服务器的产品手册。此处只介绍FW上的配置。
双机热备状态形成后,FW_A上的LogCenter配置将会自动备份到FW_B,无需在FW_B上单独配置。但是需要单独配置日志的源地址和源端口。
- 配置FW_A。
#配置日志主机。当日志格式为Syslog时,日志主机的地址为2.2.2.2,日志主机的端口必须配置为514。
HRP_M[FW_A] firewall log host 1 2.2.2.2 514
#在安全策略中开启会话日志功能。在具体应用中,请根据实际情况配置。
HRP_M[FW_A] security-policy HRP_M[FW_A-policy-security] rule name trust_untrust HRP_M[FW_A-policy-security-rule-trust_untrust] session logging HRP_M[FW_A-policy-security-rule-trust_untrust] action permit HRP_M[FW_A-policy-security-rule-trust_untrust] quit HRP_M[FW_A-policy-security] quit
配置日志的输出格式、并发功能和源地址/源端口(3.3.3.3/6000)。
HRP_M[FW_A] firewall log session log-type syslog HRP_M[FW_A] firewall log session multi-host-mode concurrent HRP_M[FW_A] firewall log source 3.3.3.3 6000
- 配置FW_B。
配置日志源地址/源端口(3.3.3.4/6000)。
HRP_S[FW_B] firewall log source 3.3.3.4 6000
- 配置FW_A。
结果验证
- 在FW_A上执行display hrp state命令,检查当前HRP的状态,显示以下信息表示HRP建立成功。
HRP_M[FW_A] display hrp stateRole: active, peer: standby Running priority: 46002, peer: 46002 Backup channel usage: 7% Stable time: 0 days, 0 hours, 12 minutes
- 用户使用手机可以正常浏览Web网页,收发彩信。
- 用户使用手机可以正常使用漫游业务。
- 在FW_A的接口GigabitEthernet2/0/0上执行shutdown命令,模拟链路故障,发现主备正常倒换,业务不会中断。
配置脚本
FW_A |
FW_B |
---|---|
# sysname FW_A # info-center source default channel 2 log level warning info-center loghost 10.2.0.10 # firewall log session log-type syslog firewall log session multi-host-mode concurrent firewall log source 3.3.3.3 6000 firewall log host 1 2.2.2.2 514 # nat address-group 1 mode pat status active section 0 1.1.10.10 1.1.10.15 # hrp enable hrp interface Eth-Trunk 0 remote 192.168.3.2 hrp adjust ospf-cost enable hrp preempt delay 300 hrp track interface Eth-Trunk 1 hrp track interface Eth-Trunk 2 # firewall defend land enable firewall defend smurf enable firewall defend fraggle enable firewall defend ip-fragment enable firewall defend tcp-flag enable firewall defend winnuke enable firewall defend source-route enable firewall defend teardrop enable firewall defend route-record enable firewall defend time-stamp enable firewall defend ping-of-death enable # interface Eth-Trunk0 description To_FW_B ip address 192.168.3.1 255.255.255.0 undo service-manage enable # interface Eth-Trunk1 description To_Backbone ip address 1.1.1.1 255.255.255.0 undo service-manage enable # interface Eth-Trunk2 description To_GI ip address 10.14.1.1 255.255.255.0 undo service-manage enable # interface GigabitEthernet1/0/1 eth-trunk 0 # interface GigabitEthernet2/0/1 eth-trunk 0 # interface GigabitEthernet2/0/2 eth-trunk 1 # interface GigabitEthernet2/0/3 eth-trunk 1 # interface GigabitEthernet2/0/4 eth-trunk 2 # interface GigabitEthernet2/0/5 eth-trunk 2 # firewall zone trust set priority 85 add interface Eth-Trunk2 # firewall zone untrust set priority 5 add interface Eth-Trunk1 # firewall zone hrpzone set priority 65 add interface Eth-Trunk0 # firewall interzone trust untrust detect rtsp detect ftp detect pptp # security-policy rule name local_trust_outbound source-zone local destination-zone trust source-address 10.14.1.0 24 action permit rule name local_trust_inbound source-zone trust destination-zone local destination-address 10.14.1.0 24 action permit rule name local_untrust_outbound source-zone local destination-zone untrust source-address 1.1.1.0 24 action permit rule name local_untrust_inbound source-zone untrust destination-zone local destination-address 1.1.1.0 24 action permit rule name local_hrpzone_outbound source-zone local destination-zone hrpzone source-address 192.168.3.0 24 action permit rule name local_hrpzone_inbound source-zone hrpzone destination-zone local destination-address 192.168.3.0 24 action permit rule name trust_untrust_outbound1 source-zone trust destination-zone untrust action permit rule name trust_untrust_inbound1 source-zone untrust destination-zone trust action permit rule name trust_untrust_outbound2 source-zone trust destination-zone untrust source-address 10.10.0.0 16 action permit rule name trust_untrust session logging action permit # nat-policy rule name trust_untrust_outbound source-zone trust destination-zone untrust source-address 10.10.0.0 16 action source-nat address-group addressgroup1 # ip ip-prefix natAddress permit 1.1.10.10 32 ip ip-prefix natAddress permit 1.1.10.11 32 ip ip-prefix natAddress permit 1.1.10.12 32 ip ip-prefix natAddress permit 1.1.10.13 32 ip ip-prefix natAddress permit 1.1.10.14 32 ip ip-prefix natAddress permit 1.1.10.15 32 ip ip-prefix no-default deny 0.0.0.0 0 ip ip-prefix no-default permit 0.0.0.0 0 less-equal 32 # route-policy PS_NAT permit node 10 if-match ip-prefix natAddress # ospf 1 router-id 1.1.1.1 import-route static route-policy PS_NAT area 0.0.0.0 network 1.1.1.0 0.0.0.255 # ospf 2 router-id 10.14.1.1 default-route-advertise filter-policy ip-prefix no-default import area 0.0.0.0 network 10.14.1.0 0.0.0.255 # ip route-static 1.1.10.10 255.255.255.255 NULL0 ip route-static 1.1.10.11 255.255.255.255 NULL0 ip route-static 1.1.10.12 255.255.255.255 NULL0 ip route-static 1.1.10.13 255.255.255.255 NULL0 ip route-static 1.1.10.14 255.255.255.255 NULL0 ip route-static 1.1.10.15 255.255.255.255 NULL0 # snmp-agent snmp-agent local-engineid 000007DB7FFFFFFF000077D0 snmp-agent sys-info version v3 snmp-agent sys-info contact Mr.zhang snmp-agent sys-info location Beijing snmp-agent group v3 NMS1 privacy snmp-agent target-host trap address udp-domain 10.1.1.1 params securityname %$%$Lch*5Z>Q0:BIj9Nv<&^W(>5,%$%$ v3 privacy private-netmanager snmp-agent usm-user v3 Admin123 NMS1 authentication-mode md5 %$%$q:JqX0VlJ,5ykB"H'lF&kd[REPvIW_tq`0DkZ\JN)tTE`ja\%$%$ privacy-mode aes256 %$%$.AA`F.dEUJ8Dl33bz;0PYcZQ">eB&vh6t$]4 # return |
# sysname FW_B # info-center source default channel 2 log level warning info-center loghost 10.2.0.10 # firewall log session log-type syslog firewall log session multi-host-mode concurrent firewall log source 3.3.3.4 6000 firewall log host 1 2.2.2.2 514 # nat address-group 1 mode pat status active section 0 1.1.10.10 1.1.10.15 # hrp enable hrp standby-device hrp interface Eth-Trunk 0 remote 192.168.3.1 hrp adjust ospf-cost enable hrp track interface Eth-Trunk 1 hrp track interface Eth-Trunk 2 # firewall defend land enable firewall defend smurf enable firewall defend fraggle enable firewall defend ip-fragment enable firewall defend tcp-flag enable firewall defend winnuke enable firewall defend source-route enable firewall defend teardrop enable firewall defend route-record enable firewall defend time-stamp enable firewall defend ping-of-death enable # interface Eth-Trunk0 description To_FW_A ip address 192.168.3.2 255.255.255.0 undo service-manage enable # interface Eth-Trunk1 description To_Backbone ip address 1.1.1.3 255.255.255.0 undo service-manage enable # interface Eth-Trunk2 description To_GI ip address 10.14.1.3 255.255.255.0 undo service-manage enable # interface GigabitEthernet1/0/1 eth-trunk 0 # interface GigabitEthernet2/0/1 eth-trunk 0 # interface GigabitEthernet2/0/2 eth-trunk 1 # interface GigabitEthernet2/0/3 eth-trunk 1 # interface GigabitEthernet2/0/4 eth-trunk 2 # interface GigabitEthernet2/0/5 eth-trunk 2 # firewall zone trust set priority 85 add interface Eth-Trunk2 # firewall zone untrust set priority 5 add interface Eth-Trunk1 # firewall zone hrpzone set priority 65 add interface Eth-Trunk0 # firewall interzone trust untrust detect rtsp detect ftp detect pptp # security-policy rule name local_trust_outbound source-zone local destination-zone trust source-address 10.14.2.0 24 action permit rule name local_trust_inbound source-zone trust destination-zone local destination-address 10.14.2.0 24 action permit rule name local_untrust_outbound source-zone local destination-zone untrust source-address 1.1.2.0 24 action permit rule name local_untrust_inbound source-zone Untrust destination-zone local destination-address 1.1.2.0 24 action permit rule name local_hrpzone_outbound source-zone local destination-zone hrpzone source-address 192.168.3.0 24 action permit rule name local_hrpzone_inbound source-zone hrpzone destination-zone local destination-address 192.168.3.0 24 action permit rule name trust_untrust_outbound1 source-zone trust destination-zone untrust action permit rule name trust_untrust_inbound1 source-zone Untrust destination-zone trust action permit rule name trust_untrust_outbound2 source-zone trust destination-zone untrust source-address 10.10.0.0 16 action permit rule name trust_untrust session logging action permit # nat-policy rule name trust_untrust_outbound source-zone trust destination-zone untrust source-address 10.10.0.0 16 action source-nat address-group addressgroup1 # ip ip-prefix natAddress permit 1.1.1.10 32 ip ip-prefix natAddress permit 1.1.1.11 32 ip ip-prefix natAddress permit 1.1.1.12 32 ip ip-prefix natAddress permit 1.1.1.13 32 ip ip-prefix natAddress permit 1.1.1.14 32 ip ip-prefix natAddress permit 1.1.1.15 32 ip ip-prefix no-default deny 0.0.0.0 0 ip ip-prefix no-default permit 0.0.0.0 0 less-equal 32 # route-policy PS_NAT permit node 10 if-match ip-prefix natAddress # ospf 1 router-id 1.1.1.3 import-route static route-policy PS_NAT area 0.0.0.0 network 1.1.2.0 0.0.0.255 # ospf 2 router-id 10.14.1.3 default-route-advertise filter-policy ip-prefix no-default import area 0.0.0.0 network 10.15.1.0 0.0.0.255 # ip route-static 1.1.10.10 255.255.255.255 NULL0 ip route-static 1.1.10.11 255.255.255.255 NULL0 ip route-static 1.1.10.12 255.255.255.255 NULL0 ip route-static 1.1.10.13 255.255.255.255 NULL0 ip route-static 1.1.10.14 255.255.255.255 NULL0 ip route-static 1.1.10.15 255.255.255.255 NULL0 # snmp-agent snmp-agent local-engineid 000007DB7FFFFFFF000077D0 snmp-agent sys-info version v3 snmp-agent sys-info contact Mr.zhang snmp-agent sys-info location Beijing snmp-agent group v3 NMS1 privacy snmp-agent target-host trap address udp-domain 10.1.1.1 params securityname %$%$Lch*5Z>Q0:BIj9Nv<&^W(>5,%$%$ v3 privacy private-netmanager snmp-agent usm-user v3 Admin123 NMS1 authentication-mode md5 %$%$q:JqX0VlJ,5ykB"H'lF&kd[REPvIW_tq`0DkZ\JN)tTE`ja\%$%$ privacy-mode aes256 %$%$.AA`F.dEUJ8Dl33bz;0PYcZQ">eB&vh6t$]4 # return |
其他方案
VRRP+OSPF(主备备份)
组网图
如图1-5所示,两台防火墙的业务接口都工作在三层,到骨干网经过路由器,到GGSN/P-GW经过二层交换机。防火墙与路由器之间运行OSPF协议,防火墙与交换机相连的接口启用VRRP功能。
两台防火墙以主备备份方式工作。正常情况下,流量通过FW_A转发。当FW_A出现故障时,流量通过FW_B转发,保证业务不中断。
故障切换
- 到骨干网的链路故障,通过接口上配置的hrp track降低FW_A的优先级,引起双机切换,路由调整到FW_B上,VRRP也同时切换到FW_B上,从而实现了流量切换。
- FW上下行接口绑定在同一个Link-group,并配置hrp track功能监控此上下行接口,所以到GGSN/P-GW的链路故障与到骨干网的链路故障切换方式是一致的,此处不再赘述。
配置差异
项目 |
FW_A |
FW_B |
---|---|---|
接口 |
# interface Eth-Trunk0 description TO-FW-B ip address 192.168.3.1 255.255.255.240 # interface Eth-Trunk1 ip address 1.1.1.1 255.255.255.0 # interface Eth-Trunk2 description TO-GI ip address 10.14.1.1 255.255.255.0 vrrp vrid 20 virtual-ip 10.14.1.3 active # |
# interface Eth-Trunk0 description TO-FW-A ip address 192.168.3.2 255.255.255.240 # interface Eth-Trunk1 ip address 1.1.2.1 255.255.255.0 # interface Eth-Trunk2 description TO-GI ip address 10.14.1.2 255.255.255.0 vrrp vrid 20 virtual-ip 10.14.1.3 standby # |
路由 |
ip route-static 0.0.0.0 0.0.0.0 1.1.1.2//配置默认路由指向公网 ip route-static x.x.x.x x.x.x.x 10.14.1.x//针对手机私网地址配置路由指向Gi/SGi口 |
ip route-static 0.0.0.0 0.0.0.0 1.1.2.2//配置默认路由指向公网 ip route-static x.x.x.x x.x.x.x 10.14.1.x//针对手机私网地址配置路由指向Gi/SGi口 |
OSPF(负载分担)
组网图
如图1-6所示,两台防火墙的业务接口都工作在三层,到骨干网和GGSN/P-GW都连接路由器。防火墙与路由器之间运行OSPF协议。
两台防火墙以负载分担方式工作。正常情况下,流量通过FW_A转发。当FWW_A出现故障时,流量通过FWW_B转发,保证业务不中断。
现在希望两台防火墙以负载分担方式工作。正常情况下,FW_A和FW_B共同转发流量。当其中一台防火墙出现故障时,另外一台防火墙转发全部业务,保证业务不中断。
故障切换
- FW_A故障,通过双机热备切换,OSPF路由调整到FW_B上,从而实现了流量切换。
- FW_B故障,通过双机热备切换,OSPF路由调整到FW_A上,从而实现了流量切换。
配置差异
项目 |
FW_A |
FW_B |
---|---|---|
双机热备 |
hrp enable hrp interface Eth-Trunk0 remote 192.168.3.2 hrp mirror session enable hrp preempt delay 120 hrp adjust ospf-cost enable hrp track interface Eth-Trunk1 hrp track interface Eth-Trunk2 hrp nat resource primary-group //设置双机NAT端口分段 |
hrp enable hrp interface Eth-Trunk0 remote 192.168.3.1 hrp mirror session enable hrp preempt delay 120 hrp adjust ospf-cost enable hrp track interface Eth-Trunk1 hrp track interface Eth-Trunk2 hrp nat resource secondary-group //设置双机NAT端口分段 |