要求:

如下图所示,R1有两条路径可以到达192.168.1.0/24网段,其中R2之间通过RIP学习到了192.168.1.0/24的路由,另外和R3之间,由于某些原因无法通过动态路由协议学习到路由,只能通过静态路由的方式。

现在希望达到这样的一种冗余效果:

1.R1的两条路径通过浮动路由来进行冗余备份;

2.R1R2之间的链路作为主链路,.R1R3之间的链路作为备份链路;

 

实验过程:

1.       R1的配置

Router>en

Router#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line con 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host R1

R1(config)#int s0/0

R1(config-if)#no shut

R1(config-if)#ip add 172.16.1.10 255.255.255.0

R1(config-if)#int s0/1

R1(config-if)#no shut

R1(config-if)#ip add 172.16.2.10 255.255.255.0

R1(config-if)#exit

R1(config)#router rip

R1(config-router)#version 2

R1(config-router)#no auto

R1(config-router)#net 172.16.1.0

R1(config-router)#exit

 

2.       R2的配置

Router>en

Router#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line con 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host R2

R2(config)#int s0/0

R2(config-if)#no shut

R2(config-if)#ip add 172.16.1.1 255.255.255.0

R2(config-if)#int e1/0

R2(config-if)#no shut

R2(config-if)#ip add 192.168.1.1 255.255.255.0

R2(config-if)#exit

R2(config)#router rip

R2(config-router)#version 2

R2(config-router)#no auto

R2(config-router)#net 172.16.1.0

R2(config-router)#net 192.168.1.0

R2(config-router)#end

3.       R3的配置

Router#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line con 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host R3

R3(config)#int s0/1

R3(config-if)#no shut

R3(config-if)#ip add 172.16.2.1 255.255.255.0

R3(config-if)#int e1/0

R3(config-if)#no shut

R3(config-if)#ip add 192.168.1.2 255.255.255.0

R3(config-if)#exit

4.       R4(模拟192.168.1.0/24网段)的配置

Router>en

Router#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line con 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host R4

R4(config)#int e1/0

R4(config-if)#no shut

R4(config-if)#ip add 192.168.1.10 255.255.255.0

R4(config-if)#exit

R4(config)#router rip

R4(config-router)#version 2

R4(config-router)#no auto

R4(config-router)#net 192.168.1.0

R4(config-router)#end

5.       查看R1的路由表

R1#show ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route

 

Gateway of last resort is not set

 

     172.16.0.0/24 is subnetted, 2 subnets

C       172.16.1.0 is directly connected, Serial0/0

C       172.16.2.0 is directly connected, Serial0/1

R    192.168.1.0/24 [120/1] via 172.16.1.1, 00:00:11, Serial0/0  //通过RIP学习到的路由

6.       测试R1R2连通性

R1#ping 192.168.1.10 source 172.16.1.10

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.1.10, timeout is 2 seconds:

Packet sent with a source address of 172.16.1.10

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 12/44/92 ms

R1#traceroute 192.168.1.10 source 172.16.1.10

 

Type escape sequence to abort.

Tracing the route to 192.168.1.10

 

  1 172.16.1.1 32 msec 60 msec 16 msec  //R1R4通信经过R2

  2 192.168.1.10 44 msec *  16 msec

7.       R1上配置静态路由

R1(config)#ip route 192.168.1.0 255.255.255.0 172.16.2.1  

8.       再次测试连通性

R1#ping 192.168.1.10 source 172.16.1.10     

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.1.10, timeout is 2 seconds:

Packet sent with a source address of 172.16.1.10

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 12/41/76 ms

R1#traceroute 192.168.1.10                  

 

Type escape sequence to abort.

Tracing the route to 192.168.1.10

 

  1 172.16.2.1 84 msec 40 msec 8 msec

  2 192.168.1.10 52 msec *  44 msec  //R1R4通信走了R3

9.       查看R1路由表

R1#show ip route                            

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route

 

Gateway of last resort is not set

 

     172.16.0.0/24 is subnetted, 2 subnets

C       172.16.1.0 is directly connected, Serial0/0

C       172.16.2.0 is directly connected, Serial0/1

S    192.168.1.0/24 [1/0] via 172.16.2.1  //路由表里面只有一条静态路由,而没有RIP的路由,这是因为静态路由的ADRIPAD

10.   根据题目要求,R1R2之间的链路作为主链路,.R1R3之间的链路作为备份链路,我们需要给R1配置一条浮动静态路由。

11.   R1上配置一条浮动静态路由

R1(config)#ip route 192.168.1.0 255.255.255.0 172.16.2.1 125  //配置一条静态路由,AD125

R1(config)#end

R1#clear ip route *  //刷新路由表

12.   再次查看R1的路由表

R1#show ip route  

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route

 

Gateway of last resort is not set

 

     172.16.0.0/24 is subnetted, 2 subnets

C       172.16.1.0 is directly connected, Serial0/0

C       172.16.2.0 is directly connected, Serial0/1

R    192.168.1.0/24 [120/1] via 172.16.1.1, 00:00:01, Serial0/0  //RIP学习到的路由又再一次出现在路由表

13.   模拟故障,关闭R2s0/0

R2(config)#int s0/0

R2(config-if)#shut

14.   再次查看R1的路由表

R1#clear ip route *

R1#show ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route

 

Gateway of last resort is not set

 

     172.16.0.0/24 is subnetted, 2 subnets

C       172.16.1.0 is directly connected, Serial0/0

C       172.16.2.0 is directly connected, Serial0/1

S    192.168.1.0/24 [125/0] via 172.16.2.1  //静态路由出现在了路由表中

说明:R1的两条路径通过浮动路由来进行冗余备份