rip中的连续子网以及不连续子网

RIPv1 RIPv2
距离矢量2 距离矢量
最大跳计数15 最大跳计数15
有类的 无类的
基于广播的    基于组播224.0.09
不支持VLSM 支持VLSM
无认证 允许MD5认证
不支持不连续子网 支持不连续子网

下面我们来认识一下什么叫做有类以及无类,有类就是A类,B类,C类,D类网络,没有划分子网。无类就是划分了子网。

我们通过一个例子来说明,比如A类的地址1.1.1.1 子网掩码 255.255.255.0 这是子网,则它的有类网络是1.0.0.0 ,掩码255.0.0.0.无类网络就是1.1.1.0,掩码255.255.255.0.

不连续的子网?

什么叫做不连续的子网呢,不连续的子网就是,中间有其它网络来分开。比如下面该图所显示一样

在rip v1 关闭自动汇总,还是不能学习到172.16.10.1 和172.16.20.1的网络。

R7

!
interface Loopback0
 ip address 172.16.10.1 255.255.255.0
!
interface GigabitEthernet0/0
 ip address 192.168.1.1 255.255.255.0
 duplex auto
 speed auto
!
interface GigabitEthernet0/1
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface GigabitEthernet0/2
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface Vlan1
 no ip address
 shutdown
!
router rip
 network 172.16.0.0
 network 192.168.1.0
 no auto-summary
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
!

 R6

ip cef
no ipv6 cef
!
!
!
!
license udi pid CISCO2911/K9 sn FTX1524JN31
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface Loopback0
 ip address 1.1.1.1 255.255.255.0
!
interface GigabitEthernet0/0
 ip address 192.168.1.2 255.255.255.0
 duplex auto
 speed auto
!
interface GigabitEthernet0/1
 ip address 192.168.2.1 255.255.255.0
 duplex auto
 speed auto
!
interface GigabitEthernet0/2
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface Vlan1
 no ip address
 shutdown
!
router rip
 network 1.0.0.0
 network 192.168.1.0
 network 192.168.2.0
 no auto-summary
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
!
end

R8

hostname Router
!
!
!
!
!
!
!
!
ip cef
no ipv6 cef
!
!
!
!
license udi pid CISCO2911/K9 sn FTX1524CD62
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface Loopback0
 ip address 172.16.30.1 255.255.255.0
!
interface GigabitEthernet0/0
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface GigabitEthernet0/1
 ip address 192.168.2.2 255.255.255.0
 duplex auto
 speed auto
!
interface GigabitEthernet0/2
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface Vlan1
 no ip address
 shutdown
!
router rip
 network 172.16.0.0
 network 192.168.2.0
 no auto-summary
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
View Code

使用RIPv2 之后就可以支持不连续子网,这时候就能够学习到两边172.16.0.0 的子网了。

变为RIP v2的配置

R7

interface Loopback0
 ip address 172.16.10.1 255.255.255.0
!
interface GigabitEthernet0/0
 ip address 192.168.1.1 255.255.255.0
 duplex auto
 speed auto
!
interface GigabitEthernet0/1
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface GigabitEthernet0/2
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface Vlan1
 no ip address
 shutdown
!
router rip
 version 2
 network 172.16.0.0
 network 192.168.1.0
 no auto-summary
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
!
end
View Code

R6

interface Loopback0
 ip address 1.1.1.1 255.255.255.0
!
interface GigabitEthernet0/0
 ip address 192.168.1.2 255.255.255.0
 duplex auto
 speed auto
!
interface GigabitEthernet0/1
 ip address 192.168.2.1 255.255.255.0
 duplex auto
 speed auto
!
interface GigabitEthernet0/2
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface Vlan1
 no ip address
 shutdown
!
router rip
 version 2
 network 1.0.0.0
 network 192.168.1.0
 network 192.168.2.0
 no auto-summary
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
View Code

R8

interface Loopback0
 ip address 172.16.30.1 255.255.255.0
!
interface GigabitEthernet0/0
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface GigabitEthernet0/1
 ip address 192.168.2.2 255.255.255.0
 duplex auto
 speed auto
!
interface GigabitEthernet0/2
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface Vlan1
 no ip address
 shutdown
!
router rip
 version 2
 network 172.16.0.0
 network 192.168.2.0
 no auto-summary
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 
View Code

这时候你再查看路由表就可以看到所有路由都能学习到了。

原文地址:https://www.cnblogs.com/Hackerman/p/6596254.html