VLSM,不连续子网只有Ver2才支持

 

Ver1可以通过secondary address来实现 不连续子网

 

1.什么是VLSM?

VLSM (Variable Length Subnet Mask?可变长子网掩码)

就是将一个网络进行多次的子网划分,使之可以包含大小不等子网掩码不同的子网,这对于网络内部不同网段需要不同大小子网的情形来说很有效。

VLSM的好处?
这是一种产生不同大小子网的网络分配机制,指一个网络可以配置不同的掩码。开发可变长度子网掩码的想法就是在每个子网上保留足够的主机数的同时,把一个子网进一步分成多个小子网时有更大的灵活性。如果没有VLSM,一个子网掩码只能提供给一个网络。这样就限制了要求的子网数上的主机数。

VLSM技术对高效分配IP地址(较少浪费)以及减少路由表大小都起到非常重要的作用。这在超网和网络聚合中非常有用。但是需要注意的是使用 VLSM时,所采用的路由协议必须能够支持它,这些路由协议包括RIP2,OSPF,EIGRP,IS-IS和BGP。

2.不连续子网——同一主类网络下的若干连续子网被另一主类网络分隔开来。

不连续子网例子:

10.1.0.0/16 ----R1----11.1.0.0/16-----R2------10.2.0.0/16

10.1.1.0/24 ----R1----192.168.1.0/24-----R2------192.168.2.0/24-----R3------10.1.2.0/24

连续子网的例子:
10.1.0.0/16 ----R1----10.2.0.0/16-----R2------10.3.0.0/16

10.1.0.0/16 ----R1----10.2.0.0/16-----R2------11.1.0.0/16

 

 

 

 

VLSM

clip_image001

 

 

实验内容:

当R1.R2运行RIPV1时.R1不会发布LO 0.

R2:

Gateway of last resort is not set

192.168.1.0/27 is subnetted, 1 subnets

C 192.168.1.64 is directly connected, FastEthernet0/0

R2#

只能学习到直连路由,R1下的LO 0口无法获取

因为R1使用VER1 RIP.不支持VLSM.所发送的路由信息不包含掩码信息.

在R1.R2上启用VER2.学习正常

 

 

不连续子网

 

 

clip_image001[1]

屏幕剪辑的捕获时间: 2010/3/22, 1:52

在VER1配置时

R1不能收到R2LO 0口

R2也不能收到R1LO 0口

R2有发送路由更新给R1,但是R1没有应用

V2正常.

 

 

扩展

使用secondary address 实现支持不连续子网

 

 

clip_image001[3]

在V1上.由于路由器所发送的路由信息不包含子网信息.所以不连续的网段不能正常学习到

通过使用secondary address ,保证不连续网段间不会分割.

 

R1:

Gateway of last resort is not set

172.16.0.0/24 is subnetted, 1 subnets

C 172.16.1.0 is directly connected, Loopback0

C 192.168.1.0/24 is directly connected, FastEthernet0/0

R 192.168.2.0/24 [120/1] via 192.168.1.2, 00:00:13, FastEthernet0/0

R1#

R2:

Gateway of last resort is not set

172.16.0.0/24 is subnetted, 1 subnets

C 172.16.2.0 is directly connected, Loopback0

C 192.168.1.0/24 is directly connected, FastEthernet0/0

C 192.168.2.0/24 is directly connected, Serial0/0

R2#

R3:

Gateway of last resort is not set

172.16.0.0/24 is subnetted, 1 subnets

C 172.16.3.0 is directly connected, Loopback0

R 192.168.1.0/24 [120/1] via 192.168.2.1, 00:00:03, Serial0/0

C 192.168.2.0/24 is directly connected, Serial0/0

R3#

只有192.168能正常学习到

 

 

下面使用 secondary addresss 解决在V1 上运行不连续子网

R1:

R1(config-if)#ip add 172.16.4.1 255.255.255.0 secondary

R2:

R2(config-if)#ip add 172.16.4.2 255.255.255.0 se

R2(config-if)#ip add 172.16.5.1 255.255.255.0 se

R3:

R3(config-if)#ip add 172.16.5.2 255.255.255.0 se

使用连续网段的地址,这样能确保子网不会被分割,能正常传播

R1:

Gateway of last resort is not set

172.16.0.0/24 is subnetted, 6 subnets

C 172.16.4.0 is directly connected, FastEthernet0/0

R 172.16.5.0 [120/1] via 172.16.4.2, 00:00:07, FastEthernet0/0

R 172.16.0.0 [120/1] via 192.168.1.2, 00:00:07, FastEthernet0/0

C 172.16.1.0 is directly connected, Loopback0

R 172.16.2.0 [120/1] via 172.16.4.2, 00:00:07, FastEthernet0/0

R 172.16.3.0 [120/2] via 172.16.4.2, 00:00:07, FastEthernet0/0

C 192.168.1.0/24 is directly connected, FastEthernet0/0

R 192.168.2.0/24 [120/1] via 192.168.1.2, 00:00:07, FastEthernet0/0

[120/1] via 172.16.4.2, 00:00:07, FastEthernet0/0

R1#

路由表接受正常.依然会从R2上收到汇总信息,但不连续子网能正常访问,只是如果访问172.16不存在的子网.将会出现环路.

R2:

Gateway of last resort is not set

172.16.0.0/24 is subnetted, 6 subnets

C 172.16.4.0 is directly connected, FastEthernet0/0

C 172.16.5.0 is directly connected, Serial0/0

R 172.16.0.0 [120/1] via 192.168.2.2, 00:00:25, Serial0/0

[120/1] via 192.168.1.1, 00:00:18, FastEthernet0/0

R 172.16.1.0 [120/1] via 172.16.4.1, 00:00:18, FastEthernet0/0

C 172.16.2.0 is directly connected, Loopback0

R 172.16.3.0 [120/1] via 172.16.5.2, 00:00:25, Serial0/0

C 192.168.1.0/24 is directly connected, FastEthernet0/0

C 192.168.2.0/24 is directly connected, Serial0/0

R2#

跟R1一样.存在汇总信息.会出现环路.但是访问存在的子网是成功的

R3:

Gateway of last resort is not set

172.16.0.0/24 is subnetted, 6 subnets

R 172.16.4.0 [120/1] via 172.16.5.1, 00:00:09, Serial0/0

C 172.16.5.0 is directly connected, Serial0/0

R 172.16.0.0 [120/1] via 192.168.2.1, 00:00:09, Serial0/0

R 172.16.1.0 [120/2] via 172.16.5.1, 00:00:09, Serial0/0

R 172.16.2.0 [120/1] via 172.16.5.1, 00:00:09, Serial0/0

C 172.16.3.0 is directly connected, Loopback0

R 192.168.1.0/24 [120/1] via 192.168.2.1, 00:00:09, Serial0/0

[120/1] via 172.16.5.1, 00:00:09, Serial0/0

C 192.168.2.0/24 is directly connected, Serial0/0

R3#

一样存在

 

总结:用secondary address能保证不分割子网.在V1上能运行不连续子网.

 

至于产生的环路.,在Ver1上无法解决.因为这是汇总引起的,但是Ver1上是没有子网掩码这个概念,即使关闭自动汇总也无法解决