0.0.0.0 是有效的 IP 地址吗? [英] Is 0.0.0.0 a valid IP address?

查看:60
本文介绍了0.0.0.0 是有效的 IP 地址吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

0.0.0.0 是有效的 IP 地址吗?我希望我的程序能够将它存储为没有地址正在使用的指示,但如果它实际上有效,这将不起作用.

Is 0.0.0.0 a valid IP address? I want my program to be able to store it as an indication that no address is in use, but this won't work if it's actually valid.

推荐答案

有效,因为它包含四个八位字节,每个八位字节都在 0 到 255 的范围内.但是,它不能使用作为真实的 IP 地址.

It is valid inasmuch as it contains four octets, each within the range 0 through 255 inclusive. However, it is not usable as a real IP address.

RFC1700 (a) 指出 0.0.0.0/8 (0...) 仅作为源地址保留.您可能会遇到看起来您拥有此地址的情况,但这通常是因为尚未为您分配地址(例如,通过 DHCP).

RFC1700 (a) states that 0.0.0.0/8 (0.<anything>.<anything>.<anything>) is reserved as a source address only. You can get into situation where it appears you have this address but that's normally because no address has been assigned to you (by DHCP, for example).

另请参阅有关 IPv4 的维基百科条目.

(a) 虽然这个 RFC 现在被认为已经过时,但它在给定的行为方面仍然是正确的.它的替代品,https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml,仍然有详细说明 0.0.0.0 地址使用的相同文本.

(a) Although this RFC is now considered obsolete, it is still correct in terms of the given behaviour. Its replacement, https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml, still has the same text detailing use of the 0.0.0.0 address.

这篇关于0.0.0.0 是有效的 IP 地址吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆