rip配置之不连续子网问题:
 
实验拓扑图:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
实验目的:
(1):解决不连续子网的问题
(2):路由表汇总问题
 
(1):解决不连续子网的问题
r2的基本信息配置:
Router>en
Router#conf t
Router(config)#enable secret abc
Router(config)#line console 0
Router(config-line)#password abc
Router(config-line)#login
Router(config-line)#logging synchronous
Router(config-line)#exec-timeout 0 0
Router(config-line)#exi
Router(config)#no ip domain lookup
Router(config)#hostname r2
 
r2(config)#in s1/0
r2(config-if)#ip add 219.146.2.1 255.255.255.0
r2(config-if)#no shut
r2(config-if)#in loo 0         //环回接口(不需要激活接口)
r2(config-if)#ip add 172.16.0.1 255.255.255.0
r2(config-if)#in loo 1
r2(config-if)#ip add 172.16.1.1 255.255.255.0
r2(config-if)#in loo 2
r2(config-if)#ip add 172.16.2.1 255.255.255.0
r2(config-if)#in loo 3
r2(config-if)#ip add 172.16.3.1 255.255.255.0
r2(config-if)#exi
 
r2(config)#router rip            //配置rip协议
r2(config-router)#version 2      //rip版本2
r2(config-router)#network 219.146.2.0    //添加直连网络
r2(config-router)#network 172.16.0.0
r2(config-router)#network 172.16.1.0
r2(config-router)#network 172.16.2.0
r2(config-router)#network 172.16.3.0
r2(config-router)#exi
 

r3的基本信息配置:
Router>en
Router#conf t
Router(config)#enable secret abc
Router(config)#line console 0
Router(config-line)#password abc
Router(config-line)#login
Router(config-line)#logging synchronous
Router(config-line)#exec-timeout 0 0
Router(config-line)#exi
Router(config)#no ip domain lookup
Router(config)#hostname r3
 
r3(config)#in s1/1
r3(config-if)#ip add 219.146.2.2 255.255.255.0
r3(config-if)#no shut
r3(config-if)#in s1/2
r3(config-if)#ip add 219.146.3.1 255.255.255.0
r3(config-if)#no shut
r3(config-if)#exi
 
r3(config)#router rip
r3(config-router)#version 2
r3(config-router)#network 219.146.2.0
r3(config-router)#network 219.146.3.0
r3(config-router)#exi
 
 
 

r4的基本信息配置:
Router>en
Router#conf t
Router(config)#enable secret abc
Router(config)#line console 0
Router(config-line)#password abc
Router(config-line)#login
Router(config-line)#logging synchronous
Router(config-line)#exec-timeout 0 0
Router(config-line)#exi
Router(config)#no ip domain lookup
Router(config)#hostname r4
 
r4(config)#in s1/0
r4(config-if)#ip add 219.146.3.2 255.255.255.0
r4(config-if)#no shut
r4(config-if)#in loo 0
r4(config-if)#ip add 172.16.4.1 255.255.255.0
r4(config-if)#in loo 1
r4(config-if)#ip add 172.16.5.1 255.255.255.0
r4(config-if)#exi
 
r4(config)#router rip
r4(config-router)#version 2
r4(config-router)#network 219.146.3.0
r4(config-router)#network 172.16.4.0
r4(config-router)#network 172.16.5.0
r4(config-router)#exi
 
 
rip协议已经配置完成,查看一下r3的路由表:
 
r3(config)#do 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
C    219.146.2.0/24 is directly connected, Serial1/1
C    219.146.3.0/24 is directly connected, Serial1/2
R    172.16.0.0/16 [120/1] via 219.146.3.2, 00:00:00, Serial1/2
                   [120/1] via 219.146.2.1, 00:00:03, Serial1/1
 
看到到达172.16.0.0网络有两条路由表,结合上图,可以知道已经出错。

r3(config)#do p 172.16.0.1   //测试一下
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.0.1, timeout is 2 seconds:
!U!.!
Success rate is 60 percent (3/5), round-trip min/avg/max = 32/66/92 ms
 
通或不通就是负载均衡引起的
 
r3(config)#do p 172.16.4.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.4.1, timeout is 2 seconds:
U!.!U
Success rate is 40 percent (2/5), round-trip min/avg/max = 104/112/120 ms

解决问题:
r2(config)#router rip
r2(config-router)#no auto-summary    //禁用自动汇总
r2(config-router)#exi
r4(config)#router rip
r4(config-router)#no auto-summary
r4(config-router)#exi

再查看一次r3的路由表:
r3(config)#do 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
C    219.146.2.0/24 is directly connected, Serial1/1
C    219.146.3.0/24 is directly connected, Serial1/2
     172.16.0.0/16 is variably subnetted, 7 subnets, 2 masks
R       172.16.4.0/24 [120/1] via 219.146.3.2, 00:00:09, Serial1/2
R       172.16.5.0/24 [120/1] via 219.146.3.2, 00:00:09, Serial1/2
R       172.16.0.0/24 [120/1] via 219.146.2.1, 00:00:01, Serial1/1
R       172.16.0.0/16 [120/1] via 219.146.3.2, 00:00:37, Serial1/2
                      [120/1] via 219.146.2.1, 00:00:54, Serial1/1
R       172.16.1.0/24 [120/1] via 219.146.2.1, 00:00:01, Serial1/1
R       172.16.2.0/24 [120/1] via 219.146.2.1, 00:00:01, Serial1/1
R       172.16.3.0/24 [120/1] via 219.146.2.1, 00:00:01, Serial1/1
 
发现刚才那条路由表还在,那是因为刷新定时器还没到期(240秒),还学到了一些明细路由。
r3(config)#end
r3#clear ip route *       //重新学习路由
r3#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
C    219.146.2.0/24 is directly connected, Serial1/1
C    219.146.3.0/24 is directly connected, Serial1/2
     172.16.0.0/24 is subnetted, 6 subnets
R       172.16.4.0 [120/1] via 219.146.3.2, 00:00:04, Serial1/2
R       172.16.5.0 [120/1] via 219.146.3.2, 00:00:04, Serial1/2
R       172.16.0.0 [120/1] via 219.146.2.1, 00:00:01, Serial1/1
R       172.16.1.0 [120/1] via 219.146.2.1, 00:00:01, Serial1/1
R       172.16.2.0 [120/1] via 219.146.2.1, 00:00:01, Serial1/1
R       172.16.3.0 [120/1] via 219.146.2.1, 00:00:01, Serial1/1
已经没有那条路由表了.
 
 
 

(2):路由表汇总问题
          在上面路由表虽然已经没有问题,但路由表很大,这对于30秒更新一次的rip来说,带宽的占用很大,所以要尽量缩小路由表,来优化网络性能。
 
r2(config)#in s1/0    //进接口
r2(config-if)#ip summary-address rip 172.16.0.0 255.255.252.0   //把路由表汇总再发送
r2(config-if)#exi
 
查看r3的路由表:
r3#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
C    219.146.2.0/24 is directly connected, Serial1/1
C    219.146.3.0/24 is directly connected, Serial1/2
     172.16.0.0/16 is variably subnetted, 7 subnets, 2 masks
R       172.16.4.0/24 [120/1] via 219.146.3.2, 00:00:13, Serial1/2
R       172.16.5.0/24 [120/1] via 219.146.3.2, 00:00:13, Serial1/2
R       172.16.0.0/24 [120/1] via 219.146.2.1, 00:00:11, Serial1/1
R       172.16.0.0/22 [120/1] via 219.146.2.1, 00:00:04, Serial1/1
R       172.16.1.0/24 [120/1] via 219.146.2.1, 00:00:11, Serial1/1
R       172.16.2.0/24 [120/1] via 219.146.2.1, 00:00:11, Serial1/1
R       172.16.3.0/24 [120/1] via 219.146.2.1, 00:00:11, Serial1/1
 
已经有了一条汇总路由,由于刷新定时器的原因其他明细路由还在。
r3#clear ip route *    //重新学习路由表
r3#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
C    219.146.2.0/24 is directly connected, Serial1/1
C    219.146.3.0/24 is directly connected, Serial1/2
     172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
R       172.16.4.0/24 [120/1] via 219.146.3.2, 00:00:04, Serial1/2
R       172.16.5.0/24 [120/1] via 219.146.3.2, 00:00:04, Serial1/2
R       172.16.0.0/22 [120/1] via 219.146.2.1, 00:00:04, Serial1/1
 
发现路由表已经汇总了,目标实现。
 
 
r4(config)#in s1/0
r4(config-if)#ip summary-address rip 172.16.4.0 255.255.254.0 
r4(config-if)#exi
 
同样在r4上做同样的操作。
 
 
r3#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
C    219.146.2.0/24 is directly connected, Serial1/1
C    219.146.3.0/24 is directly connected, Serial1/2
     172.16.0.0/16 is variably subnetted, 4 subnets, 3 masks
R       172.16.4.0/24 [120/1] via 219.146.3.2, 00:00:52, Serial1/2
R       172.16.4.0/23 [120/1] via 219.146.3.2, 00:00:25, Serial1/2
R       172.16.5.0/24 [120/1] via 219.146.3.2, 00:00:52, Serial1/2
R       172.16.0.0/22 [120/1] via 219.146.2.1, 00:00:24, Serial1/1
r3#clear ip route *
r3#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
C    219.146.2.0/24 is directly connected, Serial1/1
C    219.146.3.0/24 is directly connected, Serial1/2
     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
R       172.16.4.0/23 [120/1] via 219.146.3.2, 00:00:04, Serial1/2
R       172.16.0.0/22 [120/1] via 219.146.2.1, 00:00:04, Serial1/1
 
现在的路由表已经汇总完成了,这样对网络的性能有了很好的优化。而且对cpu和ram的占用也少了,还有可以防止路由表的抖动。