2012-10-21

如何換算IP子遮罩(Subnet切割表示法)?

Q1.IP若為140.129.3.32/23 及140.129.3.37/28
它的:Network AddressBroadcost Address各為多少?如何計算?
A1.)
a.)140.129.3.32/23

10001100.10000001.00000011.00100000       IP轉換二進制
11111111 11111111 11111110 00000000       mask
=================================加以AND計算
10001100.10000001.00000010.00000000        求出NET ID:140.129.2.0

10001100.10000001.00000011.00100000        IP轉換二進制 

00000000 00000000 00000001 11111111        將mask做OR
=================================加以AND計算
00000000 00000000 00000001 00100000        求出Host ID:0.0.1.32

10001100.10000001.00000011.00100000        IP轉換二進制 

00000000 00000000 00000001 11111111        將mask做NOT
=================================加以OR計算
10001100.10000001.00000011.11111111        求出Broadcost Address:140.129.3.255




b.)140.129.3.37/28


10001100.10000001.00000011.00100101        IP轉換二進制 
11111111 11111111 11111111 11110000        mask
=================================加以AND計算
10001100.10000001.00000011.00100000        求出NET ID:140.129.3.32


10001100.10000001.00000011.00100101        IP轉換二進制 
00000000 00000000 00000000 00001111        將mask做OR
=================================加以AND計算
00000000 00000000 00000000 00000101        求出Host ID:0.0.0.5

10001100.10000001.00000011.00100101        IP轉換二進制
00000000 00000000 00000000 00001111         
將mask做NOT
==================================加以OR計算
10001100.10000001.00000011.00101111         
求出Broadcost Address:140.129.3.47


Q2.若IP為140.129.13.23/19 -範圍如下時:140.129.0.0~140.129.50.254,
會分成幾組網段?
A2.
140.129.13.23/19
11111111 11111111 11100000 00000000    mask=255.255.224.0
256-224=32
網段分佈
140.129.0.0~140.129.31.0
140.129.32.0~140.129.63.0
140.129.64.0~140.129.95.0
140.129.96.0~140.129.127.0
140.129.128.0~140.129.159.0
140.129.160.0~140.129.191.0
140.129.192.0~140.129.223.0
140.129.224.0~140.129.256.0
所以範圍內共有2組網段。



參考網址:Study-Area

沒有留言:

張貼留言

Related Posts Plugin for WordPress, Blogger...