11111111.11111111.11111111.00000000
^^^^^^^^^^^^^^^^^^^ ----------------Rang範圍 0~255
Network Address Host Address
表示在同一段Network內,有0~255的Host Address
11111111.11111111.11111111.10000000
^^^^^^^^^^^^^^^^^^^^^ ---------------Rang範圍0~127
Network Address Host Address
表示在同一段Network內,有0~127的Host Address
11111111.11111111.11111111.11100000
^^^^^^^^^^^^^^^^^^^^^^ ---------------Rang範圍0~31
Network Address Host Address
表示在同一段Network內,有0~31的Host Address
((Netmask要點))
1.網路位置(Network Address)必為連續的1
00000000 (2) 0 (10)
10000000 128
11000000 192
11100000 224
11110000 240
11111000 248
11111100 252
11111110 254
11111111 255
2.CIDR值 (看網路位置有多少個連續的1)
255.255.255.0 ==> CIDR=24
255.255.255.252 ==> CIDR=30
192.168.2.100/255.255.255.0 與 192.168.2.100/24 是相同的
CIDR=20
=>255.255.240.0
CIDR=25
=>255.255.255.128
若IP/Netmask 192.168.2.100/24
求IP Range
IP Range = 192.168.2.0 ~ 192.168.2.255
若IP/Netmask 192.168.2.100/25
求IP Range
IP Range = 192.168.2.0 ~ 192.168.2.127
Netmask: 255.255.255.0 => host:256
255.255.255.128 => host:128
255.255.255.192 => host:64
255.255.255.224 => host:32
255.255.255.240 => host:16
IP Range
第一個IP位置稱為網路位置(Network)
最後一個IP位置稱為廣撥位置(Broadcast)
Network及Broadcast位置不可拿來使用
ex:
168.32.1.9/25
可用IP = 128-2=126
172.60.2.90/29
可用IP = 8-2=6
實例
((HUB連接A與B)) netmask=255.255.255.0
A B
IP 192.168.2.100 192.168.2.200
Netmask 255.255.255.0 255.255.255.0
Network 192.168.2.0 192.168.2.0
IP: 192.168.2.100(10) = 11000000.10101000.00000010.01100100(2)
Netmask: 255.255.255.0(10) = 11111111.11111111.11111111.00000000(2)
-----------------------------------------------------------------------------------------
Network: 192.168.2.0(10) = 11000000.10101000.00000010.00000000(2)
((AND運算法))
IP 192(10) 11000000(2)
Netmask AND 255(10) 11111111(2)
---------------------------------------------------
Network 192(10) 11000000(2)
((HUB連接A與B)) netmask=255.255.255.128
A B
IP 192.168.2.100 192.168.2.200
Netmask 255.255.255.128 255.255.255.128
Network
192.168.2.0 192.168.2.128 <==將無法直接連線
IP: 192.168.2.100(10) = 11000000.10101000.00000010.01100100(2)
Netmask: 255.255.255.128(10) = 11111111.11111111.11111111.10000000(2)
-----------------------------------------------------------------------------------------
Network: 192.168.2.0(10) = 11000000.10101000.00000010.00000000(2)
IP: 192.168.2.200(10) = 11000000.10101000.00000010.11001000(2)
Netmask: 255.255.255.128(10) = 11111111.11111111.11111111.10000000(2)
-----------------------------------------------------------------------------------------
Network: 192.168.2.128(10) = 11000000.10101000.00000010.10000000(2)
以上若有錯誤 還請大大指正.....