问题原文
原帖链接 · 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).
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
