RIP中V1/V2互通问题

RIP:

路由信息协议;距离矢量型协议,使用跳数作为度量,基于UDP520端口

工作特性:

  • 支持等开销负载均衡,默认4条,最大6条;
  • IOS版本12.4以上16条;
  • 默认仅使用更新包,周期更新30s,触发更新;

RIP中的V1 V2问题

RIP中存在三个版本分别为RIPV1、RIPV2(基于IPV4工作)和RIPNG(基于IPV6工作)在进行RIP配置时,需要选择RIP版本号,由于版本1和版本2有所区别,所以不同的版本号之前不能进行数据的收发,无法获取到不同版本号的路由信息。

V1,V2的区别:
  • 1、V2无类别,V1有类别—V2支持作为VLSM,仅支持CIDR,不支持超网;
  • 2、V1广播更新–255.255.255.255 V2组播更新–224.0.0.9
  • 3、V2支持认证

则若想实现V1 V2数据互通,需要V1 V2进行兼容:

  • 标准V1仅收发v1信息,V2仅接收V2信息;
  • 升级V1发V1,收V1/2;

无论设备当下使用的什么版本,所有接口可收发的版本信息均可修改
r1(config)#interface s1/1
r1(config-if)#ip rip send version 1 2 —修改发送版本信息
r1(config-if)#ip rip receive version 1 2 —修改可以接受版本信息
切记:V1和升级版本1 的设备即便模仿V2发送V2路由,但依然无法携带掩码;
V2可以正常发出和V1一样的路由;
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *

下面通过实例来验证:

实验要求:

  • R1为ISP,只能配置IP地址,不能有其他配置
  • R7环回地址为172.16.1.0/24
  • R8环回地址为172.16.2.0/24
  • R7-R8之间的地址为78.1.1.0/24
  • 剩余所有网络地址使用192.168.1.0/24
  • R2到R5环回通过R3访问
  • R2-R6运行RIPV2,R7-R8运行RIPV1
  • 加快协议收敛速度,保障更新安全,尽量减少路由条目
  • R2-R8设备均可访问R1环回
  • R1 telnet R2 实际访问到 R8
  • 全网互通
实验拓扑图

这里写图片描述

进行网络配置前,首先需要对Ip地址进行合理划分,这里根据实验拓扑及实验要求,对ip地址进行划分:
将192.168.1.0/24 划分为8个较大ip区间,其中
192.168.1.0/27 用作骨干区域 —为有效利用ip地址,还可再进行细化
192.168.1.32/27 用于R2
192.168.1.64/27 用于R3
192.168.1.96/27 用于R4
192.168.1.128/27 用于R5
192.168.1.160/27 用于R6
192.168.1.192/27 192.168.1.224/27 用作备用ip

配置信息:
预配置:

Router(config)#lin co 0
Router(config-line)#logg sy
Router(config-line)#login local
Router(config-line)#exec-t 0 0
Router(config-line)#no ip do lo
Router(config)#ho R1
R1(config)#

路由器配置信息(只写入有用信息):
R1:

R1#show running-config
Building configuration…

hostname R1
!
no ip domain lookup
!
interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface Ethernet0/0
ip address 12.1.1.1 255.255.255.0
!
line con 0
exec-timeout 0 0
logging synchronous
login local
line aux 0
line vty 0 4
login
transport input all
!
!
end

R2:

R2#show running-config
Building configuration…

no service password-encryption
!
hostname R2
!
!
no ip domain lookup
ip cef
no ipv6 cef
!
multilink bundle-name authenticated
!
!
key chain a
key 1
key-string cisco123
!
interface Loopback0
ip address 192.168.1.33 255.255.255.240
ip rip advertise 15
!
interface Loopback1
ip address 192.168.1.49 255.255.255.240
ip rip advertise 15
!
interface Ethernet0/0
ip address 12.1.1.2 255.255.255.0
ip nat outside
ip virtual-reassembly in
!
interface Ethernet0/1
ip address 192.168.1.1 255.255.255.252
ip nat inside
ip rip advertise 15
ip rip authentication mode md5
ip rip authentication key-chain a
ip virtual-reassembly in
ip summary-address rip 192.168.1.32 255.255.255.224
!
interface Ethernet0/2
ip address 192.168.1.22 255.255.255.252
ip nat inside
ip rip advertise 15
ip virtual-reassembly in
ip summary-address rip 192.168.1.32 255.255.255.224
!
router rip
version 2
timers basic 15 90 90 120
offset-list 1 in 2 Ethernet0/2
network 192.168.1.0
default-information originate
no auto-summary
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
ip nat inside source list 2 interface Ethernet0/0 overload
ip nat inside source static tcp 172.16.2.1 23 12.1.1.2 23 extendable
ip route 0.0.0.0 0.0.0.0 12.1.1.1
!
access-list 1 permit 192.168.1.128
access-list 2 permit 192.168.1.0 0.0.0.255
access-list 2 permit 172.16.0.0 0.0.255.255
access-list 2 permit 78.1.1.0 0.0.0.255
!
control-plane
!
line con 0
exec-timeout 0 0
logging synchronous
login local
line aux 0
line vty 0 4
login
transport input all
!
!
end

R3-R5配置信息大致相同,不作过多说明:

R3#show running-config
Building configuration…

no service password-encryption
!
hostname R3
!
!
no ip domain lookup
ip cef
no ipv6 cef
!
multilink bundle-name authenticated
!
!
key chain a
key 1
key-string cisco123
!
interface Loopback0
ip address 192.168.1.65 255.255.255.240
ip rip advertise 15
!
interface Loopback1
ip address 192.168.1.81 255.255.255.240
ip rip advertise 15
!
interface Ethernet0/0
ip address 192.168.1.5 255.255.255.252
ip rip advertise 15
ip summary-address rip 192.168.1.64 255.255.255.224
!
interface Ethernet0/1
ip address 192.168.1.2 255.255.255.252
ip rip advertise 15
ip rip authentication mode md5
ip rip authentication key-chain a
ip summary-address rip 192.168.1.64 255.255.255.224
!
!
router rip
version 2
timers basic 15 90 90 120
network 192.168.1.0
no auto-summary
!
!
line con 0
exec-timeout 0 0
logging synchronous
login local
line aux 0
line vty 0 4
login
transport input all
!
!
end

R6:

R6#show running-config
Building configuration…
no service password-encryption
!
hostname R6
!
!
no ip domain lookup
!
interface Loopback0
ip address 192.168.1.161 255.255.255.240
ip rip advertise 15
!
interface Loopback1
ip address 192.168.1.177 255.255.255.240
ip rip advertise 15
!
interface Ethernet0/0
ip address 192.168.1.14 255.255.255.252
ip rip advertise 15
ip summary-address rip 192.168.1.160 255.255.255.224
!
interface Ethernet0/1
ip address 192.168.1.17 255.255.255.252
ip rip advertise 15
ip rip send version 2
ip summary-address rip 192.168.1.0 255.255.255.0
!
interface Ethernet0/2
ip address 192.168.1.21 255.255.255.252
ip rip advertise 15
ip summary-address rip 192.168.1.160 255.255.255.224
!
!
router rip
version 2
timers basic 15 90 90 120
network 192.168.1.0
no auto-summary
!
!
line con 0
exec-timeout 0 0
logging synchronous
login local
line aux 0
line vty 0 4
login
transport input all
!
!
end

R7:

R7#show running-config
Building configuration…
no service password-encryption
!
hostname R7
!
!
no ip domain lookup
!
interface Loopback0
ip address 172.16.1.1 255.255.255.0
ip rip advertise 15
!
interface Ethernet0/0
ip address 172.16.3.1 255.255.255.0 secondary
ip address 78.1.1.1 255.255.255.0
ip rip advertise 15
!
interface Ethernet0/1
ip address 192.168.1.18 255.255.255.252
ip rip advertise 15
ip rip send version 2
ip rip receive version 2
!
!
router rip
version 1
timers basic 15 90 90 120
network 78.0.0.0
network 172.16.0.0
network 192.168.1.0
!
line con 0
exec-timeout 0 0
logging synchronous
login local
line aux 0
line vty 0 4
login
transport input all
!
!
end

R8:

R8#show running-config
Building configuration…
no service password-encryption
!
hostname R8
!
!
no ip domain lookup
!
username cisco privilege 15 secret 5 1 1 <script type="math/tex" id="MathJax-Element-17">1</script>U4.k$9msHTzbAJAIpwvdCnekDQ.
!
!
interface Loopback0
ip address 172.16.2.1 255.255.255.0
ip rip advertise 15
!
interface Ethernet0/0
ip address 172.16.3.2 255.255.255.0 secondary
ip address 78.1.1.2 255.255.255.0
ip rip advertise 15
!
!
router rip
version 1
timers basic 15 90 90 120
network 78.0.0.0
network 172.16.0.0
!
!
line con 0
exec-timeout 0 0
logging synchronous
login local
line aux 0
line vty 0 4
login local
transport input all
!
!
end

问题解决:

1.R7,R8之间环回学习问题:由于通过主类宣告,7和8的环回地址处于同一主类地址网段,在进行rip宣告后不能相互学习—(连续性子网问题

R7(config)#do show ip ro
R7(config)#do show ip route

  78.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C    78.1.1.0/24 is directly connected, Ethernet0/0
L    78.1.1.1/32 is directly connected, Ethernet0/0
      172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C    172.16.1.0/24 is directly connected, Loopback0
L    172.16.1.1/32 is directly connected, Loopback0
      192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C    192.168.1.16/30 is directly connected, Ethernet0/1
L    192.168.1.18/32 is directly connected, Ethernet0/1

可以看到7中并没有学习到8的环回,因此需要使用第二地址解决此问题,作如下操作:

R7(config)#int e0/0
R7(config-if)#ip add 172.16.3.1 255.255.255.0 secondary
R7(config-if)#ex
R8(config)#int e0/0
R8(config-if)#ip add 172.16.3.2 255.255.255.0 secondary
R8(config-if)#ex

再次查看R7路由表,可以看到可以正常学习到R8环回

R7(config)#do show ip route

  78.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C    78.1.1.0/24 is directly connected, Ethernet0/0
L    78.1.1.1/32 is directly connected, Ethernet0/0
      172.16.0.0/16 is variably subnetted, 6 subnets, 2 masks
R    172.16.0.0/24 [120/1] via 78.1.1.2, 00:00:01, Ethernet0/0
C    172.16.1.0/24 is directly connected, Loopback0
L    172.16.1.1/32 is directly connected, Loopback0
  R 172.16.2.0/24 [120/1] via 172.16.3.2, 00:00:01, Ethernet0/0
C    172.16.3.0/24 is directly connected, Ethernet0/0
L    172.16.3.1/32 is directly connected, Ethernet0/0
      192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C    192.168.1.16/30 is directly connected, Ethernet0/1
L    192.168.1.18/32 is directly connected, Ethernet0/1

R6 R7之间路由学习问题:

   通过更改接口收发版本信息,可以对路由信息进行收发,但由于2-6骨干之间和6-7之间连续性子网问题,当6发送版本1,7发送版本2时,则7不能学习到2-6上环回路由,,而且由于RIPV1不支持子网汇总,则7,8只能通过静态路由访问2-6环回;当6发送版本2,7接收版本2时,6,7可以相互学习环回,骨干路由,且可以在6上通过子网汇总缩减路由条目;
R7(config)#do show ip route

  78.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C 78.1.1.0/24 is directly connected, Ethernet0/0
L 78.1.1.1/32 is directly connected, Ethernet0/0
172.16.0.0/16 is variably subnetted, 6 subnets, 2 masks
R 172.16.0.0/24 [120/1] via 78.1.1.2, 00:00:25, Ethernet0/0
C 172.16.1.0/24 is directly connected, Loopback0
L 172.16.1.1/32 is directly connected, Loopback0
R 172.16.2.0/24 [120/1] via 172.16.3.2, 00:00:25, Ethernet0/0
C 172.16.3.0/24 is directly connected, Ethernet0/0
L 172.16.3.1/32 is directly connected, Ethernet0/0
192.168.1.0/24 is variably subnetted, 18 subnets, 4 masks
R 192.168.1.0/24 [120/1] via 192.168.1.17, 00:00:17, Ethernet0/1
R 192.168.1.0/30 [120/2] via 192.168.1.17, 00:00:44, Ethernet0/1
R 192.168.1.4/30 [120/3] via 192.168.1.17, 00:00:44, Ethernet0/1
R 192.168.1.8/30 [120/2] via 192.168.1.17, 00:00:44, Ethernet0/1
R 192.168.1.12/30 [120/1] via 192.168.1.17, 00:00:44, Ethernet0/1
C 192.168.1.16/30 is directly connected, Ethernet0/1
L 192.168.1.18/32 is directly connected, Ethernet0/1
R 192.168.1.20/30 [120/1] via 192.168.1.17, 00:00:44, Ethernet0/1
R 192.168.1.32/28 [120/2] via 192.168.1.17, 00:00:44, Ethernet0/1
R 192.168.1.48/28 [120/2] via 192.168.1.17, 00:00:44, Ethernet0/1
R 192.168.1.64/28 [120/3] via 192.168.1.17, 00:00:44, Ethernet0/1
R 192.168.1.80/28 [120/3] via 192.168.1.17, 00:00:44, Ethernet0/1
R 192.168.1.96/28 [120/3] via 192.168.1.17, 00:00:44, Ethernet0/1
R 192.168.1.112/28 [120/3] via 192.168.1.17, 00:00:44, Ethernet0/1
R 192.168.1.128/28 [120/2] via 192.168.1.17, 00:00:44, Ethernet0/1
R 192.168.1.144/28 [120/2] via 192.168.1.17, 00:00:44, Ethernet0/1
R 192.168.1.160/28 [120/1] via 192.168.1.17, 00:00:44, Ethernet0/1
R 192.168.1.176/28 [120/1] via 192.168.1.17, 00:00:44, Ethernet0/1

通过子网汇总缩减路由条目:
R6(config)#int e0/1
R6(config-if)#ip summary-address rip 192.168.1.0 255.255.255.0
R6(config-if)#ex

R7(config)#do show ip route

  78.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C 78.1.1.0/24 is directly connected, Ethernet0/0
L 78.1.1.1/32 is directly connected, Ethernet0/0
172.16.0.0/16 is variably subnetted, 6 subnets, 2 masks
R 172.16.0.0/24 [120/1] via 78.1.1.2, 00:00:16, Ethernet0/0
C 172.16.1.0/24 is directly connected, Loopback0
L 172.16.1.1/32 is directly connected, Loopback0
R 172.16.2.0/24 [120/1] via 172.16.3.2, 00:00:16, Ethernet0/0
C 172.16.3.0/24 is directly connected, Ethernet0/0
L 172.16.3.1/32 is directly connected, Ethernet0/0
192.168.1.0/24 is variably subnetted, 3 subnets, 3 masks
R 192.168.1.0/24 [120/1] via 192.168.1.17, 00:00:03, Ethernet0/1
C 192.168.1.16/30 is directly connected, Ethernet0/1
L 192.168.1.18/32 is directly connected, Ethernet0/1

R2 R5之间选路问题:

R2访问R5环回,查看路由表可知默认选择跳数较小的路径,即通过R6;要想使R2通过R3 R4访问R5,则可在R2和R6入向对流量进行控制,认为增加跳数,使下方路径不优;

查看R2路由表:

R2(config)#do show ip route

  12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C 12.1.1.0/24 is directly connected, Ethernet0/0
L 12.1.1.2/32 is directly connected, Ethernet0/0
R 78.0.0.0/8 [120/2] via 192.168.1.21, 00:00:07, Ethernet0/2
R 172.16.0.0/16 [120/2] via 192.168.1.21, 00:00:07, Ethernet0/2
192.168.1.0/24 is variably subnetted, 16 subnets, 4 masks
C 192.168.1.0/30 is directly connected, Ethernet0/1
L 192.168.1.1/32 is directly connected, Ethernet0/1
R 192.168.1.4/30 [120/1] via 192.168.1.2, 00:00:09, Ethernet0/1
R 192.168.1.8/30 [120/2] via 192.168.1.21, 00:00:07, Ethernet0/2
[120/2] via 192.168.1.2, 00:00:09, Ethernet0/1
R 192.168.1.12/30 [120/1] via 192.168.1.21, 00:00:07, Ethernet0/2
R 192.168.1.16/30 [120/1] via 192.168.1.21, 00:00:07, Ethernet0/2
C 192.168.1.20/30 is directly connected, Ethernet0/2
L 192.168.1.22/32 is directly connected, Ethernet0/2
C 192.168.1.32/28 is directly connected, Loopback0
L 192.168.1.33/32 is directly connected, Loopback0
C 192.168.1.48/28 is directly connected, Loopback1
L 192.168.1.49/32 is directly connected, Loopback1
R 192.168.1.64/27 [120/1] via 192.168.1.2, 00:00:09, Ethernet0/1
R 192.168.1.96/27 [120/2] via 192.168.1.2, 00:00:09, Ethernet0/1
R 192.168.1.128/27 [120/2] via 192.168.1.21, 00:00:07, Ethernet0/2
            默认通过R6访问

R 192.168.1.160/27 [120/1] via 192.168.1.21, 00:00:07, Ethernet0/2

更改跳数:

R2(config)#access-list 1 permit 192.168.1.128
R2(config)#router rip
R2(config-router)#offset-list 1 in 2 e0/2
R2(config-router)#exit

再次查看R2路由表:

R2(config)#do show ip route

  12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C 12.1.1.0/24 is directly connected, Ethernet0/0
L 12.1.1.2/32 is directly connected, Ethernet0/0
R 78.0.0.0/8 [120/2] via 192.168.1.21, 00:00:04, Ethernet0/2
R 172.16.0.0/16 [120/2] via 192.168.1.21, 00:00:04, Ethernet0/2
192.168.1.0/24 is variably subnetted, 16 subnets, 4 masks
C 192.168.1.0/30 is directly connected, Ethernet0/1
L 192.168.1.1/32 is directly connected, Ethernet0/1
R 192.168.1.4/30 [120/1] via 192.168.1.2, 00:00:01, Ethernet0/1
R 192.168.1.8/30 [120/2] via 192.168.1.21, 00:00:04, Ethernet0/2
[120/2] via 192.168.1.2, 00:00:01, Ethernet0/1
R 192.168.1.12/30 [120/1] via 192.168.1.21, 00:00:04, Ethernet0/2
R 192.168.1.16/30 [120/1] via 192.168.1.21, 00:00:04, Ethernet0/2
C 192.168.1.20/30 is directly connected, Ethernet0/2
L 192.168.1.22/32 is directly connected, Ethernet0/2
C 192.168.1.32/28 is directly connected, Loopback0
L 192.168.1.33/32 is directly connected, Loopback0
C 192.168.1.48/28 is directly connected, Loopback1
L 192.168.1.49/32 is directly connected, Loopback1
R 192.168.1.64/27 [120/1] via 192.168.1.2, 00:00:01, Ethernet0/1
R 192.168.1.96/27 [120/2] via 192.168.1.2, 00:00:01, Ethernet0/1
R 192.168.1.128/27 [120/3] via 192.168.1.2, 00:00:01, Ethernet0/1
            R2访问R5路径已经改变

R 192.168.1.160/27 [120/1] via 192.168.1.21, 00:00:04, Ethernet0/2

端口映射:

R1 telnet R2 实际访问R8,则需要将R2外网接口映射到R8对应端口

R8开启远程登录服务:

R8(config)#username cisco privilege 15 secret cisco123
R8(config)#line vty 0 4
R8(config-line)#login local
R8(config-line)#exit

R2作端口映射:

R2(config)#ip nat inside source static tcp 172.16.2.1 23 12.1.1.2 23

可以看到 R1 telnet R2,实际登录到R8:

R1#telnet 12.1.1.2
Trying 12.1.1.2 … Open

User Access Verification

Username: cisco
Password:
R8#
R8#

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值