一 本文将通过Cisco IP SLA和EEM来演示中等规模数据中心多出口的优化设计方案,数据中心构建背景介绍:
1、数据中心从ISP申请了多条出口链路,本文以三条演示,其中默认启用前2条,在其中任何一条发生故障后,自动启用第三条,每条接在运营商相同或者不同设备上。
2、主要使用静态路由技术。
3、使用IP SLA和EEM来优化数据中心故障倒换速度。
二、设计拓扑如下:
三、配置(主要配置基本都在R1)
①R1接口配置
interface FastEthernet0/0
ip address 1.1.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
no switchport
ip address 2.2.2.1 255.255.255.0
!
interface FastEthernet1/1
no switchport
ip address 3.3.3.1 255.255.255.0
shutdown
①静态路由和IP SLA配置
ip sla 1
icmp-echo 1.1.1.2 source-interface FastEthernet0/0
timeout 1000
threshold 10
frequency 5
ip sla schedule 1 life forever start-time now
ip sla 2
icmp-echo 2.2.2.2 source-interface FastEthernet1/0
timeout 1000
threshold 10
frequency 5
ip sla schedule 2 life forever start-time now
!
track 1 rtr 1 reachability
!
track 2 rtr 2 reachability
!
ip route 0.0.0.0 0.0.0.0 1.1.1.2 track 1
ip route 0.0.0.0 0.0.0.0 2.2.2.2 track 2
ip route 1.1.1.2 255.255.255.255 fa0/0
ip route 2.2.2.2 255.255.255.255 fa1/0
③EEM配置
event manager applet test
event track 1 state down
action 1 cli command "enable"
action 2 cli command "conf t"
action 3 cli command "int fa1/1"
action 4 cli command "no sh"
action 5 cli command "ip route 0.0.0.0 0.0.0.0 3.3.3.2"
!
event manager applet test2
event track 2 state down
action 1 cli command "enable"
action 2 cli command "conf t"
action 3 cli command "int fa1/1"
action 4 cli command "no sh"
action 5 cli command "ip route 0.0.0.0 0.0.0.0 3.3.3.2"
!
四 验证
①、初始状态
R1#show ip route static
S* 0.0.0.0/0 [1/0] via 2.2.2.2
[1/0] via 1.1.1.2
R1#show track
Track 1
Response Time Reporter 1 reachability
Reachability is Up
2 changes, last change 00:42:43
Latest operation return code: Over threshold
Latest RTT (millisecs) 40
Tracked by:
STATIC-IP-ROUTING 0
EEM applet test2
Track 2
Response Time Reporter 2 reachability
Reachability is Up
7 changes, last change 00:01:08
Latest operation return code: Over threshold
Latest RTT (millisecs) 88
Tracked by:
STATIC-IP-ROUTING 0
EEM applet test
②把R4的fa1/0口down掉,并在R1开启EEM的debug
*Mar 1 00:54:30.027: %TRACKING-5-STATE: 2 rtr 2 reachability Up->Down----Track2已经down了
R1# ------------接下来开始执行EEM功能
*Mar 1 00:54:30.063: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : CTL : cli_open called.
*Mar 1 00:54:30.071: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : R1>
*Mar 1 00:54:30.071: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : IN : R1>enable
*Mar 1 00:54:30.135: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : R1#
*Mar 1 00:54:30.139: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : IN : R1#conf t
*Mar 1 00:54:30.199: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : Enter configuration commands, one per line. End with CNTL/Z.
*Mar 1 00:54:30.199: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : R1(config)#
*Mar 1 00:54:30.203: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : IN : R1(config)#int fa1/1
*Mar 1 00:54:30.267: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : R1(config-if)#
*Mar 1 00:54:30.267: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : IN : R1(config-if)#no sh
*Mar 1 00:54:30.359: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : R1(config-if)#
*Mar 1 00:54:30.359: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : IN : R1(config-if)#ip route 0.0.0.0 0.0.0.0 3.3.3.2
*Mar 1 00:54:30.451: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : R1(config)#
*Mar 1 00:54:30.455: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : CTL : cli_close called.
③查看R1的静态路由
R1#show ip route static
S* 0.0.0.0/0 [1/0] via 3.3.3.2 -------------------可以看到已经把路由切换到R5上
[1/0] via 1.1.1.2
五 总结
①静态路由默认一直会存在路由表中,除非当R1路由器自身接口发生故障时,默认路由会失效。
②当和R1直连的接口发生故障时,默认路由并不消失,此时会发生流量异常,通过IP SLA对对端接口IP进行监控,可以有些解决这个问题发生。
③当流量较高时,如果一条链路发生故障,势必会造成流量拥塞,通过EEM可以自动启用新的接口来增加带宽。
④以上仅是IP SLA和EEM的简单应用,详细请参考官网指南。