大网数据广告活动
服务器运维问答

What does the netmask in an IP address actually tell you?

· 52CE 我爱测

There are several questions out there asking what the CIDR netmask is, and how it's calculated. But after reading all the top answers, I'm still left wondering, how does the netmask let us distinguish two IP addresses? For exampl…

问题原文

原帖链接 · CodyBugstein · CC BY-SA 3.0

There are several questions out there asking what the CIDR netmask is, and how it's calculated. But after reading all the top answers, I'm still left wondering, how does the netmask let us distinguish two IP addresses?

For example, if I give you addresses:

  • 25.47.130.1 /32
  • 25.47.130.1 /8

I don't see how these are two different addresses just because you added a more specific "sub group" to one. They are (or seem to be) the same IP address!

To me this seems the equivalent to providing two ways to describe "Bob's House" but claiming they are different locations, for example

  • Bob's House / New York City
  • Bob's House / Brooklyn

Both addresses are exactly the same. They both refer to the same house. It's irrelevant that in one of the "masks" you narrowed it down to the smaller sub-location.

I hope someone understands what I am struggling to understand, and doesn't mark this as a duplicate. I have not found a similar question or answer that addresses this confusing aspect.

已采纳解答

原帖链接 · Mikhail Khirgiy · CC BY-SA 3.0

You can aggregate networks to one by using more little mask. It is used only for routing or in firewall rules. By example:

25.0.0.0/8 - NewYork

25.47.0.0/16 - Brooklyn

25.47.130.0/24 - Bob's house or campus

25.47.130.1/32 - Bob.

This isn't used in real networks. By example Bob got the 25.47.130.1/24 IP address in 25.47.130.0/24 network. It can connect directly (without routing) to any IP address from this network. But it can't directly connect to 25.47.131.1/8 because this IP address isn't from Bob's network 25.47.130.0/24. That is why Bob's computer will send packets to 25.47.131.1/8 via gateway host (router).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-03-22)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。