子网内主机数量
有谁知道需要多少主机位才能保证一个子网可以有 9 个可用主机?
我本来想4岁左右,但不确定。 有人可以解释一下吗?
Does anyone know how many host bits are needed to guarantee that a subnet could have 9 usable hosts?
I was thinking about around 4, but I'm not sure. Can some shed some light on this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
以下是满足要求的网络 192.168.1.0 /28
Here are networks that meet the requirement 192.168.1.0 /28
我们可以通过两种方法计算主机位数:
因此将 9 转换为二进制我们有 00001001。
现在,
从右向左数,直到最后一个位
所以进入 00001001 我们最后的位为 1
获取借用位直到最后一个位,即
现在为 4,因为如果我们计算类 c ,则默认子网掩码为
255.255.255.00000000
现在,为了计算,我们关闭这些位,对于网络,我们关闭该位,
因此对于主机,从右到左关闭 4 位,其余的左边位。
这里 4 是之前计算的借位位
255.255.255.11110000
现在只取子网掩码的最后一位,
增量值为 16
注意:增量值是从左到右按最后一位计算的。
所以我们将有一个 128+64+32+16= 240 的网络
对于“C”类,我们有 192.168.1.0/28 或 192.168.1.0 255.255.255.240
主机号:192.168.1.0
192.168.1.16
这是第一个网络,这里我们有 192.168.1.0 作为网络 IP,192.168.1.15 作为广播 IP
,因此从 192.168.1.1 到 192.168.1.14 是可用的 IP 或主机,计算出 14 个可用主机。
第二种方法
我们有计算主机的公式为 2^(n)-2
这里 n 是来自第一种方法的关闭位,
我们关闭位的数量是 4
,所以 2^4 - 2= 16-2 = 14
因此我们将得到一个 14 个可用主机的插槽,从中我们可以使用 9 个
注意:网络类上面只是一个例子,对增量位计算没有任何影响。类似地,我们可以对A类和B类进行计算
We can calculate number of host bit by 2 methods:
So converting 9 into binary we have 00001001.
Now,
count from right to left now, till the last on bit
so into 00001001 we have last on bit at 1
get the borrow bit till last on bit, that is 4
now for if we are calculating for class c , than the default subnet mask is
255.255.255.00000000
Now for calculation we off the bits where as for network we on the bit
so for host off 4 bits from right to left and on the rest left bits.
here 4 is the borrow bit that was calculated earlier
255.255.255.11110000
now taking only the last bit of subnet mask,
the increment value is 16
Note: increment value is calculated as last on bit from left to right.
so we will have a network of 128+64+32+16= 240
for class 'C' we have 192.168.1.0/28 or 192.168.1.0 255.255.255.240
number of host: 192.168.1.0
192.168.1.16
this is the first network, here we have 192.168.1.0 as network IP and 192.168.1.15 as broadcast IP
so from 192.168.1.1 to 192.168.1.14 are the usable IP or host that claculates to 14 usable host.
2nd method
we have the formula of claculating the host as 2^(n)-2
here n are off bits
from the 1st method we have number of off bit is 4
so 2^4 - 2= 16-2 = 14
hence we will get a slot of 14 usable host from which we can use 9
NOTE: The network class taken above is just an example which does not have any effect on increment bit calculation.Similarly we can calculate for class A and B
两个子网地址(全 1 和全 0)不能用于指示主机,因此使用 N 位,您最多可以获得
(2**N - 2)
个可用主机。 因此,对于 9 个主机,4 位是正确的:最多可以处理 14 个主机,但 3 位只能处理 6 个主机。Two subnet addresses (all-ones and all-zeros) can't be used to indicate a host, so with N bits you get up to
(2**N - 2)
usable hosts. So, for 9 hosts, 4 bits is correct: it would do up to 14, but 3 bits would do only 6 hosts.