Networking Forums

Networking Forums > Computer Networking > Linux Networking > Class B networks - number of networks/hosts

Reply
Thread Tools Display Modes

Class B networks - number of networks/hosts

 
 
Barry Smith
Guest
Posts: n/a

 
      03-20-2005, 03:36 PM
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.

Thanks,
Barry
 
Reply With Quote
 
 
 
 
Steve Horsley
Guest
Posts: n/a

 
      03-20-2005, 06:02 PM
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.
>
> Thanks,
> Barry


128 to 191 inclusive is 64, not 63.
All values, 0-255 are allowed for the secod byte of the network number.
This gives us 64 * 256 = 16384 class B networks: 128.0-191.255 inclusive.
That's my reckoning, anyway. I don't see where the book's other 64
networks went.


For hosts on a network, the all ones and the all zeros addresses are
reserved (all-ones is the network broadcast address, and all zeros
is just reserved). That gives us 0.1-255.254, which is 65534 hosts.
Again, I don't see where the others went.

Steve
 
Reply With Quote
 
prg
Guest
Posts: n/a

 
      03-20-2005, 09:07 PM
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

 
Reply With Quote
 
Clifford Kite
Guest
Posts: n/a

 
      03-20-2005, 10:04 PM
Barry Smith <(E-Mail Removed)> 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


First, I'm not an expert as to either Classful or CIDR subnets. But I
think the old Classful networks did not allow a network or host address
to have 255 as a dotted quad octet. If so then the reasoning may have
been as follows.

The number of networks is 64*255=16320=(191-128+1=64)*(256-1): The
product of the *correct* number of possible first quad octets and the
number of possible second quad octets, 256-1=255 (no network address
can contain the octet 255).

> 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.


The number of hosts for each network is (256-1)^2-1=65024 (no host
address can contain the quad octet 255 and x.y.0.0 is a network
address).

--
Clifford Kite Email: "echo xvgr_yvahk-(E-Mail Removed)|rot13"
PPP-Q&A links, downloads: http://ckite.no-ip.net/
/* Those who can't write, write manuals. */
 
Reply With Quote
 
Clifford Kite
Guest
Posts: n/a

 
      03-20-2005, 10:22 PM
prg <(E-Mail Removed)> wrote:

> 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


Well, the numbers the OP showed are in the first edition of the book,
published in 1995. It does say copyright 1993-1995 though.

--
Clifford Kite Email: "echo xvgr_yvahk-(E-Mail Removed)|rot13"
PPP-Q&A links, downloads: http://ckite.no-ip.net/
/* Better is the enemy of good enough. */
 
Reply With Quote
 
Barry Smith
Guest
Posts: n/a

 
      03-20-2005, 10:54 PM
In article <d1kh5f$li5$(E-Mail Removed)>, Steve Horsley wrote:
>
> 128 to 191 inclusive is 64, not 63.
> All values, 0-255 are allowed for the secod byte of the network number.
> This gives us 64 * 256 = 16384 class B networks: 128.0-191.255 inclusive.
> That's my reckoning, anyway. I don't see where the book's other 64
> networks went.
>
>
> For hosts on a network, the all ones and the all zeros addresses are
> reserved (all-ones is the network broadcast address, and all zeros
> is just reserved). That gives us 0.1-255.254, which is 65534 hosts.
> Again, I don't see where the others went.
>
> Steve


Thanks very much, Steve and prg. I'll have to give this some thought -
now at least I have something to work with. I appreciate your quick
responses.

Regards,
Barry
 
Reply With Quote
 
James Knott
Guest
Posts: n/a

 
      03-20-2005, 11:22 PM
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.


The addresses 128.0.0.0 to 191.255.0.0 gives 64 blocks of 256 64 * 256 =?
The remaining 16 bits = 2^16 =?
Count the number of blocks, including 128.0.0.0 to 191.255.0.0 =
The number of addresses is always, 2^n - 2. I bet they incorrectly assumed
that each 256 addresses lost two, instead of only the entire 65K block
losing only two.

 
Reply With Quote
 
James Knott
Guest
Posts: n/a

 
      03-20-2005, 11:23 PM
Steve Horsley wrote:

> 128 to 191 inclusive is 64, not 63.
> All values, 0-255 are allowed for the secod byte of the network number.
> This gives us 64 * 256 = 16384 class B networks: 128.0-191.255 inclusive.
> That's my reckoning, anyway. I don't see where the book's other 64
> networks went.


I wouldn't be suprised if that book made a few other errors. I've come
across a couple in my time, that were obviously written by someone who
didn't fully understand the subject.

 
Reply With Quote
 
Wolf
Guest
Posts: n/a

 
      03-23-2005, 02:06 AM
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.
>
> Thanks,
> Barry



(1) 2^14 bits = 16384 networks (10000000-10111111 for the first octet: the
left most
2 bits are used to determine class [special circumstances Class D/E]) - 16
Class Bs
do not really count in my book 'cause they are RFC1918 (private)=16,378 real
Class
B networks.

(2) For each class B there 2^16 possible IPs (65, 536 ) but you can only use
65, 534,
since the .0.0/16 is the network address and 255.255/24 is the broadcast
address for
the network..

(3) As soon as you subnet the "-2" rule comes into serious play. So if, for
instance, we
subnet 172.16.0.0/16 on /24 boundary (~Class C), we have 256 subnets - 2=254
usable
subnets (172.16.0.0/24 and 172.16.255.0/24 become unavailable) AND for each
/24, the
..0 and .255 become unavailable for network/broadcast IPs. So that 65,024
number is
really 16384 - (254*2-256-256) = 64,512.

HTH
--
Wolf
----------------------------------------------------------------
Please post all responses to UseNet. All email cheerfully and automagically
routed to Dave Null


 
Reply With Quote
 
Allen McIntosh
Guest
Posts: n/a

 
      03-23-2005, 03:38 AM
Much of this is in RFC 1700 - though it doesn't necessarily match these
calculations.
>> "This class allows for 16,320 nets with 65,024 hosts each
>> from 191 in the first octets: so 191-128=63.

64. You have to count the fenceposts.

If you don't count 128.255 and cousins, you get
64*255=16320
(Why not count 128.255 and cousins? Got me.)

>>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?

No. You can't use 0.0 or 255.255. Leaves 65534 hosts.

How to get 65024? My best guess is you don't count X.X.0.0,
X.X.255.0-255 and X.X.0-254.255. (Why not? Got me again.)
>> What am I doing wrong here - I find contradictory
>>figures when I google this.

So you believe everything you read on the Web? :-)
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
WE BUY used, new and refurbed Sun, Cisco, Lucent, Nortel, Alcatel,3com, IBM, HP, Compaq, Dell, Madge, Cabletron, Juniper Networks, Bintec,Siemens, Foundry, Networks, Extreme Networks, Fore/Marconi, TellabsLucent/Avaya/Ascend, Xylogics, Brocade, Int Mike Linux Networking 0 02-16-2008 08:35 PM
WE BUY used, new and refurbed Sun, Cisco, Lucent, Nortel, Alcatel,3com, IBM, HP, Compaq, Dell, Madge, Cabletron, Juniper Networks, Bintec,Siemens, Foundry, Networks, Extreme Networks, Fore/Marconi, TellabsLucent/Avaya/Ascend, Xylogics, Brocade, Int Mike Broadband 0 02-16-2008 01:48 AM
WE BUY used, new and refurbed Sun, Cisco, Lucent, Nortel, Alcatel,3com, IBM, HP, Compaq, Dell, Madge, Cabletron, Juniper Networks, Bintec,Siemens, Foundry, Networks, Extreme Networks, Fore/Marconi, TellabsLucent/Avaya/Ascend, Xylogics, Brocade, Int Mike Broadband 0 01-12-2008 09:35 AM
WE BUY used, new and refurbed Sun, Cisco, Lucent, Nortel, Alcatel,3com, IBM, HP, Compaq, Dell, Madge, Cabletron, Juniper Networks, Bintec,Siemens, Foundry, Networks, Extreme Networks, Fore/Marconi, TellabsLucent/Avaya/Ascend, Xylogics, Brocade, Int buyonet@hotmail.com Broadband 0 11-18-2007 10:58 AM
Connecting two Class C private networks under one domain. =?Utf-8?B?bW9zcXVpdG9faGlwcHk=?= Windows Networking 8 12-09-2004 01:17 PM



1 2 3 4 5 6 7 8 9 10 11