谁说子网掩码的1必须连续?关于像255.255.0.255这样的非连续子网掩码

      百度上搜索的都是说255.255.0.255的掩码不合法,其实这些人没有读过RFC,也就大惊小怪了;RFC950的内容:

    A Class C Network Case (illustrating non-contiguous subnet bits)

For this case, assume that the requesting host is on class C
network 192.1.127.0, has address 192.1.127.19, that there is a
gateway at 192.1.127.50, and that on network an 3-bit subnet field
is in use (01011000), that is, the address mask is 255.255.255.88.

The host sends the ICMP request to 255.255.255.255:

Source address: 192.1.127.19
Destination address: 255.255.255.255
Protocol: ICMP = 1
Type: Address Mask Request = AM1
Code: 0
Mask: 0
//19的二进制是00010011;88的二进制是01011000;AND的结果是00010000

The gateway can then respond directly to the requesting host.

Source address: 192.1.127.50
Destination address: 192.1.127.19
Protocol: ICMP = 1
Type: Address Mask Reply = AM2
Code: 0
Mask: 255.255.255.88.
//50的二进制是00110010;88的二进制是01011000;AND的结果是00010000,所以这两个机器在一个子网内,destination address直接就是192.1.127.19

In the diskless workstation case the host sends:

Source address: 0.0.0.0
Destination address: 255.255.255.255
Protocol: ICMP = 1
Type: Address Mask Request = AM1
Code: 0
Mask: 0

192.1.127.50 will hear the datagram, and should respond with this
datagram:

Source address: 192.1.127.50
Destination address: 255.255.255.255
Protocol: ICMP = 1
Type: Address Mask Reply = AM2
Code: 0
Mask: 255.255.255.88.
Read more: http://www.faqs.org/rfcs/rfc950.html#ixzz0VE0qJANw
另外一篇:
相信读过TCP-IP详解的都知道这个问题,位于中文版vol 1 004里面
10. (3.5) Is the subnet mask 255.255.0.255 valid for a class A address? See
RFC 1219 [Tsuchiya 1991] for more info. This is available from the
Networking I web page, as well as from the usual sources.
It's valid and it's called a noncontiguous subnet mask since the 16 bits for
the subnet mask are not contiguous. The RFC's, however, recommend against
using noncontiguous subnet masks.
//看到没,只是反对使用,没说不连续的子网掩码是非法的
在RFC 950 - Internet Standard Subnetting Procedure中:
Since the bits that identify the subnet are specified by a bitmask, they need not be adjacent in the address. However, we recommend that the subnet bits be contiguous and located as the most significant bits of the local address
RFC-950 [2] specifies a procedure for subnetting Internet addresses using a bit-mask.  While RFC-950 allows the "ones" in the subnet mask to be non-contiguous, RFC-950 recommends that 1) they be contiguous, and 2) that they occupy the most significant bits of the "host" part of the internet address.

你可能感兴趣的:(通信技术)