RIP的手动汇总:


实验拓扑图


-----[R1](S0/0)--------(S0/0)[R2](S0/1)-------(S0/0)[R3](S0/1)------(S0/0)[R4]----
lo1:1.1.0.1/24         lo1:2.2.8.2/24       lo1:3.3.16.3/24     lo1:4.4.0.4/24
lo2:1.1.1.1/24         lo2:2.2.9.2/24       lo2:3.3.17.3/24     lo2:4.5.0.4/24
lo3:1.1.2.1/24         lo3:2.2.10.2/24       lo3:3.3.18.3/24     lo3:4.6.0.4/24
lo4:1.1.3.1/24         lo4:2.2.11.2/24       lo:3.3.3.19.3/24     lo4:4.7.0.4/24


实验步骤:
第一步:基本配置
1、基本配置(以R1为例)
R1:
Router>enable
Router#conf t
Router(config)#hostname R1
R1(config)#no ip domain lookup
R1(config)#line console 0
R1(config-line)#logging sy
R1(config-line)#logging synchronous 
R1(config-line)#no exec-timeout 
R1(config-line)#exit
2、配置IP地址
①R1
R1(config)#interface lo1 
R1(config-if)#ip address 1.1.0.0 255.255.255.0
R1(config-if)#interface lo2
R1(config-if)#ip address 1.1.1.0 255.255.255.0
R1(config-if)#interface lo3 
R1(config-if)#ip address 1.1.2.0 255.255.255.0
R1(config-if)#interface lo4
R1(config-if)#ip address 1.1.3.0 255.255.255.0
R1(config-if)#interface s0/0
R1(config-if)#ip address 12.12.12.1 255.255.255.0
R1(config-if)#no shut
②R2
R2(config)#interface lo1
R2(config-if)#ip address 2.2.8.2 255.255.255.0
R2(config-if)#interface lo2
R2(config-if)#ip address 2.2.9.2 255.255.255.0
R2(config-if)#interface lo3
R2(config-if)#ip address 2.2.10.2 255.255.255.0
R2(config-if)#interface lo4
R2(config-if)#ip address 2.2.11.2 255.255.255.0
R2(config-if)#interface s0/0    
R2(config-if)#ip address 12.12.12.2 255.255.255.0
R2(config-if)#no shutdown
R2(config)#interface s0/1
R2(config-if)#ip address 23.23.23.2 255.255.255.0
R2(config-if)#no shut
③R3
R3(config)#interface lo1
R3(config-if)#ip address 3.3.16.3 255.255.255.0
R3(config-if)#interface lo2
R3(config-if)#ip address 3.3.17.3 255.255.255.0
R3(config-if)#interface lo3
R3(config-if)#ip address 3.3.18.3 255.255.255.0
R3(config-if)#interface lo4
R3(config-if)#ip address 3.3.19.3 255.255.255.0
R3(config)#interface s0/0
R3(config-if)#ip address 23.23.23.3 255.255.255.0
R3(config-if)#no shut
R3(config-if)#interface s0/1    
R3(config-if)#ip address 34.34.34.3 255.255.255.0
R3(config-if)#no shut
④R4
R4(config)#interface lo1
R4(config-if)#ip address 4.4.0.4 255.255.255.0
R4(config-if)#interface lo2
R4(config-if)#ip address 4.5.0.4 255.255.255.0
R4(config-if)#interface lo3
R4(config-if)#ip address 4.6.0.4 255.255.255.0
R4(config-if)#interface lo4
R4(config-if)#ip address 4.7.0.4 255.255.255.0
R4(config-if)#interface s0/0
R4(config-if)#ip address 34.34.34.4 255.255.255.0
R4(config-if)#no shut

第二步:配置RIP2
1、具体配置
R1:
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#no auto-summary
R1(config-router)#network 1.0.0.0
R1(config-router)#network 12.0.0.0
R2:
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-su
R2(config-router)#no auto-summary 
R2(config-router)#network 2.0.0.0
R2(config-router)#network 12.0.0.0
R2(config-router)#network 23.0.0.0
R3:
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#network 3.0.0.0
R3(config-router)#network 23.0.0.0
R3(config-router)#network 34.0.0.0
R4:
R4(config)#router rip
R4(config-router)#version 2
R4(config-router)#no auto-summary 
R4(config-router)#network 4.0.0.0
R4(config-router)#network 34.0.0.0
2、配置完成以后查看路由表会发现里面有各个网段(包括很多子网)在内的很多路由条目,通过手动汇总来简化路由条目

第三步:路由汇总
1、注意事项
    先将每个路由器上的回环地址进行手动汇总,然后在每个路由器的出口公布手动汇总的地址
2、手动汇总
①怎样进行手动汇总(以R2为例)
2.2.8.2/24------------>00000010  00000010  000010 |00 00000000
2.2.9.2/24------------>00000010  00000010  000010 |01 00000000
2.2.10.2/24----------->00000010  00000010  000010 |10 00000000
2.2.11.2/24----------->00000010  00000010  000010 |11 00000000

从上面可以看出变化的位数,是从第三个数的倒数第二个二进数开始的,所以可知经过汇总以后的地址是
2.2.8.0/22------------->00000010  00000010  000010 00 00000000  /22


②汇总结果
R1:1.1.0.0/22 255.255.252.0
R2:2.2.8.0/22 255.255.252.0
R2:3.3.16.0/22 255.255.252.0
R4:4.4.0.0/14 255.252.0.0

3、具体配置
R1:
R1(config)#interface s0/0
R1(config-if)#ip summary-address rip 1.1.0.0 255.255.252.0
R2:
R2(config)#interface s0/0
R2(config-if)#ip summary-address rip 2.2.8.0 255.255.252.0
R2(config-if)#interface s0/1
R2(config-if)#ip summary-address rip 2.2.8.0 255.255.252.0
R3:
R3(config)#interface s0/0
R3(config-if)#ip summary-address rip 3.3.16.0 255.255.252.0
R3(config-if)#interface s0/1
R3(config-if)#ip summary-address rip 3.3.16.0 255.255.252.0
R4:
R4(config)#interface s0/0
R4(config-if)#ip summary-address rip 4.4.0.0 255.252.0.0

4、现在再次查看路由表的时候会发现,现在路由表里面的条目已经少了很多,现在的路由条目都是手动汇总以后的IP地址!

5、为了可以验证拓扑结构变化所产生的影响,我们可以将R1上的回环地址关掉几个,然后再到查看本地路由条目和其他路由器的路由条目!
影响:我们会发现当我们关掉R1上的回环接口的时候,查看本地路由的时候,在直连条目里面少了这一条关闭的路由条目,而对其他路由器是没有影响的(还是原有的路由条目---手动汇总后的地址),但是如果我们关掉了R1上所有回环接口,就会发现在其他路由器上,与R1回环接口的相关的路由条目也会消失!

第四步:RIP2的验证功能
1、
2、具体配置
R1:
R1(config)#key chain aaa
R1(config-keychain)#key 1
R1(config-keychain-key)#key-string  cisco
R1(config-keychain-key)#interface s0/0     
R1(config-if)#ip rip authentication key-chain aaa
R1(config-if)#ip rip authentication mode md5

R2:
R2(config)#key chain bbb
R2(config-keychain)#key 1
R2(config-keychain-key)#key-string cisco
R2(config-keychain-key)#interface s0/0
R2(config-if)#ip rip authentication key-chain bbb
R2(config-if)#ip rip authentication mode md5


╪────◆◇"
                    cp