思科路由器:RIP动态路由协议实验

您所在的位置:网站首页 关闭路由自动汇总的命令 思科路由器:RIP动态路由协议实验

思科路由器:RIP动态路由协议实验

2023-09-16 03:20| 来源: 网络整理| 查看: 265

1、RIP简介

RIP(Routing Information protocol) 路由信息协议. 是一种内部网关协议(IGP),是一种动态路由选择协议,用于自治系统(AS)内的路由信息的传递。RIP协议基于距离矢量算法(DistanceVectorAlgorithms),使用“跳数”(即metric)来衡量到达目标地址的路由距离。RIP通过UDP报文进行路由信息交换,使用的端口号为520.

RIP的基本概念

定期更新邻居广播更新全路由表更新

RIP度量值为跳数,最大跳数为15跳,16跳不可达; RIP更新时间为30s发送路由更新消息,UDP 520端口; RIP会发送整个路由表信息。

RIP包括RIP-v1和RIP-v2两个版本

2、RIPV1和RIPV2比较 RIPV1RIPV2有类路由协议无类路由协议不支持VLSM支持VLSM广播更新255.255.255.255组播更新224.0.0.9 3、实验拓扑

在这里插入图片描述

4、准备工作 R1配置端口IP Router>en Router#conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#ho R1 R1(config)# R1(config)#int g0/1 R1(config-if)#ip add 192.168.10.254 255.255.255.0 R1(config-if)#no sh R1(config-if)# R1(config-if)#int g0/0 R1(config-if)#ip add 10.10.30.1 255.255.255.0 R1(config-if)#no sh R1(config-router)#do show ip interface brief Interface IP-Address OK? Method Status Protocol GigabitEthernet0/0 10.10.30.1 YES manual up up GigabitEthernet0/1 192.168.10.254 YES manual up up GigabitEthernet0/2 unassigned YES unset administratively down down Vlan1 unassigned YES unset administratively down down R2配置端口IP Router>enable Router#conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config-if)#ho R2 R2(config)# R2(config)# R2(config)#in g0/1 R2(config-if)#ip add 192.168.20.254 255.255.255.0 R2(config-if)#no sh R2(config-if)# %LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up R2(config-if)#ex R2(config)#int g0/0 R2(config-if)#ip add 10.10.30.2 255.255.255.0 R2(config-if)#no sh R2(config)#do show ip interface brief Interface IP-Address OK? Method Status Protocol GigabitEthernet0/0 10.10.30.2 YES manual up up GigabitEthernet0/1 192.168.20.254 YES manual up up GigabitEthernet0/2 unassigned YES unset administratively down down Vlan1 unassigned YES unset administratively down down 5、配置RIP协议

R1

R1(config)#route rip #开启RIP协议 R1(config-router)#version 2 #启用RIPv2 R1(config-router)#network 192.168.10.0 #宣告网段 R1(config-router)#network 10.10.30.0 #宣告网段 R1(config-router)#no auto-summary #关闭自动汇总

为什么要关闭自动汇总??

是因为RIP协议更新时不带子网掩码,路由器会根据IP自动判断汇总给其加上自己汇总后的子网掩码。假如有个网段是30.1.1.0/24,更新时不会带上24,路由器会认为是A类IP,通过自动汇总会把24汇总成8,这个不是我们想要的,所以要关闭自动汇总。

R2

R2(config)#route rip R2(config-router)#v 2 R2(config-router)#network 192.168.20.0 R2(config-router)#network 10.10.30.0 R2(config-router)#no auto-summary 6、查看路由表 R2(config)#do show ip route Codes: L - local, 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, 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 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 10.10.30.0/24 is directly connected, GigabitEthernet0/0 L 10.10.30.2/32 is directly connected, GigabitEthernet0/0 R 192.168.10.0/24 [120/1] via 10.10.30.1, 00:00:21, GigabitEthernet0/0 192.168.20.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.20.0/24 is directly connected, GigabitEthernet0/1 L 192.168.20.254/32 is directly connected, GigabitEthernet0/1

L-本地,C-直连,S-静态,R-RIP,以R开头的就是RIP协议的:

R 192.168.10.0/24 [120/1] via 10.10.30.1, 00:00:21, GigabitEthernet0/0 192.168.20.0/24 is variably subnetted, 2 subnets, 2 masks

分析:

[120/1] 120是度量值,如果我在路由表手工加入一条静态路由,静态路由默认的度量值默认是1,优先级高于120,则优先执行静态路由;[120/1] 1 是跳数;00:00:21 是距离下次更新倒计时21秒 7、验证结果

用PC1 PING PC2

C:\>ping 192.168.20.1 Pinging 192.168.20.1 with 32 bytes of data: Reply from 192.168.20.1: bytes=32 time


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3