在Cisco ASA上部署链路冗余技术
Part 1-前言
通过上两篇文章《在思科ASA上部署Failover实例演示-上》和《在思科ASA上部署Failover实例演示-下》的介绍,对于Failover Active-Standby与Active-Active模式如何实现ASA防火墙的冗余备份,大家一定有所了解,知道如何去部署ASA防火墙,实现设备设备级别的冗余,了解,当一台ASA设备故障,如何自动切换到另外一台ASA设备。
有朋友可能会问:企业环境中因为链路或接口故障造成的业务中断比较多,在ASA防火墙上有没有基于链路级别的冗余备份技术?当某条链路或者某个接口故障,链路自动冗余备份,实现业务不中断呢?
本文将在Part 2和Part 3分别为大家介绍链路接口级别的冗余备份技术,Redundant Interface和Ether Channel如何实验链路冗余备份。
Part 2 - Redundant Interface
一. Redundant Interface工作原理介绍
默认情况,ASA设备每一个物理接口都是独立存在的,接口有两种状态UP或者DOWN,当接口状态为DOWN时,基于该接口的业务将会中断,如果部署Redundant interface技术,就可以杜绝这种现象。
Redundant interface工作原理如下:
-
创建一个虚拟逻辑接口Redundant interface,并将两个物理接口到Redundant interface中。成员接口有且只有两个。
-
物理接口则为Redundant interface接口的成员接口,其中一个成员接口为主用接口,一个为备用接口,实现链路冗余。
-
主用接口转发流量,备用接口作为主用接口的备份。当主用接口故障,备用接口成为主用接口来转发流量。
-
当加入成员接口到Redundant interface中时,成员接口配置清空,所有配置在Redundant interface中完成。
注:如下图所示,Ethernet 0/0 和Ethernet 0/1为逻辑Redundant 1的成员接口,Ethernet 0/2和Ethernet 0/3为Redundant 2的成员接口。
二.成员接口选举和角色切换
两个成员接口中如何选举出主用接口和备用接口:
-
最先加入到Redundant interface接口的成员接口为主用接口,另外一个接口为备用接口。
-
Redundant interface使用最新加入成员接口的MAC地址作为自己的MAC地址使用。
-
当主用接口故障,备用接口成为主用,但Redundant interface的MAC地址不变,依然使用原主用接口MAC地址。
-
当原主用接口恢复正常,依然处于备用状态,不会发生状态切换。
三. Redundant Interface和物理接口的配置要求
添加成员接口到虚拟接口Redundant interface中时,有如下注意事项:
-
同一台ASA中Redundant interface最多创建8个。
-
最多添加2个成员接口到一个Redundant interface中。成员接口不能是子接口。
-
成员接口必须拥有相同的接口速率,双工类型。(例如:10/100/1000 BASE-TX,duplex full)
四. Redundant Interface配置说明
创建Redundant interface1,并且加入成员接口 Ethernet 0/0 和 Ethernet 0/1 。
ciscoasa(config)# interface redundant 1
ciscoasa(config-if)# member-interface ethernet0/0
INFO: security-level and IP address are cleared on Ethernet0/0
ciscoasa(config-if)# member-interface ethernet0/1
INFO: security-level and IP address are cleared on Ethernet0/1
ciscoasa(config-if)# no shutdown
Part 3 - Ether Channel
看完Part 2,大家对接口冗余备份技术应该有初步认识了吧。就在刚刚,大飞哥提出了疑问:Redundant interface中只能同时加入2个成员接口,如果2个成员接口都Down了怎么办,而且只有一个主用接口,也没有办法实现流量负载呢?
相信大家跟大飞哥有同样的疑问吧,接下来将为大家介绍的Ether Channel技术,既可以实现多接口冗余备份,同时也可以做到流量的负载分摊,接口带宽得到充分利用。
一. Ether Channel工作原理介绍
-
ASA中最多可创建48个Ether Channel虚拟口。每个Ether Channel虚拟口中最多可以添加16个物理成员接口,其中最多可以设置8个成员接口为活动端口(类似于Redundant interface中主用端口),其他成员接口为非活动端口(类似于Redundant interface中备用端口)。
-
当活动端口故障,非活动端口变为活动端口转发流量。
-
活动端口间可以实现流量的负载分摊,充分利用链路资源。
在Ether Channel技术中,同样是将物理接口作为成员接口添加到虚拟接口Ether Channel中,如下图所示。
二.Ether Channel中成员接口选举
当两台设备用Ether Channel互联时,通过LACP(Link Aggregation Control Protocol)协议协商。
-
决定哪些接口可以协商成Ether Channel
-
确保设备两端参与的成员端口一致性
-
决定哪些端口为活动端口,哪些端口为非活动端口。
- LACP的协商方式,只有当协商方式匹配,Ether Channel才能建立。
协商方式 | 是否主动发送协商报文 | 说明 |
---|---|---|
ON | 否 | 静态绑定方式,一方为ON模式,另一方必须也为ON模式 |
Passive | 否 | 被动模式,等待对端发送协商报文,对端必须为Active模式 |
Active | 是 | 主动模式,主动发送协商报文,对端可以是Active或Passive模式 |
- 系统LACP优先级:由 2 byte 优先级(默认32768) + 6 Byte MAC组成
为了区分两端设备优先级的高低而配置的参数,静态LACP模式下,两端设备选择的活动接口必须保持一致,否则Ether Channel无法建立,要想使两端活动接口保持一致,可以使其中一端具有更高优先级,另一端根据高优先级的一端来选择活动接口。系统LACP优先级值越小,优先级越高。
- 接口LACP优先级:由 2 byte 优先级(默认32768) + 6 byte 端口编号组成
为了区分不同接口被选为活动接口的优先程度,接口LACP优先级数值越小,优先级越高。越有可能成为活动接口。
三.Ether Channel中负载均衡的方式
因为Ether Channel中最大同时支持8个活动接口,为了对接口带宽的充分利用,Ether Channel可以对多个活动接口进行流量分摊,让多个接口同时转发流量。
ASA支持分摊方式如下:
* Destination IP
* Destination IP and Layer 4 Port
* Destination MAC Address
* Destination Layer 4 Port
* Source and Destination IP Address
* Source and Destination MAC Address
* Source and Destination IP Address and Layer 4 Port
* Source and Destination Layer 4 Port
* Source IP Address
* Source IP Address and Layer 4 Port
* Source MAC Address
* Source Layer 4 Port
* VLAN Destination IP Address
* VLAN Destination IP and Layer 4 Port
* VLAN Only
* VLAN Source and Destination IP Address
* VLAN Source and Destination IP Address and Layer 4 Port
* VLAN Source IP Address
* VLAN Source IP Address and Layer 4 Port
默认情况是基于源目IP地址的负载方式。
四. 配置Ether Channel的要求
-
ASA软件版本高于8.4(1)
-
成员接口类型,速率,双工(全双工,半双工)必须一致
五. Ether Channel配置说明
1. 配置说明
- 设置系统优先级
- 配置端口优先级
- 修改负载均衡的方式(默认基于源目IP地址)
ciscoasa(config)# lacp system-priority priority
ciscoasa(config)# interface type mod/num
ciscoasa(config-if)# channel-group number mode {on | passive | active}
ciscoasa(config-if)# lacp port-priority priority
ciscoasa(config-if)# port-channel load-balance *src-dst-mac*
2. 配置查看
- 查看Ether Channel是否建立成功,成员接口Flags为“P”,虚拟接口P01为“U”,表示Ether Channel建立成功。
ciscoasa# show port-channel summary
Flags: D - down P - bundled in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
U - in use N - not in use, no aggregation/nameif
M - not in use, no aggregation due to minimum links not met
w - waiting to be aggregated
Number of channel-groups in use: 1
Group Port-channel Protocol Ports
------+-------------+-----------+-----------------------------------------------
1 Po1(U) LACP Et0/2(P) Et0/3(P)
Part 4 -综合实验
一.实验拓扑
二.实验需求
如上图所示,完成以下需求:
-
在SW1与ASA之间部署Redundant interface互联。
-
在ASA与SW2之间部署Ether Channel互联。
-
实现inside网络中的R1可以telnet到outside网络中的R2。
-
当ASA Ethernet 0/0 和Ethernet 0/3链路故障,R1依然可以Telnet到R2。
三.设备和IP地址说明
1. 交换机VLAN规划
交换机 | VLAN | 接口 |
---|---|---|
SW1 | 51 | Ethernet 0/0,Ethernet 0/1,Ethernet 0/2 |
SW2 | 50 | Ethernet 0/2,Port-channel 1 |
2. 设备IP地址分配
设备 | 接口 | IP地址 |
---|---|---|
ASA | Port-channel 1 | 10.0.0.12/24 |
ASA | Redundant 1 | 150.50.0.12/24 |
R1 | Ethernet 0/0 | 10.0.0.1/24 |
R2 | Ethernet 0/0 | 150.50.0.2/24 |
四.实验配置
1. 将交换机SW1和SW2接口加入到VLAN,并且配置接口为port fast边缘端口(不发送BPDU),并且将SW2的Ethernet e0/0和Ethernet e0/1加入到Port-channel1中,LACP协商模式为Active。
- SW1的配置
vlan 51
interface Ethernet0/2
switchport access vlan 51
switchport mode access
spanning-tree portfast edge
interface Ethernet0/0
switchport access vlan 51
switchport mode access
spanning-tree portfast edge
switchport access vlan 51
switchport mode access
spanning-tree portfast edge
- SW2的配置
vlan 50
interface Ethernet0/0
switchport access vlan 50
switchport mode access
channel-group 1 mode active
spanning-tree portfast edge
interface Ethernet0/1
switchport access vlan 50
switchport mode access
channel-group 1 mode active
spanning-tree portfast edge
2. 路由器的基本配置
- 配置R1和R2接口IP地址
R1:
interface Ethernet0/0
ip address 10.0.0.1 255.255.255.0
R2:
interface Ethernet0/0
ip address 150.50.0.2 255.255.255.0
- 配置R1去往outside区域的路由
ip route 150.50.0.0 255.255.255.0 10.0.0.12
- 配置R2去往inside区域的路由
ip route 10.0.0.0 255.255.255.0 150.50.0.12
- 开启R2的telnet服务,测试使用
line vty 0 4
password cisco
login
transport input telnet
3. ASA部署Redundant interface
- 开启成员接口Ethernet0和Ethernet1
interface Ethernet0
no shutdown
interface Ethernet1
no shutdown
- 创建Redundant接口,为Redundant接口命名,设置安全级别,配置IP地址,并添加成员接口。
interface Redundant1
member-interface Ethernet0
member-interface Ethernet1
nameif inside
security-level 100
ip address 10.0.0.12 255.255.255.0
- 查看Redundant interface状态
ciscoasa# show interface redundant 1
Interface Redundant1 "inside", is up, line protocol is up
Hardware is i82559, BW 100 Mbps, DLY 100 usec
Auto-Duplex(Full-duplex), Auto-Speed(100 Mbps)
Input flow control is unsupported, output flow control is unsupported
MAC address 5000.0005.0000, MTU 1500
IP address 10.0.0.12, subnet mask 255.255.255.0
169 packets input, 11427 bytes, 0 no buffer
Received 13 broadcasts, 0 runts, 0 giants
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 pause input, 0 resume input
7 L2 decode drops
146 packets output, 10084 bytes, 0 underruns
0 pause output, 0 resume output
0 output errors, 0 collisions, 0 interface resets
0 babbles, 0 late collisions, 0 deferred
0 lost carrier, 0 no carrier
0 input reset drops, 0 output reset drops
input queue (curr/max packets): hardware (0/2) software (0/10)
output queue (curr/max packets): hardware (0/10) software (0/2)
Traffic Statistics for "inside":
168 packets input, 7774 bytes
146 packets output, 7063 bytes
3 packets dropped
1 minute input rate 1 pkts/sec, 56 bytes/sec
1 minute output rate 1 pkts/sec, 58 bytes/sec
1 minute drop rate, 0 pkts/sec
5 minute input rate 0 pkts/sec, 0 bytes/sec
5 minute output rate 0 pkts/sec, 0 bytes/sec
5 minute drop rate, 0 pkts/sec
Redundancy Information:
Member Ethernet0(Active), Ethernet1
Last switchover at 09:43:16 UTC Jan 21 2019
4. ASA与SW2之间部署Ether Channel
- 将接口Ethernet 2和Ethernet 3捆绑到Port-channel1接口。
interface Ethernet2
channel-group 1 mode active
interface Ethernet3
channel-group 1 mode active
- 为Port-channel1接口命名,设置安全级别,配置IP地址。
interface Port-channel1
nameif outside
security-level 0
ip address 150.50.0.12 255.255.255.0
- 查看Ether Channel状态
ciscoasa# show port-channel summary
Flags: D - down P - bundled in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
U - in use N - not in use, no aggregation/nameif
M - not in use, no aggregation due to minimum links not met
w - waiting to be aggregated
Number of channel-groups in use: 1
Group Port-channel Protocol Ports
------+-------------+-----------+-----------------------------------------------
1 Po1(U) LACP Et2(P) Et3(P)
5. 测试R1到R2的telnet流量
R1#telnet 150.50.0.2
Trying 150.50.0.2 ... Open
User Access Verification
Password:
6. 故障测试
- 断开ASA的Ethernet 0和Ethernet 3接口。
interface Ethernet0
shutdown
interface Ethernet3
shutdown
- 再次测试R1到R2的telnet流量
R1#telnet 150.50.0.2
Trying 150.50.0.2 ... Open
User Access Verification
Password: