简体   繁体   English

为什么我们不能使用 192.168.1 作为子网掩码

[英]Why can't we use 192.168.1 as the subnet mask instead

This is a general question about Subnet Masks.这是关于子网掩码的一般问题。

Preface前言

Most of our private networks are on 192.168.1.xxx/24 The Subnet mask will be 255.255.255.0.我们的大部分专用网络都在 192.168.1.xxx/24 上,子网掩码将为 255.255.255.0。 This is the default configuration of any router you go buy at Best Buy.这是您在 Best Buy 购买的任何路由器的默认配置。

The Actual Question实际问题

Here's what I'm wondering: Why wouldn't the subnet mask be 192.168.1.0 instead of 255.255.255.0这就是我想知道的:为什么子网掩码不是 192.168.1.0 而不是 255.255.255.0

Assume your ip address is 192.168.1.14假设你的 IP 地址是 192.168.1.14

If you 'logical and' the 192.168.1.0 subnet mask with your ip address, you will get the same results as if you 'logical and' it with a 255.255.255.0 subnet mask.如果您使用 IP 地址“逻辑和”192.168.1.0 子网掩码,您将获得与使用 255.255.255.0 子网掩码“逻辑和”相同的结果。

A subnet mask of 192.168.1.0 would be more descriptive than 255.255.255.0. 192.168.1.0 的子网掩码比 255.255.255.0 更具描述性。 This is because, a subnet mask of 255.255.255.0 would apply to thousands more potential subnets, a subnet mask of 192.168.1.0 would apply to fewer.这是因为,子网掩码 255.255.255.0 将应用于数千个潜在子网,而子网掩码 192.168.1.0 将应用于更少的潜在子网。 Also, a convention where you use a subnet mask like 192.168.1.0 for an ip address of 192.168.1.14 would be much easier to read.此外,对于 192.168.1.14 的 IP 地址使用子网掩码(如 192.168.1.0)的约定会更容易阅读。

So, why isn't the subnet mask for common private networks, 192.168.1.0?那么,为什么公网的子网掩码不是192.168.1.0呢? Why don't we use more specific subnet masks?为什么我们不使用更具体的子网掩码?

Thanks,谢谢,

Because the specification in section 3.1 of RFC4632 says the masks must have continuous set of 1 bits.因为RFC4632 的第 3.1 节中的规范说掩码必须具有连续的 1 位集。

Of course this doesn't really answer the question in any other way than "because it was decided so."当然,除了“因为它是这样决定的”之外,这并没有真正以任何其他方式回答这个问题。 You can still think about it: what benefit would it bring?你还可以想一想:它会带来什么好处? Netmask 255.255.255.0 shows the subnet size of exactly.网络掩码 255.255.255.0 准确显示了子网大小。 What size would mask 192.168.1.0 be?掩码 192.168.1.0 的大小是多少? How would you describe net mask 255.255.255.192 when the network starts with 192.168.1.0?当网络以 192.168.1.0 开头时,您如何描述网络掩码 255.255.255.192? Impossible.不可能的。

Also it's a lot easier to say /24 or /27 when the masks are like this.当面具是这样时,说 /24 或 /27 也容易得多。

So in short: they're unambiguous and show the actual size regardless the network address.简而言之:它们是明确的,并且无论网络地址如何都显示实际大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM