0YujCfmUCw
RIP协议以跳数做为衡量路径开销的,RIP协议里规定最大跳数为15。
RIP在构造路由表时会使用到3种计时器:
更新计时器、无效计时器、刷新计时器。
它让每台路由器周期性地向每个相邻的邻居发送完整的路由表。
路由表包括每个网络或子网的信息,以及与之相关的度量值。
eUts8ZQVRd
【实验步骤】
第一步:
配置两台路由器的主机名、接口IP地址
RSR20#configureterminal
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.sQsAEJkW5T
RSR20(config>#hostnameRouterA
RouterA(config>#
RouterA(config>#interfacefastEthernet0/0
RouterA(config-if>#ipaddress192.168.1.1255.255.255.0GMsIasNXkA
RouterA(config-if>#noshutdown
RouterA(config-if>#exit
RouterA(config>#
RouterA(config>#interfaceloopback0
RouterA(config-if>#Aug1523:
46:
32RouterA%7:
%LINEPROTOCOLCHANGE:
InterfaceLoopback0,changedstatetoUPTIrRGchYzg
RouterA(config-if>#ipaddress172.16.1.1255.255.255.07EqZcWLZNX
RouterA(config-if>#exit
RouterA(config>#
RouterA(config>#interfaceloopback1
RouterA(config-if>#Aug1523:
47:
00RouterA%7:
%LINEPROTOCOLCHANGE:
InterfaceLoopback1,changedstatetoUPlzq7IGf02E
RouterA(config-if>#ipaddress172.16.2.1255.255.255.0zvpgeqJ1hk
RouterA(config-if>#exit
RSR20#configureterminal
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.NrpoJac3v1
RSR20(config>#hostnameRouterB
RouterB(config>#
RouterB(config>#interfacefastEthernet0/0
RouterB(config-if>#ipaddress192.168.1.2255.255.255.01nowfTG4KI
RouterB(config-if>#noshutdown
RouterB(config-if>#exit
RouterB(config>#
RouterB(config>#interfaceloopback0
RouterB(config-if>#Aug821:
00:
00RouterB%7:
%LINEPROTOCOLCHANGE:
InterfaceLoopback0,changedstatetoUPfjnFLDa5Zo
RouterB(config-if>#ipaddress10.1.1.1255.255.255.0tfnNhnE6e5
RouterB(config-if>#exit
RouterB(config>#
RouterB(config>#interfaceloopback1
RouterB(config-if>#Aug821:
00:
28RouterB%7:
%LINEPROTOCOLCHANGE:
InterfaceLoopback1,changedstatetoUPHbmVN777sL
RouterB(config-if>#ipaddress10.2.2.1255.255.255.0V7l4jRB8Hs
RouterB(config-if>#exit
第二步:
在两台路由器上配置RIP路由协议
RouterA(config>#routerrip
RouterA(config-router>#network192.168.1.0
RouterA(config-router>#network172.16.1.0
RouterA(config-router>#exit
RouterB(config>#routerrip
RouterB(config-router>#network192.168.1.0
RouterB(config-router>#network10.0.0.0
RouterB(config-router>#exit
第三步:
查看RIP配置信息,路由表
RouterA#showiproute
Codes:
C-connected,S-static,R-RIPB-BGP
O-OSPF,IA-OSPFinterarea
N1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype283lcPA59W9
E1-OSPFexternaltype1,E2-OSPFexternaltype2mZkklkzaaP
i-IS-IS,L1-IS-ISlevel-1,L2-IS-ISlevel-2,ia-IS-ISinterareaAVktR43bpw
*-candidatedefault
Gatewayoflastresortisnoset
R10.0.0.0/8[120/1]via192.168.1.2,00:
00:
17,FastEthernet0/0ORjBnOwcEd
C172.16.1.0/24isdirectlyconnected,Loopback0
C172.16.1.1/32islocalhost.
C172.16.2.0/24isdirectlyconnected,Loopback1
C172.16.2.1/32islocalhost.
C192.168.1.0/24isdirectlyconnected,FastEthernet0/02MiJTy0dTT
C192.168.1.1/32islocalhost.
RouterA#
RoutingProtocolis"rip"
Sendingupdatesevery30seconds,nextduein21secondsgIiSpiue7A
Invalidafter180seconds,flushedafter120secondsuEh0U1Yfmh
Outgoingupdatefilterlistforallinterfaceis:
notsetIAg9qLsgBX
Incomingupdatefilterlistforallinterfaceis:
notsetWwghWvVhPE
Defaultredistributionmetricis1
Redistributing:
Defaultversioncontrol:
sendversion1,receiveanyversionasfpsfpi4k
InterfaceSendRecvKey-chain
FastEthernet0/0112
Loopback0112
Loopback1112
RoutingforNetworks:
172.16.0.0
192.168.1.0
Distance:
(defaultis120>
RouterA#
RouterB#showiproute
Codes:
C-connected,S-static,R-RIPB-BGP
O-OSPF,IA-OSPFinterarea
N1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2ooeyYZTjj1
E1-OSPFexternaltype1,E2-OSPFexternaltype2BkeGuInkxI
i-IS-IS,L1-IS-ISlevel-1,L2-IS-ISlevel-2,ia-IS-ISinterareaPgdO0sRlMo
*-candidatedefault
Gatewayoflastresortisnoset
C10.1.1.0/24isdirectlyconnected,Loopback0
C10.1.1.1/32islocalhost.
C10.2.2.0/24isdirectlyconnected,Loopback1
C10.2.2.1/32islocalhost.
R172.16.0.0/16[120/1]via192.168.1.1,00:
00:
12,FastEthernet0/03cdXwckm15
C192.168.1.0/24isdirectlyconnected,FastEthernet0/0h8c52WOngM
C192.168.1.2/32islocalhost.
RouterA#showipripdatabase
RouterA#showipripinterface
RouterB#showiprip
RouterB#showipripdatabase
RouterB#showipripinterface
第四步:
测试网络连通性
RouterA#ping10.1.1.1
Sending5,100-byteICMPEchoesto10.1.1.1,timeoutis2seconds:
v4bdyGious
!
!
!
!
!
Successrateis100percent(5/5>,round-tripmin/avg/max=1/1/1msJ0bm4qMpJ9
RouterA#ping10.2.2.1
Sending5,100-byteICMPEchoesto10.2.2.1,timeoutis2seconds:
XVauA9grYP
!
!
!
!
!
Successrateis100percent(5/5>,round-tripmin/avg/max=1/2/10msbR9C6TJscw
RouterB#ping172.16.1.1
Sending5,100-byteICMPEchoesto172.16.1.1,timeoutis2seconds:
pN9LBDdtrd
!
!
!
!
!
Successrateis100percent(5/5>,round-tripmin/avg/max=1/1/1msDJ8T7nHuGT
RouterB#ping172.16.2.1
Sending5,100-byteICMPEchoesto172.16.2.1,timeoutis2seconds:
QF81D7bvUA
!
!
!
!
!
Successrateis100percent(5/5>,round-tripmin/avg/max=1/1/1ms4B7a9QFw9h
第五步:
用debug命令观察路由器接收和发生路由更新的情况
下面是一个完整的RIP路由器接收更新和发送更新的过程,从中可以看到RouterB接收到了RouterA发送的更新,其中包含一条路由信息172.16.0.0<可以看到水平分割原则的作用),然后刷新了路由表。
ix6iFA8xoX
RouterB本身发送的更新报文则在Fa0/0、Lo0和Lo1三个端口发出,采用广播的方式,广播地址分别为192.168.1.255,10.1.1.255,10.2.2.255,使用UDP的520端口。
在水平分割的原则下,每个端口发送的路由信息均不相同。
wt6qbkCyDE
RouterB#debugiprip
Aug821:
06:
08RouterB%7:
[RIP]RIPrecveivedpacket,sock=2125src=192.168.1.1len=24Kp5zH46zRk
Aug821:
06:
08RouterB%7:
[RIP]CancelpeerremovetimerYl4HdOAA61
Aug821:
06:
08RouterB%7:
[RIP]Peerremovetimershedule...ch4PJx4BlI
Aug821:
06:
08RouterB%7:
route-entry:
family2ip172.16.0.0metric1qd3YfhxCzo
Aug821:
06:
08RouterB%7:
[RIP]Receivedversion1responsepacketE836L11