Cisco路由协议RIP v2 (一)

                                               Cisco路由协议RIP v2 (一)

这个没重复啊、我弄过的那个是RIP Version1、这是RIP Version2,写成一篇文章的话太长、就分开写了。

 

*注:本文章是用来供广大网友学习的、里面有些会提到一些网络专业用语、或者英文缩写。网络初学者如果看不懂的我们可以共同学习,共同探讨、有同学有看不懂的地方可以加本人QQ或者YY来探讨。(QQ:914560310、YY:283755973)“//”后不是命令输出、是说明。

 


*在这里纠正下在“RIP v1(一)”中说的一个问题、


Cisco路由协议RIP v2 (一)

那次说到RIP v1跟RIP v2的区别时说的RIP v2的组播地址是222.0.0.9在这里纠正下
其实应该是224.0.0.9、在写这个RIP v2的时候我看了下、可能是一紧张写错了、呵呵、希望大家见谅、别记错了哈、

 

在这里再简单介绍写RIP v2:

 

-发送路由更新时携带子网掩码,属于无类路由协议

-发送路由更新时,目标地址为组播地址:224.0.0.9

-支持VLSM(可变长子网掩码)和CIDR(无类别域间路由选择)

 

*我们利用一个小实验来进行更好的学习RIP v2(基本配置):

Cisco路由协议RIP v2 (一)

首先我们先把IP跟loopback口配置好、然后我们进入实验:

 

R1(config)#router rip                                                      //启动RIP路由协议。

R1(config-router)#version 2                                            //启动RIP 版本2。

R1(config-router)#no auto-summary                               //关闭手动汇总(默认是开启的)。

R1(config-router)#network 1.0.0.0

R1(config-router)#network 192.168.12.0

R1(config-router)#

 

这里是拿R1来举例、把其他路由器也按照这种方式配置、R4上的loopback口通告RIP协议的时候这样通告(network 4.0.0.0)然后进行实验调试。

 

R1#show ip route                                      //查看路由表。

Codes: C – connected, S – static, I – IGRP, 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, E – EGP

       i – IS-IS, 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

 

     1.0.0.0/24 is subnetted, 1 subnets

C       1.1.1.0 is directly connected, Loopback0

     4.0.0.0/24 is subnetted, 1 subnets


R       4.4.4.0 [120/3] via 192.168.12.2, 00:00:01, Serial0/3/0

C    192.168.12.0/24 is directly connected, Serial0/3/0


R    192.168.23.0/24 [120/1] via 192.168.12.2, 00:00:01, Serial0/3/0


R    192.168.34.0/24 [120/2] via 192.168.12.2, 00:00:01, Serial0/3/0

R1#

 

通过:
R       4.4.4.0 [120/3] via 192.168.12.2, 00:00:01, Serial0/3/0

 

可以看出RIP Version2 在通告网络时是携带子网信息的、

——————————————————————————————————————

R1#show ip protocols

Routing Protocol is “rip”

Sending updates every 30 seconds, next due in 18 seconds

Invalid after 180 seconds, hold down 180, flushed after 240

Outgoing update filter list for all interfaces is not set

Incoming update filter list for all interfaces is not set

Redistributing: rip

Default version control: send version 2, receive 2          


//RIPv2
在默认情况下只接收和发送版本2
的路由更新。

*可以通过命令”ip rip send version”和”ip rip receive version”来控制在路由器接口上接收和发送的版本。例如,在s0/3/0接口上接收版本1和版本2的路由更新,但是只发送版本2的路由更新,配置如下


//R1(config)#interface s0/3/0


R1(config-if)#ip rip send version 2


R1(config-if)#ip rip receive version 1 2    //

 

  Interface             Send  Recv  Triggered RIP  Key-chain

  Loopback0             2     2    

  Serial0/3/0           2     2    

Automatic network summarization is not in effect

Maximum path: 4

Routing for Networks:

       1.0.0.0

       192.168.12.0

Passive Interface(s):

Routing Information Sources:

       Gateway         Distance      Last Update

       192.168.12.2         120      00:00:16

Distance: (default is 120)

R1#

————————————————————————————————————

*下面我们说RIPv2手工汇总:

Cisco路由协议RIP v2 (一)

R1、R2、R3的配置跟上面的实验一样、这次我们主要利用R4来说手工汇总。R4配置如下:

*(由于在Cisco Packet 软件中手工汇总这个东西有些命令不能在中实现、所以本次实验我采用的是”小凡模拟器2.83”其实没什么差别、端口上可能会看着有点不一样、这是写的s0/3/0小凡上的是s0/0这个问题不用纠结、呵呵模块的问题、在这提醒下大家、)

 

R4#configure terminal

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

R4(config)#router rip

R4(config-router)#version 2

R4(config-router)#no auto-summary

R4(config-router)#network 192.168.34.0

R4(config-router)#network 4.0.0.0             //通告所有的loopback口

R4(config-router)#exit

 

这一步的时候我们没有进行手工汇总、然后我们进入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

 

C    192.168.12.0/24 is directly connected, Serial0/0

     1.0.0.0/24 is subnetted, 1 subnets

C       1.1.1.0 is directly connected, Loopback0

     4.0.0.0/24 is subnetted, 4 subnets


R       4.4.0.0 [120/3] via 192.168.12.2, 00:00:18, Serial0/0


R       4.4.1.0 [120/3] via 192.168.12.2, 00:00:18, Serial0/0


R       4.4.2.0 [120/3] via 192.168.12.2, 00:00:18, Serial0/0


R       4.4.3.0 [120/3] via 192.168.12.2, 00:00:18, Serial0/0

R    192.168.23.0/24 [120/1] via 192.168.12.2, 00:00:18, Serial0/0

R    192.168.34.0/24 [120/2] via 192.168.12.2, 00:00:18, Serial0/0

R1#

 

这个时候R4上的4个loopback口是都出现在了路由表中、然后我们做下路由汇总在看路由表的状态、

 

R4(config)#interface s0/0

R4(config-if)#ip summary-address rip 4.4.0.0 255.255.252.0    //手工汇总。

R4(config-if)#

 


*(
如果想取消路由汇总的话就在命令前加上”no”
例:no ip summary-address rip 4.4.0.0 255.255.252.0
同样,如果在配置中我们想取消哪个命令重新配置的话就在命令前加no
就行)

 

然后我们查看下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

 

C    192.168.12.0/24 is directly connected, Serial0/0

     1.0.0.0/24 is subnetted, 1 subnets

C       1.1.1.0 is directly connected, Loopback0

     4.0.0.0/22 is subnetted, 1 subnets


R       4.4.0.0 [120/3] via 192.168.12.2, 00:00:08, Serial0/0

R    192.168.23.0/24 [120/1] via 192.168.12.2, 00:00:08, Serial0/0

R    192.168.34.0/24 [120/2] via 192.168.12.2, 00:00:08, Serial0/0

R1#

以上输出表明R1收到了路由汇总、同样R2、R3也会收到。

——————————————————————————————————————

 

**现在将路由器R4上4个环回接口Lo0~LO3的地址分别修改为192.168.96.4/24,192.168.97.4/24,192.168.98.4/24和192.168.99.4/24,在s0/0/0接口下还能够实现路由汇总吗?

其实是不能的、

 

我配置下证实下R4的配置如下:

R4#config terminal

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

R4(config)#router rip

R4(config-router)#version 2

R4(config-router)#no auto-summary

R4(config-router)#net 192.168.96.0                          //通告loopback口

R4(config-router)#net 192.168.97.0

R4(config-router)#net 192.168.98.0

R4(config-router)#net 192.168.99.0

R4(config-router)#exit

R4(config)#inter s0/0

R4(config-if)#ip summary-address rip 192.168.96.0 255.255.252.0

 
Summary mask must be greater or equal to major net

R4(config-if)#

以上输出路由器提示是汇总失败:“
Summary mask must be greater or equal to major net

”这句显示的提示信息表明汇总后的掩码升序必须要大于或等主类网络的掩码长度,因为”22<24”,所以不能汇总。


*
所以,RIPv2
不支持CIDR
汇总,但是可以传递CIDR
汇总。

解决方案如下:


R4(config)#ip route 192.168.96.0 255.255.252.0 null 0   //用静态路由发布被汇总的路由“0”的一个名字、如果再有需要的话就可以写1、2、3、之类的。

R4(config)#router rip

R4(config-router)#version 2


R4(config-router)#redistribute static                           //将静态路由重分布到RIP网络中

R4(config-router)#no net 192.168.96.0                      //取消loopback口的网络通告。

R4(config-router)#no net 192.168.97.0

R4(config-router)#no net 192.168.98.0

R4(config-router)#no net 192.168.99.0

R4(config-router)#

 

然后我们去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

 

C    192.168.12.0/24 is directly connected, Serial0/0

     1.0.0.0/24 is subnetted, 1 subnets

C       1.1.1.0 is directly connected, Loopback0

R    192.168.23.0/24 [120/1] via 192.168.12.2, 00:00:00, Serial0/0

R    192.168.34.0/24 [120/2] via 192.168.12.2, 00:00:00, Serial0/0


R    192.168.96.0/22 [120/3] via 192.168.12.2, 00:00:00, Serial0/0

R1#

通过这个实验的以上输出表示RIP Version2是可以传递CIDR汇总信息的。

           新的一年
2013.祝福各位网络读者能有新的收获。让自己的计算机水平更上一层楼~

                                                                                                                  在这里祝福大家新年快乐~

                                                                                                                                              红黑联盟Up~

(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)

未经允许不得转载:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权!路由网 » Cisco路由协议RIP v2 (一)