Barry Smith wrote:
> Hello. I've been reading the "Linux Network Administrator's Guide,"
and I
> don't understand how it defines Class B networks. For a Class B, the
first
> two octets are for the network. These are 128.0.0.0 through
191.255.0.0.
> According to the Guide, "This class allows for 16,320 nets with
65,024 hosts
> each." Why is it 16,320 and 65,024? I'm sure I must be missing
something,
> but when I try to figure this out, to get the total networks, I
subtract 128
> from 191 in the first octets: so 191-128=63. For the second octet,
there are
> 256 possibilities (though not really, b/c you can't use 0 and 255 in
these
> calculations?). But anyway, if I assume 256, then the possible
networks are
> 63*256=16,128 networks - which is 192 networks less than the figure
from
> guide. And for the number of hosts, wouldn't it be 256 squared, the
last
> two octets multiplied, for 65,536 hosts, rather than the number
65,024
> given in the Guide? What am I doing wrong here - I find contradictory
> figures when I google this. In a Google search, some results confirm
the
> Guide, some confirm my calculations.
I think I've seen various speculations of why these numbers appear in
the NAG.
They are "wrong".
Class B networks (16 bit network portion) have the first two bits
predetermined (1,0) which leaves 14 bits for the network designation.
2^14=16,384 possible networks
http://www.faqs.org/rfcs/rfc1166.html
16 bits used to designate individual hosts, so 2^16=65,536 possible
addresses for _each_ network.
Each network "reserves" two "host" portion numbers x.x.0.0 (the network
address) and x.x.255.255 (broadcast address), so for 16,384 networks,
16,384*2=32,768 possible addresses that have been "reserved" from the
total possible net*host Class B addresses.
Each Class B network has 65,536-2=65,534 possible host addresses.
I clarrified the host portion because of this:
http://www.tldp.org/HOWTO/IP-Subnetworking-3.html#ss3.3
[q]
.... with each network containing up to 32,766(sic) possible interfaces.
[eq]
Go figure ;-)
In all these cases I _speculate_ that the writer was doing this with
dotted decimal/quad notation. IP addresses are 32 _bits_ with a
"network" portion and a "host" portion semantic imposed upon them.
Dotted decimal is just for human consumption. Classful addressing uses
leading _bits_ to determine the class (A=0xxxxxxx, B=10xxxxxx,
C=110xxxxx, D[multicast]=1110xxxx, E[experimental]=1111xxxx).
As for NAG, my current speculation is:
191-127=64
For each of these 64, the writer assumed a reserved address?
16,384-64=16,320 total networks
Similarly for hosts...
For each net address in the 2nd quad, he also assumed a reserved number
in the _next_ (3rd) quad (x.x.0.x or x.x.255.x ?) which gives 255(?)
"reserved" addresses.
Then for each in the _next_ (3rd) quad, he also assumed a reserved
number in the _last_ (4th) quad (x.x.x.0 or x.x.x.255 ?) which gives
255 more "reserved" addresses.
Trying to account for "broadcast" addresses? Why 255? Why not 256?
What was he ingesting/inhaling?
255+255=510
65,534-510=65024 total hosts per network.
Does this add up?
You're invited to supply your own theory ;-)
regards,
prg
PS. For even stranger comparisons try out his '93 version:
[q]
Class B networks have network numbers 128.0.0.0 through 191.255.0.0.
This allows for 16065 nets with 65534 hosts each.
[eq]
http://www.cs.indiana.edu/linux/net/nag.html