我一直在努力理解子网划分。我正在尝试找到 42.128.188.148 /21 的网络、可用主机范围和广播。
所以我写出了数字 128、64 等……并对齐了我的二进制网络和主机位。据我所知:/21 表示我们在从左边数第三个八位字节上操作。所以我将二进制、网络和主机位与数字表 128-1 对齐。它告诉我有 8 个子网 248 - 255;其中 248 是网络,255 是广播,第一个主机 = 248(网络位)加上 1(主机位)= 249。
我肯定做错了,因为当我将原始 IP 地址和 CIDR 插入子网计算器时,它显示第一个可用主机 42.128.184.1 ...?为什么最后一个八位字节变为 1?第三个八位字节难道不应该一直增加 1 直到到达广播吗?
答案1
您的地址为42.128.188.148
,CIDR 为 ,/21
您的子网掩码为255.255.248.0
。当您对您的地址和子网掩码进行 AND 运算时,您将获得42.128.184.0
哪个是您的网络地址,不能用作主机地址。
00101010.10000000.10111100.10010100 = 42.128.188.148
AND 11111111.11111111.11111000.00000000 = 255.255.248.0
____________________________________
00101010.10000000.10111000.00000000 = 42.128.184.0
第一个主机将是网络的下一个可用地址:42.128.184.1
。
它告诉我有 8 个子网 248 - 255;其中 248 为网络,255 为广播,第一个主机 = 248(网络位)加上 1(主机位)= 249。
您已使用了第 3 个八位字节中的 5 位,还剩下 3 位。2^3 = 8 subnets
现在,将剩余的位增加 1。
00101010.10000000.10111000.00000000 = 42.128.184.0 1st network
00101010.10000000.10111001.00000000 = 42.128.185.0 .
00101010.10000000.10111010.00000000 = 42.128.186.0 .
00101010.10000000.10111011.00000000 = 42.128.187.0 .
00101010.10000000.10111100.00000000 = 42.128.188.0 .
00101010.10000000.10111101.00000000 = 42.128.189.0 .
00101010.10000000.10111110.00000000 = 42.128.190.0 .
00101010.10000000.10111111.00000000 = 42.128.191.0 8th network
所有子网地址、子网掩码、第一个主机、最后一个主机和广播地址将是:
1st network: 42.128.184.0 Subnet mask: 255.255.248.0
1st host: 42.128.184.1 last host: 42.128.184.254 Broadcast address: 42.128.184.255
2nd network: 42.128.185.0 Subnet mask: 255.255.249.0
1st host: 42.128.185.1 last host: 42.128.185.254 Broadcast address: 42.128.185.255
3rd network: 42.128.186.0 Subnet mask: 255.255.250.0
1st host: 42.128.186.1 last host: 42.128.186.254 Broadcast address: 42.128.186.255
4th network: 42.128.187.0 Subnet mask: 255.255.251.0
1st host: 42.128.187.1 last host: 42.128.187.254 Broadcast address: 42.128.187.255
5th network: 42.128.188.0 Subnet mask: 255.255.252.0
1st host:42.128.188.1 last host:42.128.188.254 Broadcast address: 42.128.188.255
6th network: 42.128.189.0 Subnet mask: 255.255.253.0
1st host: 42.128.189.1 last host: 42.128.189.254 Broadcast address: 42.128.189.255
7th network: 42.128.190.0 Subnet mask: 255.255.254.0
1st host: 42.128.190.1 last host: 42.128.190.254 Broadcast address: 42.128.190.255
8th network: 42.128.191.0 8th network Subnet mask: 255.255.255.0
1st host: 42.128.191.1 last host: 42.128.191.254 Broadcast address: 42.128.191.255