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)
以上若有错误 还请大大指正.....