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

查看:504
本文介绍了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's valid inasmuch as it contains four octets, each within the range 0 through 255 inclusive. However, it's not usable as a real IP address.

RFC1700 (a)声明 0.0.0.0/8 0.< anything>。< anything>。< anything> )仅作为源地址保留。您可以进入看似您拥有此地址的情况,但这通常是因为没有为您分配地址(例如,通过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天全站免登陆