CiscoIPSLA可用于链接到两家ISP情况下,可以执行可达性测试,只有当ISP网络可达时,它才通告该路由,这样就可以避免因ISP不可达而丢失数据包。例如,下图中,ISP-1到Internet的连接出现故障,但连接到客户的接口正常,这时客户的数据流仍会发送给ISP-1,这些数据就会在ISP-1处丢失。


一、实验步骤

.配置路由器

R1:

配置路由协议:

R1(config)#ip route 0.0.0.0  0.0.0.0 209.165.201.1

配置SLA:

R1(config)#ip sla 11

//定义一个LSA编号,范围是1~2147483647

R1(config-ip-sla)#icmp-echo  209.165.201.30

//定义操作类型为“icmp-echo”,用于连通性测试,指定目标地址

R1(config-ip-sla-echo)#fre

R1(config-ip-sla-echo)#frequency  10

//定义SLA操作的频率,默认为60s

R1(config-ip-sla-echo)#exit

R1(config)#ip sla schedule 11 life  forever start-time now

//配置SLA的参数,”Life“默认为3600s,”forever“表示一直有效,”Ageout“定义停止信息采集后,在内存中保存的时间,默认是0,即一直保留。”start-time“定义开始采集的时间,”Now“表示立即采用,也可以使用”after“参数定义在多长时间后开始。

应用SLA

R1(config)#track 1 rtr 11  reachability

//定义跟踪对象,应该为track  1 ip sla 11 reachability,不知怎么不支持该配置,只能使用track 1 rtr 11 reachability ,12.4IOS应该支持的,难道是模拟器的问题吗?

R1(config-track)#delay down 10 up  1

//这个是??

R1(config)#ip route 0.0.0.0  0.0.0.0 209.165.201.1 2 track 1

//配置跟踪对象的默认路由,管理距离设置为2

对于通往ISP-2链路:

track 2 ip sla 22 reachability

delay down 10 up 1

exit

ip route 0.0.0.0 0.0.0.0  209.165.202.129 3 track 2

//管理距离为3,此时,浮动静态路由会首选ISP-1

R2:配置路由协议:

R2(config)#router eigrp 1

R2(config-router)#network  209.165.200.224 0.0.0.3

R2(config-router)#network  209.165.201.0 0.0.0.31

R2(config-router)#no auto

R2(config-router)#no auto-summary

R2(config)#ip route 192.168.1.0  255.255.255.0 209.165.201.2

R3:

R3(config)#router eigrp 1

R3(config-router)#network  209.165.200.224 0.0.0.3

*Mar  1 00:19:26.903: %DUAL-5-NBRCHANGE:  IP-EIGRP(0) 1: Neighbor 209.165.200.225 (Serial3/1) is up: new adjacency

R3(config-router)#network  209.165.202.128 0.0.0.31

R3(config-router)#no auto-summary

*Mar  1 00:20:00.035: %DUAL-5-NBRCHANGE:  IP-EIGRP(0) 1: Neighbor 209.165.200.225 (Serial3/1) is resync: summary  configured

R3(config)#ip route 192.168.1.0  255.255.255.0 209.165.201.2

2.调试

查看SLA配置:

R1(config)#do sh ip sla config 11

IP SLAs, Infrastructure Engine-II.

Entry number: 11

//IPSLA操作编号

Owner:

//SNMP的拥有者

Tag:

//用户指定的 IP SLA标识

Type of operation to perform:  icmp-echo

//IPSLA的操作类型

Target address/Source address:  209.165.201.30/0.0.0.0

//监控的目标地址和源地址

Operation timeout (milliseconds):  5000

//等待SLA操作的请求数据包的响应时间

Type Of Service parameters: 0x0

//服务类型参数

Vrf Name:

Request size (ARR data portion):  28

//SLA操作的请求数据包的payload大小

Verify data: No

//没有验证SLA响应数据

Schedule:

   Operation frequency (seconds): 10   (not considered if randomly scheduled)

   Next Scheduled Start Time: Start Time already passed

   Group Scheduled : FALSE

   Randomly Scheduled : FALSE

   Life (seconds): Forever

   Entry Ageout (seconds): never

   Recurring (Starting Everyday): FALSE

//指的是每天在指定时间自动执行,并持续life指定的时间

   Status of entry (SNMP RowStatus): Active

Threshold (milliseconds): 5000

//计算对收集信息统计的门限值

Distribution Statistics:

   Number of statistic hours kept: 2

   Number of statistic distribution buckets kept: 1

   Statistic distribution interval (milliseconds): 20

//统计间隔

History Statistics:

   Number of history Lives kept: 0

   Number of history Buckets kept: 15

   History Filter Type: None

Enhanced History:

R1(config)#do sh ip sla  statistics  11

Round Trip Time (RTT) for       Index 11

       Latest RTT: 28 milliseconds

Latest operation start time:  *01:07:28.251 UTC Fri Mar 1 2002

//最后一次探测时间

Latest operation return code: OK

//最后操作返回的代码

Number of successes: 227

//探测成功的次数

Number of failures: 1

//探测失败的次数

Operation time to live: Forever

查看track

R1(config)#do sh track

Track 1

  Response Time Reporter 11 reachability

  Reachability is Up

//可达性为up

    1 change, last change 00:23:13

  Delay up 1 sec, down 10 secs

//updown的延迟时间

  Latest operation return code: OK

  Latest RTT (millisecs) 32

  Tracked by:

    STATIC-IP-ROUTING 0

//在静态路由中使用

Track 2

  Response Time Reporter 22 reachability

  Reachability is Down

    1 change, last change 00:01:14

  Latest operation return code: Timeout

  Tracked by:

    STATIC-IP-ROUTING 0

查看路由表:

Gateway of last resort is  209.165.201.1 to network 0.0.0.0


    209.165.201.0/30 is subnetted, 1 subnets

C       209.165.201.0 is directly connected,  Serial3/0

    209.165.202.0/30 is subnetted, 1 subnets

C       209.165.202.128 is directly connected,  Serial3/2

C    192.168.1.0/24 is directly connected,  Loopback0

S*   0.0.0.0/0 [2/0] via 209.165.201.1

//采用ISP-1路由

down掉通往ISP-1Server,即loopback 1

R2(config)#int lo 1

R2(config-if)#shutdown

R2(config-if)#

*Mar  1 01:21:35.155: %LINK-5-CHANGED: Interface  Loopback1, changed state to administratively down

*Mar  1 01:21:36.155: %LINEPROTO-5-UPDOWN: Line  protocol on Interface

Loopback1, changed state to down

查看路由表:

Gateway of last resort is  209.165.201.1 to network 0.0.0.0


    209.165.201.0/30 is subnetted, 1 subnets

C       209.165.201.0 is directly connected,  Serial3/0

    209.165.202.0/30 is subnetted, 1 subnets

C       209.165.202.128 is directly connected,  Serial3/2

C    192.168.1.0/24 is directly connected,  Loopback0

S*   0.0.0.0/0 [3/0] via 209.165.202.129

此时,R1采用了ISP-2