[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Muddled explanation of classed vs. classless IPs (was Re: RES: networking partly broken after upgrade to testing)



> I don't know what all this is about. Still, it woke me up.

I was just reading this in one of the TCP/IP books I have, so I'll take a stab at explaining it (and let somebody else explain the
errors).

IP addresses are divided into "host" portions and "network" portions. The host portion is assigned by whoever doles out blocks of IP
addresses, and is fixed once you get it. The network portion is what you get to play around with after you are assigned your block
of IP addresses. The host portion always comes first. Somebody might assigned you the block of IP addresses 45.67.0.1 -
45.67.255.255. The host portion is "45.67", whereas the network potion is ".0.1 - .255.255".

In the olden days, networks were divided into classes: A, B, and C. Class A networks had an 8-bit host value, and a 24-bit network
value. So a class A network would appear as 45.xxx.xxx.xxx. On that network, you could assign any machine an IP address from
45.0.0.1 - 45.255.255.255. Class B networks had a 16-bit host and a 16-bit network value, such as 45.67.xxx.xxx (in the example in
the last paragraph). Class C networks had a 24-bit host and an 8-bit network value (45.67.112.xxx).

However, this addressing scheme had its limitations. You might not need the 65,536 IP addresses provided by a class B network, but
more than the 256 addresses provided by a class C network. In the old days, you'd suck it up, take the class B network, and the
unused addresses would go to waste. However, as the Internet grew, IP addresses started becoming a scarce commodity. So what
happened was the assignment of IP addresses went from fixed classes to classless to prevent that type of waste.

In classless assignment, IP addresses take the form of xxx.xxx.xxx.xxx/YY. The "/YY portion" tells you how many bits to use as the
host portion, and how many to use as the network portion. Converting from the old scheme, a class B address of 45.67.xxx.xxx would
now become 45.67.xxx.xxx/16. Class C addresses would become 45.67.112.xxx/24.

The power that this provides is demonstrated when you need, say, 32,000 addresses. Obviously, this is more than an old class C
address could provide, but if you picked up a class B address you'd be wasting another 32,000+ addresses. So what you do is you take
a class B address and move one bit from the network portion to the host portion (e.g., 45.67.xxx.xxx/17 rather than
45.67.xxx.xxx/16). What this does is chops up the 45.67.xxx.xxx range into two separate networks, the first going from 45.67.0.1 to
45.67.127.255, and the second going from 45.67.128.1 to 45.67.255.255. Rather than get 32,000+ IP addresses that would go
unassigned, you can get 32,768 addresses - and let somebody else get the other 32,768 addresses who could actually use them. Instead
of throwing away 32k+ addresses, you only let a few hundred go unassigned.

A netmask address is an alternate way of expressing the "/YY" for an IP address. The netmask is simply the "/YY" portion converted
into IP address notation. For instance, /16 would become 255.255.0.0. /17 would be 255.255.127.0. Using the netmask, you can figure
out how a network is partitioned much easier than you can be simply looking at "/17".

So that's the quite and dirty run-down. I'm sure somebody will step in with corrections about math or terminology, but I think you
can get the gist of it from the explanation above.





Reply to: