Skip to main content

 路由器网 > 新闻资讯 >

双线双路和断线自动切换

2012-08-13 22:08 浏览:
拓扑图:

实验要求:

1.R1 ping 5.5.5.5 数据包从R1-R2-R3-R5到达

2.R2 ping 123.1.1.5 数据包从R1-R2-R4-R5到达

3.R2、R3、R4、R5上不能运行动态路由协议

4.R2上能实现断线自动切换线路

配置:

  R1上

  R1>en

  R1#conf t

  R1(config)#int fa0/0

  R1(config-if)#ip address 12.1.1.10 255.255.255.0

  R1(config-if)#no shutdown

  R1(config-if)#exit

  R1(config)#ip route 0.0.0.0 0.0.0.0 fa0/0

  R2上

  R2>en

  R2#conf t

  R2(config)#int fa0/0

  R2(config-if)#ip address 12.1.1.1 255.255.255.0

  R2(config-if)#ip nat inside

  R2(config-if)#no shutdown

  R2(config-if)#exit

  R2(config)#int fa1/0

  R2(config-if)#ip address 23.1.1.2 255.255.255.0

  R2(config-if)#ip nat outside

  R2(config-if)#no shutdown

  R2(config-if)#exit

  R2(config)#int fa2/0

  R2(config-if)#ip address 24.1.1.2 255.255.255.0

  R2(config-if)#ip nat outside

  R2(config-if)#no shutdown

  R2(config-if)#exit

  R2(config)#access-list 1 permit 12.1.1.0 0.0.0.255

  R2(config)#route-map aaa permit 10

  R2(config-route-map)#match ip addressress 1

  R2(config-route-map)#match interface FastEthernet1/0

  R2(config-route-map)#exit

  R2(config)#route-map bbb permit 10

  R2(config-route-map)#match ip addressress 1

  R2(config-route-map)#match interface FastEthernet2/0

  R2(config-route-map)#exit

  R2(config)#ip route 0.0.0.0 0.0.0.0 23.1.1.3或(ip route 5.5.5.0 255.255.255.0 24.1.1.4 100)

  R2(config)#ip route 0.0.0.0 0.0.0.0 24.1.1.4或(ip route 123.1.1.5 255.255.255.255 23.1.1.3 100)

  R2(config)#ip route 5.5.5.0 255.255.255.0 23.1.1.3

  R2(config)#ip route 123.1.1.5 255.255.255.255 24.1.1.4

  R2(config)#ip nat inside source route-map aaa interface Fa1/0

  R2(config)#ip nat inside source route-map bbb interface Fa2/0

  R3上

  R3>en

  R3#conf t

  R3(config)#int fa0/0

  R3(config-if)#ip address 23.1.1.3 255.255.255.0

  R3(config-if)#no shutdown

  R3(config-if)#exit

  R3(config)#int fa1/0

  R3(config-if)#ip address 123.1.1.3 255.255.255.0

  R3(config-if)#no shutdown

  R3(config-if)#exit

  R3(config)#ip route 5.5.5.0 255.255.255.0 123.1.1.5

  R4上

  R4>en

  R4#conf t

  R4(config)#int fa0/0

  R4(config-if)#ip address 24.1.1.4 255.255.255.0

  R4(config-if)#no shutdown

  R4(config-if)#exit

  R4(config)#int fa1/0

  R4(config-if)#ip address 123.1.1.4 255.255.255.0

  R4(config-if)#no shutdown

  R4(config-if)#exit

  R4(config)#ip route 5.5.5.0 255.255.255.0 123.1.1.5

  R5上

  R5>en

  R5#conf t

  R5(config)#int fa0/0

  R5(config-if)#ip address 123.1.1.5 255.255.255.0

  R5(config-if)#no shutdown

  R5(config-if)#exit

  R5(config)#int loopback 0

  R5(config-if)#ip address 5.5.5.5 255.255.255.0

  R5(config-if)#no shutdown

  R5(config-if)#exit

  R5(config)#ip route 0.0.0.0 0.0.0.0 fa0/0

  加sla版本的R2配置:

  R2>en

  R2#conf t

  R2(config)#int fa0/0

  R2(config-if)#ip address 12.1.1.1 255.255.255.0

  R2(config-if)#ip nat inside

  R2(config-if)#no shutdown

  R2(config-if)#exit

  R2(config)#int fa1/0

  R2(config-if)#ip address 23.1.1.2 255.255.255.0

  R2(config-if)#ip nat outside

  R2(config-if)#no shutdown

  R2(config-if)#exit

  R2(config)#int fa2/0

  R2(config-if)#ip address 24.1.1.2 255.255.255.0

  R2(config-if)#ip nat outside

  R2(config-if)#no shutdown

  R2(config-if)#exit

  R2(config)#access-list 1 permit 12.1.1.0 0.0.0.255

  R2(config)#route-map aaa permit 10

  R2(config-route-map)#match ip addressress 1

  R2(config-route-map)#match interface FastEthernet1/0

  R2(config-route-map)#exit

  R2(config)#route-map bbb permit 10

  R2(config-route-map)#match ip addressress 1

  R2(config-route-map)#match interface FastEthernet2/0

  R2(config-route-map)#exit

  R2(config)#ip nat inside source route-map aaa interface Fa1/0

  R2(config)#ip nat inside source route-map bbb interface Fa2/0

  R2(config)#ip sla monitor 1

  R2(config-sla-monitor)#type echo protocol ipIcmpEcho 23.1.1.3 source-interface fa1/0

  R2(config-sla-monitor-echo)#timeout 3000

  R2(config-sla-monitor-echo)#frequency 3

  R2(config-sla-monitor-echo)#exit

  R2(config)#ip sla monitor schedule 1 life forever start-time now

  R2(config)#ip sla monitor 2

  R2(config-sla-monitor)#type echo protocol ipIcmpEcho 24.1.1.4 source-interface fa2/0

  R2(config-sla-monitor-echo)#timeout 3000

  R2(config-sla-monitor-echo)#frequency 3

  R2(config-sla-monitor-echo)#exit

  R2(config)#ip sla monitor schedule 2 life forever start-time now

  R2(config)#track 1 rtr 1(acl的1) reachability

  R2(config)#track 2 rtr 1(acl的1)reachability

  R2(config)#ip route 0.0.0.0 0.0.0.0 23.1.1.3或(ip route 5.5.5.0 255.255.255.0 24.1.1.4 100)

  R2(config)#ip route 0.0.0.0 0.0.0.0 24.1.1.4或(ip route 123.1.1.5 255.255.255.255 23.1.1.3 100)

  R2(config)#ip route 5.5.5.0 255.255.255.0 23.1.1.3 track 1

  R2(config)#ip route 123.1.1.5 255.255.255.255 24.1.1.4 track 2

本文出自 “me” 博客,请务必保留此出处http://aaaao.blog.51cto.com/4824967/961838