Re: all zeroes/all ones used in host IP's...

From: Michael H. Warfield (mhw@wittsend.com)
Date: Fri Jan 28 2000 - 15:39:14 EST


On Fri, Jan 28, 2000 at 12:44:51PM -0500, Mike A. Harris wrote:
> On another mailing list I'm on there is a small discussion about
> using "0's" in IP addresses. Nobody could categorically say
> wether or not they are allowed or not including myself, so I
> hunted down RFC 1123, and found the relevant section.

        I saw your message over on the Cartman list. I was getting some
references together before posting.

        Point #1: Your quotes are from RFC 1122, not RFC 1123. I'm
surprised no-one has corrected you on that yet.

        Point #2: Keep in mind that RFC 1122 is dated October 1989 and
pre-dates CIDR, Classless Inter-Domain Routing.

        Pertinent reading for CIDR can be found in RFC 1517 through
RFC 1520, dated around 1993. Particularly relevant information can be
found in RFC 1519.txt, especially in sections 7.2 Procedural changes for
class-A subnetting, and 7.1 Procedural changes for class-C "supernets",
but you have to read it with a mind toward interpretation and
implications. There is the strong implication in those RFC's that,
outside of "classful routing" environments (see some of the other RFC's
vis-a-vis mixed class-full and class-less routing environments) the
network class is dominated by the subneting mask, typically just referred
to as the network mask, now.

> Here it is:

> IP addresses are not permitted to have the value 0 or -1 for
> any of the <Host-number>, <Network-number>, or <Subnet-
> number> fields (except in the special cases listed above).
> This implies that each of these fields will be at least two
> bits long.

> Now I interpreted that as meaning that none of the octets in an
> IP address could be 0 or "-1" in either the network/subnet or
> host portions of a valid host IP. The definition of "-1" is "all
> ones" in the host or network/subnet portion.

        That interpretation is incorrect. The terms 0 and -1 apply to
the entire binary field, NOT to individual octets. In the case where
a network mask is 255.255.255.128, the -1 value for the host address is
127 if the network address ends in 0 or 255 if the network address ends
in 128. In the case of a /20 network (netmask 255.255.240.0) the
-1 value for the host field is 15.255. You would get the broadcast
address for that network by adding (or oring) that value into the network
address.

> I interpret the above as meaning that it is not legal to have a
> network like this:

> 192.168.0.0/24 or 23.0.0.0/24

        Not correct. I hold the Class B network 130.305. I have a subnet
of 130.205.0.0/24 operating within that network. My host, alcove, is
130.205.0.20. Perfectly legal and has been operating that way for years.

> with hosts 192.168.0.1 through 192.168.0.254 or with hosts
> 23.0.0.1 through 23.0.0.254.

        Not correct. Refer to the CIDR RFC's for further clarification
particularly vis-a-vis Class A subneting into CIDR conventions.
(Section 7.2 as mentioned above). They even give a specific example
with reverse DNS lookups for .0 subnets.

> The first zero makes it illegal no? Could someone in the know

        It does not.

> please clarify this as it has been bugging me for some time and
> nobody else seems to be able to say with 100% certainty what the
> proper rule is. Also, would a network like:

> 142.255.255.0/24 be illegal?

        No. Perfectly legal. Why would it be illegal? It is neither
illegal under the old class system (class B network 142.255 with hosts in
the range 255.1 through 255.254) or under the CIDR system with network address
142.255.255.0/24 with host addresses 1 - 254.

        Are you saying that it should be illegal because the field between
the old classful "Class B" mask of 255.255.0.0 and the subneted mask
(the netmask in CIDR terms) of 255.255.255.0 (the 0.0.255.0 subnet field)
is all ones? It MIGHT have been illegal 7 years ago in the days before
CIDR and after RFC 1122 was published, but I would seriously expect it
to work now. There are sites where it is in use and is expected to
operate perfectly well.

> Someone has suggested that my interpretation is wrong, and if
> that is indeed so, I'd like to know the proper interpretation and
> share it with everyone.

        You must look on the bit level or you will consistantly screw up
especially with subnets which are not on octet boundries! 0 and -1
have totally different meanings then as seen from the octet values.

        Example... We have an agragated CIDR block that is 208.21.0.0/21
We have that further subdivided with one subnet being 208.21.4.0/23.
That subnet has a network address of 208.21.4.0, a broadcast address
of 208.21.5.255 and a netmask of 255.255.254.0. The host address of
-1, in this case, is 1.255 (208.21.5.255). Not 0.255 (208.21.5.255).

> I looked through some of the kernel source and couldn't find any
> special handling of such addresses.

        Not surprising...

> Thanks very much in advance.
> Take care!
> TTYL

> --
> Mike A. Harris Linux advocate
> Computer Consultant GNU advocate
> Capslock Consulting Open Source advocate
>
> Join the FreeMWare project - the goal to produce a FREE program in
> which you can run Windows 95/98/NT, and other operating systems.
>
> http://www.freemware.org

        Mike

-- 
 Michael H. Warfield    |  (770) 985-6132   |  mhw@WittsEnd.com
  (The Mad Wizard)      |  (770) 331-2437   |  http://www.wittsend.com/mhw/
  NIC whois:  MHW9      |  An optimist believes we live in the best of all
 PGP Key: 0xDF1DD471    |  possible worlds.  A pessimist is sure of it!

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jan 31 2000 - 21:00:22 EST