子網(wǎng)掩碼及子網(wǎng)切割算法指南
舉例說明該算法。
例:給定一 class c address : 192.168.5.0 ,要求劃分20個(gè)子網(wǎng),每個(gè)子網(wǎng)5
個(gè)主機(jī)。
解:因?yàn)? <5 < 8 ,用256-8=248 ――>即是所求的子網(wǎng)掩碼,對(duì)應(yīng)的子網(wǎng)數(shù)
也就出來了。這是針對(duì)C類地址。老師也只講了針對(duì)C類地址的做法。下面是我自
己推出來的針對(duì)B類地址的做法。
對(duì)于B類地址,假如主機(jī)數(shù)小于或等于254,與C類地址算法相同。
對(duì)于主機(jī)數(shù)大于254的,如需主機(jī) 700臺(tái),50個(gè)子網(wǎng)(相當(dāng)大了),
512 < 700< 1024
256-(1024/256)=256-4=252 ――>即是所求的子網(wǎng)掩碼,對(duì)應(yīng)的子網(wǎng)數(shù)也就
出來了。
上面256-4中的4(2的2次冪)是指主機(jī)數(shù)用2進(jìn)制表示時(shí)超過8位的位數(shù),即超過
2位,掩碼為剩余的前6位,即子網(wǎng)數(shù)為2(6)-2=62個(gè)。
歡迎指正。
Append :Host/Subnet Quantities Table
----------------------------------------------------------------------
Class A Effective Effective
# bits Mask Subnets Hosts
------- --------------- --------- ---------
2 255.192.0.0 2 4194302
3 255.224.0.0 6 2097150
4 255.240.0.0 14 1048574
5 255.248.0.0 30 524286
6 255.252.0.0 62 262142
7 255.254.0.0 126 131070
8 255.255.0.0 254 65536
9 255.255.128.0 510 32766
10 255.255.192.0 1022 16382
11 255.255.224.0 2046 8190
12 255.255.240.0 4094 4094
13 255.255.248.0 8190 2046
14 255.255.252.0 16382 1022
15 255.255.254.0 32766 510
16 255.255.255.0 65536 254
17 255.255.255.128 131070 126
18 255.255.255.192 262142 62
19 255.255.255.224 524286 30
20 255.255.255.240 1048574 14
21 255.255.255.248 2097150 6
22 255.255.255.252 4194302 2
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.