IP地址中的0
我无法理解 IP 地址,特别是其中包含 0 的 IP 地址。
据我了解,主机 ID 全 0 的 IP 地址是指网络,例如 128.52.0.0/16
。
IP地址的网络ID中是否有0仍然有效?例如 128.52.0.1
和子网掩码 255.255.255.0
。
IP地址的主机ID是否可以包含0并且仍然有效?例如 128.52.0.1
和子网掩码 255.255.0.0
。
另外,出于某种原因,我认为网络 ID 为 0 的 IP 地址是指具有同一网络上的主机 ID 的主机。例如,子网掩码为 255.255.255.0
的网络 192.168.1.0
上的 0.0.0.1
指的是 192.168.1.1
。这是正确的吗?
I am having trouble understanding IP addresses, specifically ones with 0s in them.
I understand that an IP address with all 0s for the Host ID refers to the network, such as 128.52.0.0/16
.
Can the network ID of an IP address have 0s in it and still be valid? E.g. 128.52.0.1
with subnet mask 255.255.255.0
.
Can the host ID of an IP address have 0s in it and still be valid? E.g. 128.52.0.1
with subnet mask 255.255.0.0
.
Also, for some reason I got it into my head that IP addresses with 0s for the network ID refers to the host with the host ID on the same network. E.g. 0.0.0.1
on network 192.168.1.0
with subnet mask 255.255.255.0
refers to 192.168.1.1
. Is this correct?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的。网络 ID 的八位字节为零是完全可以的。
是的。主机 ID 具有零个八位字节是完全可以的,尽管您应该意识到全零位主机 ID 是按照约定保留的,意味着引用整个网络(就像全一位的主机 ID 一样)主机 ID 被保留为广播地址,旨在引用网络上的每个主机)。
这是正确的,根据 RFC5735,
0.0.0.0/8
用于自我识别:约定是使用全 1 位来表示每个“对象”,并使用全 0 位来表示该“对象”。引用道格拉斯·E·科默 (Douglas E. Comer) 的《Internetworking with TCP/IP》:
它在“常规”世界中可能不会被广泛使用,因为 BOOTP 和 DHCP 在尚不知道其网络 ID 的情况下都使用有限广播变体(全为 1 位)。但是,由于 RFC 尚未过时,我想它仍然有效。
Yes. It's perfectly okay for the network ID to have a zero octet.
Yes. It's perfectly okay for the host ID to have a zero octet although you should be made aware that the all-zero-bit host ID is reserved by convention, meant to refer to the network as a whole (just like the all-one-bit host ID is reserved as a broadcast address, meant to refer to every single host on the network).
This is correct,
0.0.0.0/8
is used for self-identification according to RFC5735:The convention is to use all-one-bits to mean every "object" and all-zero-bits to mean this "object". Quoting from
"Internetworking with TCP/IP", Douglas E. Comer
:It may not be used that much in the "regular" world since both BOOTP and DHCP use the limited broadcast variant (all one bits) in situations where they don't yet know their network ID. But, since the RFC hasn't been obsoleted, I guess it's still valid.
128.52.0.1 只是 128.52.0.0/16 网络上的一个 IP 地址。本例中的网络 ID 为 128.52.0.0。然而,子网掩码是 255.255.0.0。掩码255.255.255.0对应于/24子网。
你的最后一段似乎是正确的。
128.52.0.1 is just an ip address on 128.52.0.0/16 network. Network id in this case is 128.52.0.0. Subnetmask, howerver, is 255.255.0.0. Mask of 255.255.255.0 corresponds to /24 subnet.
Your last paragraph seems correct.