Part 1 - Failover简介
一. 什么是Failover
Failover特性是Cisco安全产品高可用性的一个解决方案,目的是为了提供不间断的服务,当主设备down掉的时候,备用设备能够马上接管主设备的工作,进而保持通信的连通性。
二. 部署Failover的必要条件
在部署Failover时,要求两台防火墙的以下信息完全一致:
硬件条件:设备型号、接口数量和类型、SSM模块、内存;
软件条件:运行模式(透明模式或路由模式)、系统主次版本号;
授权信息:Lincense;
三. Failover的部署方案
在部署Failover时,有两种部署方式:
第一种:Active-Standby(A/S)模式
当使用A/S模式时,两台物理防火墙中,一台(Active设备)对外提供服务,转发流量;另外一台(Standby设备)作为备份。当Active设备宕机后,Standby设备开始接管流量转发。
第二种:Active-Active(A/A)模式
当使用A/A模式时,两台防火墙可以同时工作,同时转发流量,再实现高可靠性的同时,还可以提供流量负载。
failover部署方案图示:
Part 2 - Active-Standby模式的工作原理
注:Actvie-Actvie的部署方式将在下一篇文章中给大家详细介绍!
一. 角色定义
配置层面:Primary和Secondary角色
一台防火墙被配置成Primary角色,另外一台防火墙被配置成Secondary角色;
逻辑层面:Active和Standby状态
被配置成Primary角色的设备,会被选举成为Active,从而处理流量的转发;被配置成为Secondary角色的设备,会被选举成为Standby,从而做为备份设备;
二. 管理接口
在部署Failover时,除了正常的业务接口以外,还需要定义两个特殊的接口来管理Failover的运行。
LAN-Based Failover link:该接口用来检测Failover的运行状态,并且进行配置信息的同步,使用独立的接口来充当;
Stateful Failover Link:该接口用来同步状态化信息,即Active设备会将当前流量的连接信息(例如,TCP连接)或者是一些表项同步给Standby设备,使得Standby设备在切换到Active后,能更快的进行数据转发,思科推荐使用独立接口来充当;
管理接口的图示如下:
E0/2接口为LAN-Based Failover link;
E0/3接口为Stateful Failover Link;
三. Failover的选举过程
当两台防火墙被配置成Primary或者Secondary角色后,它们会通过LAN-Based Failover link进行Active和Standby状态的选举,具体过程如下:
当两台防火墙都能正常启动时,Primary角色的设备会被选择成Active,Secondary角色的设备会被选择成Standby;
当两台防火墙只有一台能正常启动,则能正常启动的设备被选择为Active,不管它是Primary设备还是Secondary设备;
如果防火墙能正常启动,但是已检测到有Active状态的设备存在,则启动后被选择成Standby状态;
如果防火墙启动后,被选择成为Active,但是又检测到另外一台设备也是Active,则进行重新选举;
四. 邻居设备的健康状态监控
参与Failover的两台防火墙,彼此会通过LAN-Based Failover link接口和Monitired interface(默认除了管理口外的其它接口都属于Monitired interface)发送Hello报文,来检测健康状态。
健康状态的检测原则为:
如果能从LAN-Based Failover link接口周期性收到Hello报文,则邻居状态健康,不需要进行切换;
如果不能从LAN-Based Failover link接口收到Hello报文,但是可以从Monitired interface收到Hello报文,也被认为邻居状态健康,不需要进行切换;
如果既不能从LAN-Based Failover link接口收到Hello报文,也不能从Monitired interface收到Hello报文,则被认为是Fail状态,这时就需要进行切换;
五. 状态信息的同步
当Active设备出现故障时,Standby状态的设备会切换到Active状态来接管流量的转发。
为了使得切换速度更块,我们可以开启状态化同步的特性,使得Active设备在还没有出现故障之前,通过Stateful Failover Link接口,将自己的状态化表项同步给Standby,使得Standby在切换后能迅速的进行流量的转发
需要同步的信息如下表所示:
需要同步的信息
不需要同步的信息
NAT table entriesUser Authentication Cut-Through Proxy
ARP table entriesDHCP server address leases
MAC address table entriesPhone proxy information
UDP connectionsSecurity Services Module activity
TCP connections
H.323 and SIP signaling sessions
MGCP connections
HTTP connections (if explicitly enabled)
Dynamic routing table entries*
Part 3 - 实验配置
一. 实验环境
实验物理拓扑图:
设备及IP地址说明:
R1为outside设备,模拟互联网,R2为inside设备,模拟局域网。
ASA1和ASA2接口分配情况
接口
接口命名
G0/0
Inside
G0/3
Outside
G0/2
LAN-Based Failover
G0/1
Statefull Failover
VLAN规划情况
VLAN
接口
VLAN 10
E0/0、E1/0、E2/1
VLAN 11
E0/1、E1/1
VLAN 12
E0/2、E1/2
VLAN 13
E0/3、E1/3、E2/0
IP地址规划情况
设备
接口
IP地址
R1
E0/0
209.165.200.254/24
R2
E0/0192.168.1.254/24
ASA1
G0/0
192.168.1.10/24
ASA1
G0/1192.168.201.1/24
ASA1
G0/2192.168.200.1/24
ASA1
G0/3209.165.200.225/24
ASA2
G0/0192.168.1.11/24
ASA2G0/1192.168.201.2/24
ASA2G0/2192.168.200.2/24
ASA2G0/3209.165.200.226/24
二. 实验需求
部署无状态化Failover Active-Standby模式,ASA1为Active,ASA2为standby,当LAN-Based Failover link断开,观察Failover切换情况。
部署状态化Failover Active-Standby模式,ASA1为Active,ASA2为standby,当LAN-Based Failover link断开,观察Failover切换情况。以及状态化表项
三. 具体配置步骤
Step 1:在交换机上将接口划分进相应的VLAN
Switch#show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Et2/2, Et2/3
10 inside active Et0/0, Et1/0, Et2/1
11 Stateful active Et0/1, Et1/1
12 FO active Et0/2, Et1/2
13 outside active Et0/3, Et1/3, Et2/0
Step 2:在ASA1上配置相关参数
2.1 配置inside和outside接口的IP地址
Hostname ASA1
interface GigabitEthernet0/0
nameif inside
security-level 100
ip address 192.168.1.10 255.255.255.0 standby 192.168.1.11
interface GigabitEthernet0/3
nameif outside
security-level 0
ip address 209.165.200.225 255.255.255.0 standby 209.165.200.226
2.2 将ASA1配置成Primary设备,同时将G0/2接口配置成LAN-Based Failover接口,并配置IP地址
interface GigabitEthernet0/2
no shutdowm
failover lan unit primary
failover lan interface FO GigabitEthernet0/2
failover interface ip FO 192.168.200.1 255.255.255.0 standby 192.168.200.2
Failove
Step 3:在ASA2上配置相关参数
注:Secondary设备中无需配置inside接口和outside接口IP,直接从Active设备同
3.1 将ASA2配置成Secondary设备,同时将G0/2接口配置成LAN-Based Failover接口,并配置IP地址
Hostname ASA2
interface GigabitEthernet0/2
no shutdowm
failover lan unit secondary
failover lan interface FO GigabitEthernet0/2
failover interface ip FO 192.168.200.1 255.255.255.0 standby 192.168.200.2
Failove
Step 4:查看Failover的状态,ASA1为Active,ASA2为Standby
ASA1/pri/act# show failover
Failover On
Failover unit Primary
Failover LAN Interface: FOGigabitEthernet0/2 (up)
Reconnect timeout 0:00:00
Unit Poll frequency 1 seconds, holdtime 15 seconds
Interface Poll frequency 5 seconds, holdtime 25 seconds
Interface Policy 1
Monitored Interfaces 2 of 61 maximum
MAC Address Move Notification Interval not set
Version: Ours 9.5(2)204, Mate 9.5(2)204
Last Failover at: 01:56:09 UTC Jan 10 2019
This host: Primary - Active
Active time: 3163 (sec)
slot 0: empty
Interface inside (192.168.1.10): Normal (Monitored)
Interface outside (209.165.200.225): Normal (Monitored)
Other host: Secondary - Standby Ready
Active time: 91 (sec)
Interface inside (192.168.1.11): Normal (Monitored)
Interface outside (209.165.200.226): Normal (Monitored)
Stateful Failover Logical Update Statistics
Link : Unconfigured
Step 5:通过Telnet进行测试
5.1 在R2上,对R1进行Telnet访问,并保持连接不要中断
R2#
R2#telnet 209.165.200.254
Trying 209.165.200.254 ... Open
User Access Verification
Password:
R1
5.2 在ASA1和ASA2上查看状态化表项,此时,ASA1上应该有状态化表项,而ASA2上没有状态化表项
ASA1/pri/act# show conn
7 in use, 14 most used
TCP outside 209.165.200.254:23 inside 192.168.1.254:36816, idle 0:00:04, bytes 139, flags UIO
ASA2/sec/stby# show conn
6 in use, 13 most use
Step 6:故障测试
6.1 断开交换机连接Active设备的Ethernet0/0口,观察切换情况,此时,Active设备切换成了Standby状态。
Switch(config)#interface Ethernet0/0
Switch(config)#shutdown
ASA1/pri/act#
Switching to Standby
ASA1/pri/stby)# show failover
Failover On
Failover unit Primary
Failover LAN Interface: FO GigabitEthernet0/2 (up)
Reconnect timeout 0:00:00
Unit Poll frequency 1 seconds, holdtime 15 seconds
Interface Poll frequency 5 seconds, holdtime 25 seconds
Interface Policy 1
Monitored Interfaces 2 of 61 maximum
MAC Address Move Notification Interval not set
Version: Ours 9.5(2)204, Mate 9.5(2)204
Last Failover at: 03:01:54 UTC Jan 10 2019
This host: Primary - Failed
Active time: 3936 (sec)
slot 0: empty
Interface inside (192.168.1.11): Failed (Waiting)
Interface outside (209.165.200.226): Normal (Monitored)
Other host: Secondary - Active
Active time: 45 (sec)
Interface inside (192.168.1.10): Normal (Waiting)
Interface outside (209.165.200.225): Normal (Monitored)
Stateful Failover Logical Update Statistics
Link : Unconfigured.
6.2 恢复交换机接口,由于非抢占的原因,ASA1依然为Standby状态,,可以使用Failover Active命令进行手动抢占
Switch(config)#int Ethernet0/0
Switch(config)#no shutdown
ASA1/pri/stby)# show failover
Failover On
Failover unit Primary
Failover LAN Interface: FO GigabitEthernet0/2 (up)
Reconnect timeout 0:00:00
Unit Poll frequency 1 seconds, holdtime 15 seconds
Interface Poll frequency 5 seconds, holdtime 25 seconds
Interface Policy 1
Monitored Interfaces 2 of 61 maximum
MAC Address Move Notification Interval not set
Version: Ours 9.5(2)204, Mate 9.5(2)204
Last Failover at: 03:01:54 UTC Jan 10 2019
This host: Primary - Standby Ready
Active time: 3936 (sec)
slot 0: empty
Interface inside (192.168.1.11): Normal (Monitored)
Interface outside (209.165.200.226): Normal (Monitored)
Other host: Secondary - Active
Active time: 254 (sec)
Interface inside (192.168.1.10): Normal (Monitored)
Interface outside (209.165.200.225): Normal (Monitored)
Stateful Failover Logical Update Statistics
Link : Unconfigured.
ASA1/pri/stby)# failover active
Switching to Active
Step 7:开启状态化切换
7.1 配置Stateful Failover Link链路,该配置在Active端配置即可,Standby会自动同步
ASA1/sec/act#failover link Stateful GigabitEthernet0/1
ASA1/sec/act#failover interface ip Stateful 192.168.201.1 255.255.255.0 standby 192.168.201.2
7.2 查看状态化表项,ASA1和ASA2上均有状态化表项
ASA1/sec/act # show conn
9 in use, 14 most used
TCP outside 209.165.200.254:23 inside 192.168.1.254:13699, idle 0:00:06, bytes 146, flags UIO
ASA1/pri/stby)# show conn
9 in use, 13 most used
TCP outside 209.165.200.254:23 inside 192.168.1.254:13699, idle 0:00:01, bytes 146, flags UIO
Step 8:其他可选配置
8.1 修改Active/Standby切换时间
failover polltime unit msec 300 holdtime msec 900
failover polltime interface 1 holdtime 5
8.2 修改监控接口,设置切换策略
Monitor-interface xxx
Failover interface-policy x
Failover interface-policy xx%