您好,欢迎来到华佗小知识。
搜索
您的当前位置:首页RIP实验

RIP实验

来源:华佗小知识
RIP实验

By安磊

步骤一:如图,给每个路由器配置IP地址R1(config)#intlo0

R1(config-if)#ipadd172.16.1.1255.255.255.0R1(config-if)#exitR1(config)#intlo1

R1(config-if)#ipadd1.1.1.1255.255.255.0R1(config-if)#exit

R1#showcontrollerss0/0/0

//检查串行接口S0/0/0是DCE还是DTEInterfaceSerial0/0/0

HardwareisPowerQUICCMPC860DCEV.35,noclock

//得出接口S0/0/0是DCE,所以我们要给S0/0/0接口配置时钟频率…………

R1#configuret

R1(config)#ints0/0/0

R1(config-if)#clockrate000//配置了时钟频率

R1(config-if)#ipadd172.16.2.1255.255.255.0R1(config-if)#nosh

%LINK-5-CHANGED:InterfaceSerial0/0/0,changedstatetodownR1(config-if)#exit

R2#showcontrollerss0/0/0InterfaceSerial0/0/0

HardwareisPowerQUICCMPC860DTEV.35TXandRXclocksdetectedR2#showcontrollerss0/0/1InterfaceSerial0/0/1

HardwareisPowerQUICCMPC860DCEV.35,noclock

R2#configure

Configuringfromterminal,memory,ornetwork[terminal]?

Enterconfigurationcommands,oneperline.EndwithCNTL/Z.R2(config)#ints0/0/1

R2(config-if)#clockrate000

R2(config-if)#ipadd172.16.3.1255.255.255.0R2(config-if)#noshR2(config-if)#exit

R2(config)#ints0/0/0

R2(config-if)#ipadd172.16.2.2255.255.255.0R2(config-if)#noshR2(config-if)#exit

R2(config)#intf0/0

R2(config-if)#ipadd192.168.3.1255.255.255.0R2(config-if)#noshR2(config-if)#exit

测试R2与R1之间的连通性

R2#ping172.16.2.1(R1的S0/0/0接口IP地址)

Typeescapesequencetoabort.

Sending5,100-byteICMPEchosto172.16.2.1,timeoutis2seconds:!!!!!

Successrateis100percent(5/5),round-tripmin/avg/max=20/32/80ms

注意:在配置完两个相邻的路由器之后,来测试他们之间的连通性是好的习惯,若连通性

没问题,则说明相邻路由器之间的直连网络是完好的

R3#showcontrollerss0/0/0InterfaceSerial0/0/0

HardwareisPowerQUICCMPC860DTEV.35TXandRXclocksdetectedR3(config)#ints0/0/0

R3(config-if)#ipadd172.16.3.2255.255.255.0R3(config-if)#noshR3(config-if)#exitR3(config)#intlo0

R3(config-if)#ipadd172.16.4.1255.255.255.0R3(config-if)#exit

测试R3与R2之间的连通性:

R3#ping172.16.3.1(R2的S0/0/1接口IP地址)

Typeescapesequencetoabort.

Sending5,100-byteICMPEchosto172.16.3.1,timeoutis2seconds:!!!!!

Successrateis100percent(5/5),round-tripmin/avg/max=20/22/30ms注意:R2和R3之间的连通性完好

R4(config)#intf0/0

R4(config-if)#ipadd192.168.3.2255.255.255.0R4(config-if)#noshR4(config-if)#exitR4(config)#intlo0

R4(config-if)#ipadd10.1.1.1255.255.255.0R4(config-if)#exitR4(config)#intlo1

R4(config-if)#ipadd1.1.2.1255.255.255.0R4(config-if)#exit

测试R4与R2之间的连通性:

R4#ping192.168.3.1(R2的F0/0接口的IP地址)

Typeescapesequencetoabort.

Sending5,100-byteICMPEchosto192.168.3.1,timeoutis2seconds:!!!!!

Successrateis100percent(5/5),round-tripmin/avg/max=9/19/30ms注意:R2和R4之间的连通性完好步骤二:配置RIP协议(重点)R1(config)#routerrip

R1(config-router)#net172.16.0.0R1(config-router)#net1.0.0.0R1(config-router)#exit

R2(config)#routerrip

R2(config-router)#net172.16.0.0R2(config-router)#net192.168.3.0R2(config-router)#exit

R3(config)#routerrip

R3(config-router)#net172.16.0.0R3(config-router)#exit

R4(config)#routerrip

R4(config-router)#net1.0.0.0

R4(config-router)#net192.168.3.0R4(config-router)#net10.0.0.0R4(config-router)#exit

注意:

1、RIP协议的配置分为两个步骤

a、在全局配置模式下,开启RIP协议,即routerrip

b、在RIP进程下,把路由器直连网络的主网号宣告到RIP进程中,即network2、在宣告网络到RIP进程中时只宣告主类网络,例如在R4上有这样几个IP地址,

192.168.3.2,1.1.2.1,10.1.1.1,在把这些地址宣告到RIP进程中,只需这样net192.168.3.0net1.0.0.0net10.0.0.0步骤三:查看路由器R1的路由表R1#showiproute

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

D-EIGRP,EX-EIGRPexternal,O-OSPF,IA-OSPFinterareaN1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2E1-OSPFexternaltype1,E2-OSPFexternaltype2,E-EGP

i-IS-IS,L1-IS-ISlevel-1,L2-IS-ISlevel-2,ia-IS-ISinterarea*-candidatedefault,U-per-userstaticroute,o-ODRP-periodicdownloadedstaticroute

Gatewayoflastresortisnotset

1.0.0.0/24issubnetted,1subnets

1.1.1.0isdirectlyconnected,Loopback1

10.0.0.0/8[120/2]via172.16.2.2,00:00:28,Serial0/0/0172.16.0.0/24issubnetted,4subnets

172.16.1.0isdirectlyconnected,Loopback0172.16.2.0isdirectlyconnected,Serial0/0/0

172.16.3.0[120/1]via172.16.2.2,00:00:28,Serial0/0/0172.16.4.0[120/2]via172.16.2.2,00:00:28,Serial0/0/0192.168.3.0/24[120/1]via172.16.2.2,00:00:28,Serial0/0/0

CRCCRRR

注意:通过观察R1的路由表,我们发现R1已经学习到主要各网络的信息测试R1到各个非直连网段的连通性:R1#ping192.168.3.0

Typeescapesequencetoabort.

Sending5,100-byteICMPEchosto192.168.3.0,timeoutis2seconds:!!!!!

Successrateis100percent(5/5),round-tripmin/avg/max=20/20/22msR1#ping172.16.3.0

Typeescapesequencetoabort.

Sending5,100-byteICMPEchosto172.16.3.0,timeoutis2seconds:!!!!!

Successrateis100percent(5/5),round-tripmin/avg/max=20/22/30msR1#ping172.16.4.1

Typeescapesequencetoabort.

Sending5,100-byteICMPEchosto172.16.4.1,timeoutis2seconds:!!!!!

Successrateis100percent(5/5),round-tripmin/avg/max=30/38/40msR1#ping10.1.1.1

Typeescapesequencetoabort.

Sending5,100-byteICMPEchosto10.1.1.1,timeoutis2seconds:

!!!!!

Successrateis100percent(5/5),round-tripmin/avg/max=40/44/50msR1#ping1.1.2.1

Typeescapesequencetoabort.

Sending5,100-byteICMPEchosto1.1.2.1,timeoutis2seconds:.....

Successrateis0percent(0/5)

注意:R1不能到达1.1.2.1,我们仔细在观察一下R1的路由表R1#showiproute

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

D-EIGRP,EX-EIGRPexternal,O-OSPF,IA-OSPFinterareaN1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2E1-OSPFexternaltype1,E2-OSPFexternaltype2,E-EGPi-IS-IS,L1-IS-ISlevel-1,L2-IS-ISlevel-2,ia-IS-ISinterarea*-candidatedefault,U-per-userstaticroute,o-ODRP-periodicdownloadedstaticrouteGatewayoflastresortisnotset

1.0.0.0/24issubnetted,1subnetsC1.1.1.0isdirectlyconnected,Loopback1R10.0.0.0/8[120/2]via172.16.2.2,00:00:27,Serial0/0/0

172.16.0.0/24issubnetted,4subnetsC172.16.1.0isdirectlyconnected,Loopback0C172.16.2.0isdirectlyconnected,Serial0/0/0R172.16.3.0[120/1]via172.16.2.2,00:00:27,Serial0/0/0R172.16.4.0[120/2]via172.16.2.2,00:00:27,Serial0/0/0R192.168.3.0/24[120/1]via172.16.2.2,00:00:27,Serial0/0/0

注意:我们发现R1的路由表中没有与1.1.2.1对应的路由条目,所以不能信息不能到达1.1.2.1,为什么没有与1.1.2.1对应的路由条目呢,我们稍后再分析

步骤四:认识网络边界路由器

1、所谓网络边界路由器,就是一台路由器连接了不同的主网,如R2连接了主网172.16.0.0和主网192.168.3.0;又如R4也是网络边界路由器,R4连接了主网1.0.0.0和主网192.168.3.0,以及主网10.0.0.0.同理,R1也是网络边界路由器。

2、网络边界路由器的作用:将子网汇总为与其对应的主网,并将其宣告到另一个主网中例如,R2连接了主网172.16.0.0和主网192.168.3.0,R2则会把子网172.16.2.0和子网172.16.3.0汇总成主网172.16.0.0宣告到192.168.3.0网络中,所以在R4的路由表中找不到子网172.16.2.0和子网172.16.3.0的路由信息,只会看到172.16.0.0的路由信息,查看R4路由表

R4#showiproute

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

D-EIGRP,EX-EIGRPexternal,O-OSPF,IA-OSPFinterareaN1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2E1-OSPFexternaltype1,E2-OSPFexternaltype2,E-EGPi-IS-IS,L1-IS-ISlevel-1,L2-IS-ISlevel-2,ia-IS-ISinterarea*-candidatedefault,U-per-userstaticroute,o-ODRP-periodicdownloadedstaticrouteGatewayoflastresortisnotset

1.0.0.0/24issubnetted,1subnets

1.1.2.0isdirectlyconnected,Loopback110.0.0.0/24issubnetted,1subnets

10.1.1.0isdirectlyconnected,Loopback0

172.16.0.0/16[120/1]via192.168.3.1,00:00:23,FastEthernet0/0192.168.3.0/24isdirectlyconnected,FastEthernet0/0

CCRC

同理,R1也会将子网1.1.1.0/24总结为主网1.0.0.0,R4也会将子网1.1.2.0/24总结为主网1.0.0.0,所以我们在R2的路由表中只能看到主网1.0.0.0的路由信息:

R2#showiproute

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

D-EIGRP,EX-EIGRPexternal,O-OSPF,IA-OSPFinterareaN1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2E1-OSPFexternaltype1,E2-OSPFexternaltype2,E-EGPi-IS-IS,L1-IS-ISlevel-1,L2-IS-ISlevel-2,ia-IS-ISinterarea*-candidatedefault,U-per-userstaticroute,o-ODRP-periodicdownloadedstaticrouteGatewayoflastresortisnotsetR

1.0.0.0/8[120/1]via172.16.2.1,00:00:13,Serial0/0/0

[120/1]via192.168.3.2,00:00:12,FastEthernet0/0

注意:此处到达1.0.0.0网络的路径有两条,且度量值相等,我们称这种现象是等价负载均衡,出现这种现象的原因是R1和R4分别总结了子网1.1.1.0/24和1.1.2.0/24,并一起向R2通告了主网1.0.0.0,所以R2就认为到达主网1.0.0.0的路径有两条,一条是R1宣告的,一条是R4宣告的。R10.0.0.0/8[120/1]via192.168.3.2,00:00:12,FastEthernet0/0

172.16.0.0/24issubnetted,4subnetsR172.16.1.0[120/1]via172.16.2.1,00:00:13,Serial0/0/0

CCRC172.16.2.0isdirectlyconnected,Serial0/0/0172.16.3.0isdirectlyconnected,Serial0/0/1

172.16.4.0[120/1]via172.16.3.2,00:00:13,Serial0/0/1192.168.3.0/24isdirectlyconnected,FastEthernet0/0

我们在R2上测试到达网络1.1.1.0/24和1.1.2.0/24的连通性:R2#ping1.1.1.1

Typeescapesequencetoabort.

Sending5,100-byteICMPEchosto1.1.1.1,timeoutis2seconds:!U!.!

Successrateis60percent(3/5),round-tripmin/avg/max=20/30/30msR2#ping1.1.2.1

Typeescapesequencetoabort.

Sending5,100-byteICMPEchosto1.1.2.1,timeoutis2seconds:!U!.!

Successrateis60percent(3/5),round-tripmin/avg/max=20/30/30msR2#ping1.1.1.1

Typeescapesequencetoabort.

Sending5,100-byteICMPEchosto1.1.1.1,timeoutis2seconds:!U!.!

Successrateis60percent(3/5),round-tripmin/avg/max=20/26/20msR2#ping1.1.2.1

Typeescapesequencetoabort.

Sending5,100-byteICMPEchosto1.1.2.1,timeoutis2seconds:!U!.!

Successrateis60percent(3/5),round-tripmin/avg/max=20/33/40ms

注意:我们发现从R2到达目的网络的信息只有50%左右,这是因为等价负载均衡的结果,每条路径负载信息量50%

步骤五:通过实验现象,了解RIP协议的特性在这个步骤中,我们可以了解到RIP的一下特性:

1、使用跳数作为唯一度量2、定期更新,30秒3、广播更新4、水平分隔

5、在更新中不包含子网掩码6、管理距离是120

我们用命令debugiprip来查看RIP的调试信息R2#debugiprip

RIPprotocoldebuggingison

R2#RIP:receivedv1updatefrom172.16.2.1onSerial0/0/0

1.0.0.0in1hops172.16.1.0in1hops//使用跳数作为唯一度量

R2#RIP:receivedv1updatefrom192.168.3.2onFastEthernet0/0

1.0.0.0in1hops10.0.0.0in1hopsR2#RIP:receivedv1updatefrom172.16.3.2onSerial0/0/1

172.16.4.0in1hops

R2#RIP:sendingv1updateto255.255.255.255//广播更新viaFastEthernet0/0(192.168.3.1)

RIP:buildupdateentries

network172.16.0.0metric1

RIP:sendingv1updateto255.255.255.255viaSerial0/0/0(172.16.2.2)RIP:buildupdateentries

network10.0.0.0metric2network172.16.3.0metric1network172.16.4.0metric2network192.168.3.0metric1//更新中路由信息不包含子网掩码

RIP:sendingv1updateto255.255.255.255viaSerial0/0/1(172.16.3.1)RIP:buildupdateentries

network1.0.0.0metric2network10.0.0.0metric2network172.16.1.0metric2network172.16.2.0metric1network192.168.3.0metric1

//由于水平分隔,从S0/0/1接口发出的更新中没有172.16.3.0和172.16.4.0的路由信息R2#RIP:receivedv1updatefrom172.16.2.1onSerial0/0/0

1.0.0.0in1hops172.16.1.0in1hopsR2#RIP:receivedv1updatefrom192.168.3.2onFastEthernet0/0

1.0.0.0in1hops10.0.0.0in1hops

R2#RIP:receivedv1updatefrom172.16.3.2onSerial0/0/1

172.16.4.0in1hops

R2#RIP:sendingv1updateto255.255.255.255viaFastEthernet0/0(192.168.3.1)RIP:buildupdateentries

network172.16.0.0metric1

利用命令showipprotocol可以查看协议的相关内容:R2#showipprotocolsRoutingProtocolis\"rip\"

//定期更新30秒,nextduein16secondsSendingupdatesevery30secondsseconds//

Invalidafter180seconds,holddown180,flushedafter240//抑制计时器和刷新计时器OutgoingupdatefilterlistforallinterfacesisnotsetIncomingupdatefilterlistforallinterfacesisnotsetRedistributing:rip

Defaultversioncontrol:sendversion1,receiveanyversionInterfaceSendRecvTriggeredRIPKey-chainFastEthernet0/0121Serial0/0/0121Serial0/0/1121//本地路由器配置了RIP协议的接口AutomaticnetworksummarizationisineffectMaximumpath:4//支持最多4条负载均衡RoutingforNetworks:

172.16.0.0

//本地路由器宣告的主网络192.168.3.0192.168.3.0/

PassiveInterface(s):

RoutingInformationSources:

GatewayDistanceLastUpdate192.168.3.212000:00:26172.16.2.112000:00:10172.16.3.212000:00:20Distance:(defaultis120)//管理距离120

步骤六:配置被动接口

被动接口的含义就是一个接口只接收路由更新,而不发送路由更新,我们把R3的S0/0/0配置成被动接口,R3(config)#routerrip

R3(config-router)#passive-interfaces0/0/0R3(config-router)#exit

查看R3的调试信息R3#debugiprip

R3#RIP:sendingv1updateto255.255.255.255viaLoopback0(172.16.4.1)RIP:buildupdateentries

network1.0.0.0metric3network10.0.0.0metric3network172.16.1.0metric16network172.16.2.0metric2network172.16.3.0metric1network192.168.3.0metric2R3#RIP:receivedv1updatefrom172.16.3.1onSerial0/0/0

1.0.0.0in2hops10.0.0.0in2hops172.16.1.0in16hops172.16.2.0in1hops192.168.3.0in1hops

R3#RIP:sendingv1updateto255.255.255.255viaLoopback0(172.16.4.1)RIP:buildupdateentries

network1.0.0.0metric3network10.0.0.0metric3network172.16.1.0metric16network172.16.2.0metric2network172.16.3.0metric1network192.168.3.0metric2

注意:我们发现R3的S0/0/0接口只是接收路由更新,不再发送路由更新步骤七:配置默认路由

拓扑变化为上图,添加了R5,R5作为去往的出口,这种情况下应该这样配置R4#showcontrollerss0/0/0InterfaceSerial0/0/0

HardwareisPowerQUICCMPC860DCEV.35,noclock

R4(config)#ints0/0/0

R4(config-if)#clockrate000

R4(config-if)#ipadd192.168.4.1255.255.255.0R4(config-if)#noshR4(config-if)#exit

R4(config)#iproute0.0.0.00.0.0.0s0/0/0R4(config)#exit

R5(config)#ints0/0/0

R5(config-if)#ipadd192.168.4.2255.255.255.0R5(config-if)#noshR5(config-if)#exit

R5(config)#iproute192.168.3.0255.255.255.0s0/0/0R5(config)#exit

在R4上发布默认路由:R4(config)#routerrip

R4(config-router)#default-informationoriginateR4(config-router)#exit

查看R1路由表R1#showiproute

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

D-EIGRP,EX-EIGRPexternal,O-OSPF,IA-OSPFinterareaN1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2E1-OSPFexternaltype1,E2-OSPFexternaltype2,E-EGPi-IS-IS,L1-IS-ISlevel-1,L2-IS-ISlevel-2,ia-IS-ISinterarea*-candidatedefault,U-per-userstaticroute,o-ODRP-periodicdownloadedstaticrouteGatewayoflastresortis172.16.2.2tonetwork0.0.0.0

1.0.0.0/24issubnetted,1subnetsC1.1.1.0isdirectlyconnected,Loopback1R10.0.0.0/8[120/2]via172.16.2.2,00:00:07,Serial0/0/0

172.16.0.0/24issubnetted,3subnetsC172.16.1.0isdirectlyconnected,Loopback0C172.16.2.0isdirectlyconnected,Serial0/0/0R172.16.3.0[120/1]via172.16.2.2,00:00:07,Serial0/0/0R192.168.3.0/24[120/1]via172.16.2.2,00:00:07,Serial0/0/0R*0.0.0.0/0[120/2]via172.16.2.2,00:00:07,Serial0/0/0

注意:R1路由表中出现了默认路由,可以利用这条路由访问

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- huatuo0.cn 版权所有 湘ICP备2023017654号-2

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务