189 8069 5689

【网络知识点】防火墙主备冗余技术

【网络知识点】防火墙主备冗余技术

站在用户的角度思考问题,与客户深入沟通,找到洪湖网站设计与洪湖网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:网站建设、成都网站制作、企业官网、英文网站、手机端网站、网站推广、主机域名虚拟主机、企业邮箱。业务覆盖洪湖地区。

本文以思科Failover技术为主备冗余技术,华为方面的主备冗余技术为VRRP+HRP,可自行查看华为相关配置资料,实际实现上两者没什么区别,只是实现原理上有点差别,华为做相互主备A/A会更容易些,如果思科做相互主备A/A需要用到多模式虚拟技术,较复杂一点。

A/S模式:

实验环境:

【网络知识点】防火墙主备冗余技术

 

通过GNS3模拟搭建,防火墙镜像为pix804.bin,路由器为c3640-jk9o3s-mz.124-10a.bin,交换机为c3640-jk9o3s-mz.124-10a.bin+交换端口板块+no ip routing

 

注意:1.防火墙需要证书激活才能用更多功能:激活命令  activation-key 0xd2390d2c 0x9fc4b36d 0x98442d99 0xeef7d8b1然后reload 2.需要测试ping的,防火墙要开启ICMP协议修正,开启ICMP状态化检测,命令为fixup protocol icmp

 

主要配置详解:

主防火墙配置:

 

#配置内外接口地址

interface Ethernet0

 shutdown

 no nameif

 no security-level

 no ip address

 

interface Ethernet1

 nameif inside

 security-level 100

 ip address 192.168.1.254 255.255.255.0 standby 192.168.1.253 #必须有standby,用于检测备用防火墙的端口地址,没有standby它无法检测主备端口状态,然后根据状态进行主备防火墙切换

 

interface Ethernet2

 nameif outside

 security-level 0

 ip address 100.1.1.1 255.255.255.0 standby 100.1.1.2

 

interface Ethernet3 - 4

No shut #3,4只需要noshut

 

#配置默认路由

route outside 0.0.0.0 0.0.0.0 100.1.1.3 1

route inside 1.1.1.1 255.255.255.255 192.168.1.1 1

 

#failover主要配置

failover

failover lan unit primary #定义主备,主备设备的配置差别就在这里而已

failover lan interface PZ Ethernet3 #配置配置同步端口

failover lan enable

failover key vrfxie #配置认证

failover link ZT Ethernet4 #配置状态同步端口

failover interface ip PZ 10.1.12.1 255.255.255.0 standby 10.1.12.2

failover interface ip ZT 10.2.12.1 255.255.255.0 standby 10.2.12.2

 

备用防火墙配置:

failover

failover lan unit secondary

failover lan interface PZ Ethernet3

failover lan enable

failover key vrfxie

failover link ZT Ethernet4

failover interface ip PZ 10.1.12.1 255.255.255.0 standby 10.1.12.2

failover interface ip ZT 10.2.12.1 255.255.255.0 standby 10.2.12.2

 

其他什么都不用配置!开启e3,4端口后它会自动同步主防火墙配置,这是整个配置的关键点,很多小伙伴多手配置了e1,2导致配置与主冲突,failover失败

最后no shut e3,4端口,开始同步,出现以下信息则同步成功

Detected an Active mate

Beginning configuration replication from mate.

End configuration replication from mate.

 

测试:

关闭主防火墙上下联交换机的端口或断开其链路,主防火墙出现以下信息

pixfirewall(config)#

Switching to Standby

然后备变成activie,恢复主防火墙上下联交换机的端口或对应链路,然后关闭备防火墙上下联交换机的端口或断开其链路,主防火墙重新变为activite

Switching to Active

切换时间大概为30秒左右,对于实际商业应用来说,不大理想!可能是模拟器的原因,真机也许不会这么慢。

 

R1在故障前保持与R2的TCP连接,故障切换后,TCP不需要重新连接能接着使用

 

测试成功!

 

分析:

0.对比VRRP+透明模式防火墙来做主备防火墙,其切换时间稍微慢了一些,但他有状态备份,业务连接在主备切换后不需要重新连接

1.切换机制:outside和inside两边分别进行轮询检测,如果检测到对方的接口坏了才会切换,切换时间GN3模拟测试是30秒左右。PS:心跳线坏了,轮询是好的,那是不会切换的

2.防火墙的切换不会抢占的,切换后就算主好了也不会恢复,需要使用命令fiallover active来手工切换回来 

3.默认跟踪所有物理接口,如果有子接口需要通过monitor-interface来配置

 

A/A模式:

实现环境:

【网络知识点】防火墙主备冗余技术

 

通过GNS3模拟搭建,防火墙镜像为pix804.bin,路由器为c3640-jk9o3s-mz.124-10a.bin,交换机为c3640-jk9o3s-mz.124-10a.bin+交换端口板块+no ip routing

 

此架构更符合实际运用,两个防火墙之间相互冗余备份,双activite双出口,不会浪费一边得带宽资源,实在要找缺点的话就是需要两边带宽要求比较高,毕竟故障发生时,一边要承担所有的流量,要规划好。

 

主要配置详解:

这里的交换机部分配置就不展示了,很简单的配置,几乎都是二层交换来用,重点在防火墙通过多模式实现相互主备的配置

PIX1配置:

mode multiple #切换防火墙到多模式,才可以配置虚拟子防火墙

interface Ethernet0等等  #将所有要关联到子防火墙的接口noshut

no shutdown

failover group 1 #配置failover组1,最多创建两个failover group

  Primary  #组1在primary物理设备为上开启抢占功能,优先成active

  Preempt  #当发生failover,原来由active状态变为standby状态,若此时将failover组或者设备变为正常,primary设备上的加入到组1的子防火墙抢占变为active

failover group 2

  Secondary   #组2在secondary的物理设备上开启抢占功能,优先preempt成为active

  Preempt

 

admin-context admin  #配置管理子防火墙,后面的admin可随便写,admin-context意思是创建管理子防火墙

context admin  #进入admin子防火墙配置

  config-url flash:/admin.cfg     #配置文件存储目录    

 

context c1  #配置子防火墙,命令名c1

  allocate-interface Ethernet0  #关联相关物理接口到子墙,这样在子墙里才能看到有接口,下同

  allocate-interface Ethernet3

  config-url flash:/c1.cfg

  join-failover-group 1  #将c1子墙加入到failover group 1

 

context c2  #同上

  allocate-interface Ethernet0

  allocate-interface Ethernet4

  config-url flash:/c2.cfg

  join-failover-group 2

 

 

Failover #看上面A/S的解释

failover lan unit primary

failover lan interface PZ Ethernet1

failover lan enable

failover key vrfxie

failover link ZT Ethernet2

failover interface ip PZ 10.1.12.1 255.255.255.0 standby 10.1.12.2

failover interface ip ZT 10.2.12.1 255.255.255.0 standby 10.2.12.2

#分析:通过failover的状态链和配置链来让右边去同步左边的配置,那就不需要右边再配一次,状态链和配置链是所有子防火墙共用的

 

PIX2防火墙配置:

show model  #查看防火墙是在多模式下还是单模式下

mode multiple#改变防火墙到多模式下工作

failover

failover lan unit secondary

failover lan interface PZ Ethernet1

failover lan enable

failover key vrfxie

failover link ZT Ethernet2

failover interface ip PZ 10.1.12.1 255.255.255.0 standby 10.1.12.2

failover interface ip ZT 10.2.12.1 255.255.255.0 standby 10.2.12.2

 

PIX2只需no shut e1,2口,等待PIX1,2同步!

 

PIX2防火墙配置完成,完成这些步骤后,两台防火墙开始选举各自的Active还是Standby。选举完成后PXI1防火墙的c1子墙成为Active状态,c2子墙成为Standby状态,PIX2的c1子墙成为Standby状态,c2子墙成为Active状态。所有的配置将在Active角色的子墙上配置,Standby状态的子墙只能查看配置和同步Active的配置,并检测Active健康状态,做好切换的准备。

 

查看failover状态,在各自防火墙的主体(changeto system)上查看:

pixfirewall/pri/act(config)# show failover

Failover On

Cable status: N/A - LAN-based failover enabled

Failover unit Primary

Failover LAN Interface: PZ Ethernet1 (up)

Unit Poll frequency 15 seconds, holdtime 45 seconds

Interface Poll frequency 5 seconds, holdtime 25 seconds

Interface Policy 1

Monitored Interfaces 4 of 250 maximum

Version: Ours 8.0(4), Mate 8.0(4)

Group 1 last failover at: 15:28:42 UTC Mar 23 2017

Group 2 last failover at: 14:34:48 UTC Mar 23 2017

 

  This host:    Primary

  Group 1       State:          Active

                Active time:    3615 (sec)

  Group 2       State:          Standby Ready

                Active time:    525 (sec)

 

  c1 Interface outside (100.1.1.1): Normal (Waiting)

  c1 Interface inside (192.168.10.254): Normal (Waiting)

  c2 Interface outside (100.1.1.4): Normal

  c2 Interface inside (192.168.20.253): Normal

 

  Other host:   Secondary

  Group 1       State:          Standby Ready

                Active time:    150 (sec)

  Group 2       State:          Active

                Active time:    3240 (sec)

 

  c1 Interface outside (100.1.1.3): Normal (Waiting)

  c1 Interface inside (192.168.10.253): Normal (Waiting)

  c2 Interface outside (100.1.1.2): Normal

  c2 Interface inside (192.168.20.254): Normal

 

 

配置c1,c2子防火墙的IP和路由,均要在处于Active状态的子防火墙上配置,处于Standby状态的不能做任何配置

 

prompt hostname priority state context#修改“#”前面的显示字符,在物理设备下配置,这样便于查看

 

在PIX1配置c1:

changeto context c1#切换到c1子防火墙进行配置

 

interface Ethernet0    #参考上面A/S的解析,一样的

 nameif outside

 security-level 0

 ip address 100.1.1.1 255.255.255.0 standby 100.1.1.3

 

interface Ethernet3

 nameif inside

 security-level 100

 ip address 192.168.10.254 255.255.255.0 standby 192.168.10.253

 

在PIX2配置c2:

changeto context c2

 

interface Ethernet0

 nameif outside

 security-level 0

 ip address 100.1.1.2 255.255.255.0 standby 100.1.1.4

 

interface Ethernet4

 nameif inside

 security-level 100

 ip address 192.168.20.254 255.255.255.0 standby 192.168.20.253

 

 

最后路由要配置好,这里路由的配置我就分享了,基本都是配默认路由

 

测试:

断开PIX1的上联交换机口

【网络知识点】防火墙主备冗余技术

恢复该交换机口

 

【网络知识点】防火墙主备冗余技术

 

分析:

1.切换成功,恢复后,可以自动恢复原来状态,这点跟A/S模式不一样!

2.切换速度很快!5秒内!

3.对比A/S模式,无论从架构还是效率上都有很大优势


如果本文中有什么问题,欢迎留言交流!谢谢!


分享文章:【网络知识点】防火墙主备冗余技术
文章位置:http://cdxtjz.cn/article/pidcje.html

其他资讯