查看上述图象 ,您能发现使用的子网,NetA、NetC和NetD有很多未使用的主机地 址空间。这也许是一笔故意设计记帐为未来增长,但在许多 情况下这是浪费的地址空间由于这样的事实同样子网掩码为所有子 网使用。
可变长度子网掩码(VLSM) 允许您为每个子网使用不同的掩码,从而使用地址空间高效地。
VLSM示例
假使网络和需求和一 样在示例练习2 使用VLSM开发一个子网化机制。假使以下:
netA: must support 14 hosts
netB: must support 28 hosts
netC: must support 2 hosts
netD: must support 7 hosts
netE: must support 28 host
确定什么掩码将承认主机的所需数 量的。
netA: requires a /28 (255.255.255.240) mask to support 14 hosts
netB: requires a /27 (255.255.255.224) mask to support 28 hosts
netC: requires a /30 (255.255.255.252) mask to support 2 hosts
netD*: requires a /28 (255.255.255.240) mask to support 7 hosts
netE: requires a /27 (255.255.255.224 mask to support 28 hosts
* a /29 (255.255.255.248) would only allow 6 usable host addresses
therefore netD requires a /28 mask.
最简单的方法分配子网将开 始分配最大一。因此,您能分配以以下方式。
netB: 204.15.5.0/27 host address range 1 to 30
netE: 204.15.5.32/27 host address range 33 to 62
netA: 204.15.5.64/28 host address range 65 to 78
netD: 204.15.5.80/28 host address range 81 to 94
netC: 204.15.5.96/30 host address range 97 to 98
这可以用图形表示如下。
从上述图象您更比地址空间的一半如何能发现使用被帮助的 VLSM保存。
CIDR
在互联网引入无类别域内路由(CIDR)改进地址空间利用和路由可扩 展性。它是需要的由于互联网的在互联网路由器拿着的IP路 由表的快速增长和增长。
CIDR从传 统IP类(A类、B类、C类等等) 移动方式。在CIDR,IP网络由 前缀表示,是IP地址和掩码的长度某个征兆。长度意味着设 置到一个最左边的连续掩码位的数量。网络 172.16.0.0 255.255.0.0可以所以表示作为172.16.0.0/16。 CIDR也表示一个更加层次化的互联网体系结构,每个域其中 采取其IP地址从一更高的水平。这允许域的总结执行在更高 的水平。例如,如果ISP 拥有网络172.16.0.0/16,然后ISP 能为用户提供172.16.1.0/24,172.16.2.0/24等等。然而, 当做通告对其他提供商,仅ISP需要做通告172.16.0.0/16时。
欲知关于CIDR的更多信息,请参阅 RFC 1518 和 RFC 1519 。
附录
示例配置
路由器A和B通过串行接口连接。
路由器 A
hostname routera
!
ip routing
!
int e 0
ip address 172.16.50.1 255.255.255.0
!(subnet 50)
int e 1 ip address 172.16.55.1 255.255.255.0
!(subnet 55)
int t 0 ip address 172.16.60.1 255.255.255.0
!(subnet 60) int s 0
ip address 172.16.65.1 255.255.255.0 (subnet 65)
!S 0 connects to router B
router rip
network 172.16.0.0
路由器B
hostname routerb
!
ip routing
!
int e 0
ip address 192.1.10.200 255.255.255.240
!(subnet 192)
int e 1
ip address 192.1.10.66 255.255.255.240
!(subnet 64)
int s 0
ip address 172.16.65.2 (same subnet as router A''s s 0)
!Int s 0 connects to router A
router rip
network 192.1.10.0
network 172.16.0.0
Host/Subnet数量表
Class B Effective Effective
# bits Mask Subnets Hosts
------- --------------- --------- ---------
2 255.255.192.0 2 16382
3 255.255.224.0 6 8190
4 255.255.240.0 14 4094
5 255.255.248.0 30 2046
6 255.255.252.0 62 1022
7 255.255.254.0 126 510
8 255.255.255.0 254 254
9 255.255.255.128 510 126
10 255.255.255.192 1022 62
11 255.255.255.224 2046 30
12 255.255.255.240 4094 14
13 255.255.255.248 8190 6
14 255.255.255.252 16382 2
Class C Effective Effective
# bits Mask Subnets Hosts
------- --------------- --------- ---------
2 255.255.255.192 2 62
3 255.255.255.224 6 30
4 255.255.255.240 14 14
5 255.255.255.248 30 6
6 255.255.255.252 62 2
*Subnet all zeroes and all ones excluded.
*Host all zeroes and all ones excluded.
转载地址:http://www.net130.com/CMS/Pub/Tech/tech_config/211855.htm