非等价链路部分设备跑OSPF自动切换SLA测试

一.概述:
   QQ群里一位网友咨询三个地方通过MSTP专线两两互连,都是思科的设备,但是其中一台不支持OSPF,问如果保证正常情况下,数据走8M线路,但8M链路出现问题时才走4M备份链路,于是用GNS3搭建环境测试了一下,温习一下sla的设置。
二.基本思路:
A.静态路由优先动态OSPF路由,静态路由配置不同的metric值,并且设置SLA
B.备份链路因为能跑动态路由,因此把静态路由重分布到动态路由,这样可以保证三条线路任意一条线路出现故障时都不会影响三个网络的互相访问。
三.测试拓扑:
非等价链路部分设备跑OSPF自动切换SLA测试

四.基本配置:
A.R1:

interface Loopback100
ip address 192.168.1.1 255.255.255.0
interface FastEthernet0/0
ip address 12.1.1.1 255.255.255.0
no shut
interface FastEthernet0/1
ip address 13.1.1.1 255.255.255.0
no shut
B.R2:
interface Loopback0
ip address 2.2.2.2 255.255.255.0
interface Loopback100
ip address 192.168.2.2 255.255.255.0
ip ospf network point-to-point
interface FastEthernet0/0
ip address 12.1.1.2 255.255.255.0
no shut
interface FastEthernet0/1
ip address 23.1.1.2 255.255.255.0
no shut
C.R3:
interface Loopback0
ip address 3.3.3.3 255.255.255.0
interface Loopback100
ip address 192.168.3.3 255.255.255.0
ip ospf network point-to-point
interface FastEthernet0/0
ip address 13.1.1.3 255.255.255.0
no shut     
interface FastEthernet0/1
ip address 23.1.1.3 255.255.255.0
no shut
五.静态路由配置:
A.R1:

ip route 192.168.2.0 255.255.255.0 12.1.1.2
ip route 192.168.2.0 255.255.255.0 13.1.1.3 10
ip route 192.168.3.0 255.255.255.0 13.1.1.3
ip route 192.168.3.0 255.255.255.0 12.1.1.2 10
----配置两条不同metric的路由,优先选择metric小的条目

----目标网络是相邻设备的直连网络,可以不用配置SLA,当直连线路出现故障时会自动选择metric大的那条路由。
B.R2:
ip route 192.168.1.0 255.255.255.0 12.1.1.1 (静态路由优先动态路由

C.R3:
ip route 192.168.1.0 255.255.255.0 13.1.1.1  静态路由优先动态路由
六.SLA及静态路由
A.R2:
ip sla 1
icmp-echo 13.1.1.1 source-interface FastEthernet0/0
frequency 10
ip sla schedule 1 life forever start-time now
track 1 rtr 1 reachability
ip route 192.168.3.0 255.255.255.0 12.1.1.1 track 1
ip route 13.1.1.1 255.255.255.255 12.1.1.1 tag 10
----配置主机路由是为了进行track,主机路由打tag是为了后面OSPF重分布时方便过滤

----选择的是绕行线路,需要配置监控,监控绕行的非直连链路上面的IP

B.R3:
ip sla 1
icmp-echo 12.1.1.1 source-interface FastEthernet0/0
frequency 10
ip sla schedule 1 life forever start-time now
track 1 rtr 1 reachability
ip route 12.1.1.1 255.255.255.255 13.1.1.1 tag 10
ip route 192.168.2.0 255.255.255.0 13.1.1.1 track 1
----配置主机路由是为了进行track,主机路由打tag是为了后面OSPF重分布时方便过滤

----选择的是绕行线路,需要配置监控,监控绕行的非直连链路上面的IP

七.动态路由OSPF配置:
A.R2:
route-map static deny 10
match tag 10
route-map static permit 20
router ospf 1
router-id 2.2.2.2
redistribute static subnets route-map static
passive-interface default
no passive-interface FastEthernet0/1
network 23.1.1.0 0.0.0.255 area 0
network 192.168.2.0 0.0.0.255 area 0
B.R3:
route-map static deny 10
match tag 10
route-map static permit 20
router ospf 1
router-id 3.3.3.3
redistribute static subnets route-map static
passive-interface default
no passive-interface FastEthernet0/1
network 23.1.1.0 0.0.0.255 area 0
network 192.168.3.0 0.0.0.255 area 0
八.测试:

A.正常情况下测试

----测试结果:所有流量都走两条8M的线路

①R1上traceroute

----R1去R2和R3身后网络,都走直连8M线路

R1#traceroute 192.168.2.2 source 192.168.1.1

Type escape sequence to abort.
Tracing the route to 192.168.2.2

 1 12.1.1.2 100 msec *  68 msec
R1#traceroute 192.168.3.3 source 192.168.1.1

Type escape sequence to abort.
Tracing the route to 192.168.3.3

 1 13.1.1.3 76 msec *  108 msec
②R2上traceroute

----R2去R3身后网络,从R1绕行,选择两跳都为8M的线路
R2#traceroute 192.168.1.1 source 192.168.2.2

Type escape sequence to abort.
Tracing the route to 192.168.1.1

 1 12.1.1.1 108 msec *  60 msec
R2#traceroute 192.168.3.3 source 192.168.2.2

Type escape sequence to abort.
Tracing the route to 192.168.3.3

 1 12.1.1.1 120 msec 92 msec 64 msec
 2 13.1.1.3 108 msec *  96 msec
③R3上traceroute

----R3去R2身后网络,从R1绕行,选择两跳都为8M的线路
R3#traceroute 192.168.1.1 source 192.168.3.3

Type escape sequence to abort.
Tracing the route to 192.168.1.1

 1 13.1.1.1 92 msec *  80 msec
R3#traceroute 192.168.2.2 source 192.168.3.3

Type escape sequence to abort.
Tracing the route to 192.168.2.2

 1 13.1.1.1 76 msec 80 msec 24 msec
 2 12.1.1.2 176 msec *  108 msec

B.R1和R3之间的8M链路出现故障:

----在GNS中必须把相连的两个接口都shutdown,实际情况只要链路出现故障,应该两个设备都能检测的到。

①R1上traceroute

----R1去R3身后网络,自动走R2绕行

R1#traceroute 192.168.2.2 source 192.168.1.1

Type escape sequence to abort.
Tracing the route to 192.168.2.2

 1 12.1.1.2 92 msec *  64 msec
R1#traceroute 192.168.3.3 source 192.168.1.1

Type escape sequence to abort.
Tracing the route to 192.168.3.3

 1 12.1.1.2 100 msec 80 msec 44 msec
 2 23.1.1.3 96 msec *  108 msec
②R2上traceroute

----R2去R1和R3身后网络,都走直连
R2#traceroute 192.168.1.1 source 192.168.2.2

Type escape sequence to abort.
Tracing the route to 192.168.1.1

 1 12.1.1.1 60 msec *  128 msec
R2#traceroute 192.168.3.3 source 192.168.2.2

Type escape sequence to abort.
Tracing the route to 192.168.3.3

 1 23.1.1.3 120 msec *  112 msec
③R3上traceroute

----R3去R1身后网络,自动走R2绕行
R3#traceroute 192.168.1.1 source 192.168.3.3

Type escape sequence to abort.
Tracing the route to 192.168.1.1

 1 23.1.1.2 100 msec 92 msec 68 msec
 2 12.1.1.1 84 msec *  112 msec
R3#traceroute 192.168.2.2 source 192.168.3.3

Type escape sequence to abort.
Tracing the route to 192.168.2.2

 1 23.1.1.2 120 msec *  80 msec
C.R1和R3之间的8M链路恢复,但R1和R2之间的8M链路出现故障:
①R1上traceroute

----R1去R2身后网络,自动走R3

R1#traceroute 192.168.2.2 source 192.168.1.1

Type escape sequence to abort.
Tracing the route to 192.168.2.2

 1 13.1.1.3 52 msec 88 msec 44 msec
 2 23.1.1.2 88 msec *  132 msec
R1#traceroute 192.168.3.3 source 192.168.1.1

Type escape sequence to abort.
Tracing the route to 192.168.3.3

 1 13.1.1.3 132 msec *  92 msec
②R2上traceroute

----R2去R1身后网络,自动走R3
R2#traceroute 192.168.1.1 source 192.168.2.2

Type escape sequence to abort.
Tracing the route to 192.168.1.1

 1 23.1.1.3 68 msec 112 msec 64 msec
 2 13.1.1.1 80 msec *  116 msec
R2#traceroute 192.168.3.3 source 192.168.2.2

Type escape sequence to abort.
Tracing the route to 192.168.3.3

 1 23.1.1.3 112 msec *  140 msec
③R3上traceroute

----R3去R1和R2身后网络,都走直连
R3#traceroute 192.168.1.1 source 192.168.3.3

Type escape sequence to abort.
Tracing the route to 192.168.1.1

 1 13.1.1.1 92 msec *  * 
R3#traceroute 192.168.2.2 source 192.168.3.3  

Type escape sequence to abort.
Tracing the route to 192.168.2.2

 1 23.1.1.2 84 msec *  116 msec




本文转自 碧云天 51CTO博客,原文链接:http://blog.51cto.com/333234/1231044,如需转载请自行联系原作者

上一篇:iOS Core Telephony Framework


下一篇:linux samba搭建