首页 > 编程知识 正文

b类地址最后一个可指派的网络号,B类地址的网络号

时间:2023-05-04 22:48:22 阅读:258931 作者:4393

转载自知乎
这是个不错的问题,发现网络就是有很多细节的地方容易忽略。至少这个问题我之前并没有特别注意过,但是当看到了之后发现竟然一时答不上来。

关于全0和全1,以前就是关注子网的主机位地址,分别代表子网的网络号和广播地址。但是网络地址全0是怎么回事缺忽略了。

维基百科上关于分类网络的内容中都没有详细说明

https://zh.wikipedia.org/zh/分类网络

然后查了 RFC 791 - Internet Protocol

在Page24 有这样一个说明

Address Formats:

High Order Bits Format Class --------------- ------------------------------- ----- 0 7 bits of net, 24 bits of host a 10 14 bits of net, 16 bits of host b 110 21 bits of net, 8 bits of host c 111 escape to extended addressing mode

最早的RFC对IP地址的分类只到C,并将IP地址中的Bit分为三类,分别是High order, net, host。

然后更为关键的是下面的一句话

A value of zero in the network field means this network.

也就是说net全0表示本网络,因此真正可用的net值应该是从1开始。

那么这样说来因为这条规则而无法使用的网络号是:

A: 0.0.0.0/8

B: 128.0.0.0/16

C: 192.0.0.0/24

根据RFC791说明的标注继续在RFC 790 - Assigned numbers中找到了更为详细的说明

Class A Networks

Internet Address Name Network References ---------------- ---- ------- ---------- 000.rrr.rrr.rrr Reserved [JBP]

Class B Networks

Internet Address Name Network References ---------------- ---- ------- ---------- 128.000.rrr.rrr Reserved [JBP]

A类和B类地址都明确说了0.x.x.x及128.0.x.x都是保留地址,而在C类中应该是RFC文档出现了明显的错误,因为192.000.001开头的地址不可能同属两行,显然这里要说明的是192.0.0.x也是保留地址。

Class C Networks

Internet Address Name Network References ---------------- ---- ------- ---------- 192.000.001.rrr Reserved [JBP] 192.000.001.rrr-223.255.254.rrr Unassigned [JBP]

没有继续考证三十几年前的这个规则是否被其他文档所修改,但是如果说wwdjqm的书里是这样写的,那么我想参考的依据应该就是这个。

我只是考证了来源,但是不代表这个规则现在仍然是正确的。

因为我在APNIC的whois数据库里查了一下128.0.0.1这个地址,发现128.0.0.1-128.0.0.255这段地址已经有明确的归属,国家是NL。而后面128.0.1.0/24这段同样也分掉了,国家是RO。

而192.0.0.1这个地址查出来是没有被分配的。

可以用下面这个链接自己看一下:

APNIC - Query the APNIC Whois Database

我猜测是因为192.0.0不能用只浪费了一个C,而128.0不能用,却整整浪费了一个B,在IPv4地址紧缺的情况下无疑有些过于浪费了。而当时这个网络位全0的问题实际上在子网掩码出现后已经解决,并没有实际的意义,所以就重新把128.0这段地址放出来了。

再次更新,终于找到了最准确的答案。

在 RFC 3330 - Special-Use IPv4 Addresses 里有关于这两段地址的明确说明

128.0.0.0/16 - This block, corresponding to the numerically lowest of
the former Class B addresses, was initially and is still reserved by
the IANA. Given the present classless nature of the IP address
space, the basis for the reservation no longer applies and addresses
in this block are subject to future allocation to a Regional Internet
Registry for assignment in the normal manner.

192.0.0.0/24 - This block, corresponding to the numerically lowest of
the former Class C addresses, was initially and is still reserved by
the IANA. Given the present classless nature of the IP address
space, the basis for the reservation no longer applies and addresses
in this block are subject to future allocation to a Regional Internet
Registry for assignment in the normal manner.

这个RFC发表于2002年,对于这两段地址明确表示因为无类地址空间的原因,不再需要保留,地址将在今后进行分配。

所以如果说你看的那本wwdjqm的书如果是2002年以后出版的或者更新的,那么就是书存在更新不及时的问题,没有按照IETF最新的RFC的要求进行更改。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。