|address classes||fixed-length structures for the IP address space, consisting of five classes from Class A to Class E. Only Class A, B, and C addresses were assigned for real networks. This scheme has been replaced by Classless Inter-Domain Routing (CIDR).|
|Classless Inter-Domain Routing||a scheme to use variable-length structures for the IP address space, allowing the core routers to economize on routing entries and preventing the rapid depletion of IP address space due to the poorly-arranged classful IP structure.|
|subnet||a locally-defined network within a larger network, created by designating host bits of an IP address and network bits through the use of a subnet mask.|
|subnet mask||a locally-assigned bit mask that determines which bits of the IP address are used to signify the network number and which are used to signify the host number.|
As you remember from last lesson, an IP address is a 32-bit number, which results in over 4 billion addresses (if you want to get precise, it's 4,294,967,296 possible addresses). One of the first questions to pop into many people's mind is, "How do they keep track of them all?" This is a remarkably good question, and the answer can be long and difficult, depending on how detailed you want it to be. For now, we'll stick with a more general answer until we get to some of the routing concepts you'll need to understand it in greater detail.
When IP was first developed, it was recognized as fact that TCP/IP would be connecting networks to each other. This, combined with the restriction that all IP addresses must be unique, implies that addresses would be given out to members in blocks, which they then were free to assign to their hosts as they saw fit. However, it was probable that not all needs for IP space would be equal.
The solution was to split the IP address space into address classes. The IP address space was split into 5 classes, A through E, in the following fashion:
We will see later that the maximums are, in fact, much higher than the actual numbers of usable IP addresses. One of the immediate reasons is that the address that corresponds to all host bits set to zero is reserved as the network address, and the all host bits set to one is reserved as the broadcast address (we'll cover their purpose in a later lesson; right now, just remember that these addresses are reserved). So, for a Class A address, X.0.0.0 is reserved, as is X.255.255.255; for a Class B, that's X.Y.0.0 and X.Y.255.255, and for a Class C, it's X.Y.Z.0 and X.Y.Z.255.
In 1992, it was realized that we were rapidly running out of IP address space at the then-current rates of assignment (which were much, much lower than they are today). The proposal that was implemented as an interim solution is now referred to as Classless Inter-Domain Routing (CIDR). CIDR had several advatanges:
As a measure of CIDR's success, only the most modern of operating systems have been modified to work with CIDR. Most still use the classful way of looking at IP addresses. However, CIDR has delayed the depletion of the IP address space by many years, despite even-greater amounts of growth than expected.
Today, in the world of CIDR, the definitions of Class have been loosely expanded. Now, a Class C network is one whose first 24 bits signify the network portion and last 8 bits signify the host portion, regardless of the value of the first several bits. Thus, it is conceivable to be assigned a Class C address in what used to be the Class B address space. And despite your operating system not knowing what is really going on, IP has a built-in mechanism for making it all work.
Since all IP address assignments come as blocks, it's up to the local network administrators to determine which machine is assigned which IP address from the block. Say that you've been given a Class B netblock, 172.16.0.0 through 172.16.255.255. It is entirely up to you to assign IP addresses from within that block.
Let's complicate your task, however. Let's suppose that you're the network administrator for a large, world-wide corporation with locations in several cities, and you have to get all of these machines speaking TCP/IP. It sure would be nice if you could somehow split this block into smaller portions, and assign one portion to each location, wouldn't it?
Well, you can, and it's called subnetting. Here's how it works.
Each machine, in addition to receiving an IP address, also receives a subnet mask. Like an IP address, this is a 32-bit value. However, its sole purpose is to be used with the IP address to tell you (and the computer) which bits are the network portion and which bits are the host portion. Remember that in our definition of network classes, we automatically assigned certain bits to be the network and host portions. If we were to write out the standard classes as subnet masks, we'd see something like:
Class Subnet Mask A 255.0.0.0 B 255.255.0.0 C 255.255.255.0
A subnet mask can only be used (unless your host understands CIDR) to be more restrictive than the class definition, not less. At worst, you define a subnet mask that is equivalent to the class of your netblock.
If you're splitting your network into subnets, then there are a few guidelines to keep in mind:
You should have a copy of RFC 1878, which kindly lists all of the possible subnet masks and their effects. In actuality, these were developed for use with CIDR. As we said before, CIDR is an extension of existing concepts in IP networking - subnetting. What CIDR allows us to do is go the other way and define supernets that are less restrictive than our classful definitions.
Additionally, CIDR gives us an alternative notation for specifying subnet masks. Although subnet masks are bit masks and do not have to be (according to the RFCs) contiguous bits (i.e., you could in theory have a subnet mask of 255.255.255.170, which looks bitwise like 11111111 11111111 11111111 10101010), in reality these sorts of bitmasks are unwieldy to use and almost never seen in real life (and in fact are highly, highly discouraged, if not outright disallowed by more recent RFCs). Since most bit masks are continguous bitwise, they can be represented in shorthand by a slash, followed by the number of continguous bits. So, a normal Class C would look like 192.168.4.0/24, and a Class B would be 172.16.0.0/16.
An example from real life: one of the private block of IP addresses that is available for use is the 192.168.0.0/16 block. This is a block of 256 Class C addresses, starting with 192.168.0.0 and going through 192.168.255.0. Play with this a bit until you feel comfortable with it.