网络实验之RIPV2协议(二)

一、RIPV2协议和实验简介

  RIP-2是一种无类别路由协议(Classless Routing Protocol),支持路由标记,在路由策略中可根据路由标记对路由进行灵活的控制。报文中携带掩码信息,支持路由聚合和CIDR(Classless Inter-Domain Routing,无类域间路由)。前面博文网络实验之RIPV2协议(一)已经介绍了RIPV2协议的基础配置,此博文是在RIPV2基础配置内容的基础上进一步配置和实践验证RIPV2协议的路由汇总、协议认证、默认路由分发、负载均衡等。

二、RIPV2协议实践

1、实验环境说明

  博文实验环境采用GNS3模拟器搭建VRRP网络实验环境,三层交换机使用3640,iso系统版本为c3640-jk9o3s-mz.124-10a.bin。

2、拓扑图

  本实验共使用5台交换机,1个PC终端搭建完成,其中PC机模拟局域网终端。R1-R4交换机模拟企业网RIPV2网络环境,R5模拟互联网,配置两个loopback地址模拟互联网终端。初始配置内容为PC1到loopback0网络互连互通的状态,后续将根据验证内容进行配置微调。
在这里插入图片描述

3、网络配置

  如下配置为完成基本互联互通的网络配置,实现了PC1和R5上的loopback0地址的互联互通。PC1和R5上的loopback1地址网络是不通的(此时没有配置默认路由,R4上只配置了到lo的静态路由)

  • R1配置
conf t
ip routing
hostname R1
interface Serial1/0
 description To R2
 ip address 12.12.12.1 255.255.255.0
 no shutdown
!
interface Serial1/1
 description To R3
 ip address 13.13.13.1 255.255.255.0
 no shutdown
!
interface Serial1/2
 description To R5
 ip address 15.15.15.1 255.255.255.0
 no shutdown
!
router rip
 version 2
 redistribute connected
 redistribute static
 network 12.0.0.0
 network 13.0.0.0
 no auto-summary
!
ip route 5.5.5.0 255.255.255.0 15.15.15.5
end
wr
  • R2配置
conf t
ip routing
hostname R2
interface Serial1/0
 description To R1
 ip address 12.12.12.2 255.255.255.0
 no shutdown
!
interface Serial1/1
 description To R4
 ip address 24.24.24.2 255.255.255.0
 no shutdown
router rip
 version 2
 redistribute connected
 network 12.0.0.0
 network 24.0.0.0
 no auto-summary
! 
end
wr
  • R3配置
conf t
ip routing
hostname R3
interface Serial1/0
 description To R1
 ip address 13.13.13.3 255.255.255.0
 serial restart-delay 0
!
interface Serial1/1
 description To R4
 ip address 34.34.34.3 255.255.255.0
 serial restart-delay 0
!
router rip
 version 2
 redistribute connected
 network 13.0.0.0
 network 34.0.0.0
 no auto-summary
!
  • R4配置
conf t
ip routing
hostname R4
interface Ethernet0/0
 description To PC1
 ip address 192.168.0.254 255.255.255.0
 full-duplex
!
interface Serial1/0
 description To R2
 ip address 24.24.24.4 255.255.255.0
 serial restart-delay 0
!
interface Serial1/1
 description To R3
 ip address 34.34.34.4 255.255.255.0
 serial restart-delay 0
!
router rip
 version 2
 redistribute connected
 network 24.0.0.0
 network 34.0.0.0
 no auto-summary
!
  • R5配置
conf t
ip routing
hostname R5
interface Loopback0
 ip address 5.5.5.5 255.255.255.0
!
interface Loopback1
 ip address 55.55.55.55 255.255.255.0
!
interface Serial1/0
 description To R1
 ip address 15.15.15.5 255.255.255.0
 serial restart-delay 0
!
ip route 192.168.0.0 255.255.255.0 15.15.15.1

4、实践内容验证测试

  • PC1到R5的lo:5.5.5.5网络通断性验证
    我们给PC1配置上IP地址192.168.0.10,然后分别ping 5.5.5.5和55.55.55.55,我们可以看到PC1到L0网络是通的,到L1网络是不通的,因为我们在R4上配置的静态路由,且只配置了到LO的静态路由。
    在这里插入图片描述
  • 路由自动汇总测试
    开启自动汇总出的网络号不会越过主类网络。在RIP中关闭自动汇总后,可以在某一个接口去做手动的汇总。使用ip summary-address rip 网络地址 掩码 命令方式完成手动汇总。

R4(config-if)#int loop 0
R4(config-if)#ip add 172.16.0.254 255.255.255.0
R4(config-if)#int loop 1
R4(config-if)#ip add 172.16.1.254 255.255.255.0
R4(config)#int loop 3
R4(config-if)#ip add 192.168.1.254 255.255.255.0
R4(config-if)#router rip
R4(config-router)#auto-summary

在这里插入图片描述

  • 默认路由发布测试
    动态路由协议发布默认路由最简单的方式就是配置一条默认路由,然后redistribute static重发布到动态路由协议中。RIP中实际上我们还可以使用default-information originate命令重发布一条默认路由。

#在R1上发布默认路由和配置需要的静态路由
R1(config)#router rip
R1(config-router)#default-information originate
R1(config-router)#no redistribute static
R1(config-router)#exit
R1(config)#ip route 55.55.55.55 255.255.255.255 15.15.15.5
#其他RIP协议路由器上查看默认路由
在这里插入图片描述
在这里插入图片描述
#PC1到55.55.55.55网络已通
在这里插入图片描述

  • 路由负载均衡
    RIP协议是基于距离矢量的,R4到R1都是2跳的距离,所以R4发布的路由存在R2/R3两个路径到达R1,而且是等价的,同时存在路由表中,但是日常某主机选择了某链路路由之后,下一次还是会选择同一个接口,这是因为开启了思科设备默认开启了ip cef命令,实现硬件快速转发,可以减少延时,提升转发效率。
    在这里插入图片描述
  • 协议认证
    在这里插入图片描述

R1(config)#key chain RR
R1(config-keychain)#key 1
R1(config-keychain-key)#key-string cisco
R1(config-keychain-key)#int s1/0
R1(config-if)#ip rip authentication key-chain RR
R1(config-if)#ip rip authentication mode md5
#R2上开启debug ip rip,查看协议认证报文日志
R2#debug ip rip
RIP protocol debugging is on
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
#在上面R2上配置认证信息
R2(config)#key chain RR
R2(config-keychain)#key 1
R2(config-keychain-key)#key-string cisco
R2(config-keychain-key)#int s1/0
R2(config-if)#ip rip authentication key-chain RR
R2(config-if)#ip rip authentication mode md5
#R2配置完成认证信息后,开始接受RIP报文
在这里插入图片描述
#trace路径,R1到R4的等价路径R2和R3都是通的。
在这里插入图片描述

三、总结

  • 思科设备上路由自动汇总默认关闭,也建议关闭,开启自动汇总可能引发路由环路;
  • RIPV2协议默认开启水平分割
  • 认证技术可以提高网络的安全性,只有互相认证成功的两台合法路由器之间才能传递路由信息,RIPV2支持MD5和文本两种认证方式;
  • 可以使用default-information originate发布默认路由,也可以使用配置静态路由+重发布的方式在RIPv2协议中发布默认路由;
  • RIP只支持等价的负载均衡,默认4条,最大16条,使用maximum-paths命令设置等价路由条数;
  • RIP中每一个路由更新报文最大可包含25条路由,做了明文认证后只能包含24条,做了MD5认证后只能包含23条。

猜你喜欢

转载自blog.csdn.net/carefree2005/article/details/128198846