IP SLA(Internet Protocol Service-Level Agreement)互联网服务等级协议,本实验里通过发送测试报文,测试下一跳是否可达,结合Track实现冗余静态路由的切换。
实验环境:
    模拟器:GNS3
    路由器:C3640-JK9O3S-M-12.4(7a).BIN
    终端:VPCS
网络拓扑:
wKiom1aYnvTzMTEUAABM4-5GKmU787.png

    R4模拟某公司专线接入路由器,R3模拟对端银行网络设备。
    R4和R3之间通过两条专线互联,联通专线为主链路,电信专线为备链路。
    PC1模拟公司客户端服务器,PC2模拟银行服务端服务器。PC1通过专线访问银行服务端PC2。
实验目的:
    当主链路出问题时,自动切换到备份链路。

网络配置:

R4:

R4#show ip int b
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.193.1   YES manual up                    up
FastEthernet1/0            192.168.194.1   YES manual up                    up
FastEthernet2/0            192.168.40.254  YES manual up                    up

R3:

R3#show ip int b
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.193.2   YES manual up                    up
FastEthernet1/0            192.168.194.2   YES manual up                    up
FastEthernet2/0            192.168.206.254 YES manual up                    up

VPCS:

PC1> ip 192.168.40.41/24 192.168.40.254
PC2> ip 192.168.206.1/24 192.168.206.254

IP SLA配置命令:

R4:

R4#conf t
R4(config)#ip sla monitor 11
R4(config-sla-monitor)#type echo protocol ipIcmpEcho 192.168.193.2 source-interface f0/0
R4(config-sla-monitor-echo)#timeout 1000
R4(config-sla-monitor-echo)#frequency 3
R4(config-sla-monitor-echo)#exit
R4(config)#ip sla monitor schedule 11 life forever start-time now
R4(config)#track 1 rtr 11 reachability
R4(config-track)#exit
// 静态路由(主链路):
R4(config)#ip route 192.168.206.1 255.255.255.255 192.168.193.2 track 1
// 浮动静态路由(备份链路):
R4(config)#ip route 192.168.206.1 255.255.255.255 192.168.194.2 10

R3:

R3#conf t
R3(config)#ip sla monitor 11
R3(config-sla-monitor)#type echo protocol ipIcmpEcho 192.168.193.1 source-interface f0/0
R3(config-sla-monitor-echo)#timeout 1000
R3(config-sla-monitor-echo)#frequency 3
R3(config-sla-monitor-echo)#exit
R3(config)#ip sla monitor schedule 11 life forever start-time now
R3(config)#track 1 rtr 11 reachability
R3(config-track)#exit
// 静态路由(主链路):
R3(config)#ip route 192.168.40.41 255.255.255.255 192.168.193.1 track 1
// 浮动静态路由(备份链路):
R3(config)#ip route 192.168.40.41 255.255.255.255 192.168.194.1 10

测试:

// 当前主链路静态路由
R4#show ip route static
     192.168.206.0/32 is subnetted, 1 subnets
S       192.168.206.1 [1/0] via 192.168.193.2

R3# show ip route static
     192.168.40.0/32 is subnetted, 1 subnets
S       192.168.40.41 [1/0] via 192.168.193.1

// 把主链路一边端口down掉
R4#conf t
R4(config)#int f0/0
R4(config-if)#shutdown
R4(config-if)#end

// 3秒后已切换为备用静态路由
R4#show ip route static
     192.168.206.0/32 is subnetted, 1 subnets
S       192.168.206.1 [10/0] via 192.168.194.2

R3#show ip route static
     192.168.40.0/32 is subnetted, 1 subnets
S       192.168.40.41 [10/0] via 192.168.194.1

wKioL1aYqSTSMp2iAADg0pTj4nI794.png

    通过长ping发现路由切换后连通正常。

后记:

    在双方设备条件允许情况下,可以使用BFD检测机制,提供毫秒级检测。大多数情况下,由于银行网络设备厂商不同、设备新旧程度不同,可能不支持BFD协议,所以IP SLA作为备选方案提供秒级的检测。华为的NQA技术和cisco IP SLA类似