Mystery Behind the Mask
A mask, generally speaking, is a device that conceals one's true identity. Although hiding one's true identity is despicable and cowardly, in the case of IP addresses that is actually a very good thing. Can you imagine having to remember an IP address consisting of just 32 1s and 0s? Neither can I!Three different types of masks are used with IP addresses:Decimal mask (example: 1.1.1.1)Network mask (example: 255.0.0.0)Subnet mask (example: /24)
These masks are different tools intended for different purposes. I'll explain each of them to you before delving into the mathematics of subnetworking.
Decimal Masks
Whenever you encounter an IP address, it is most likely in a dotted-decimal form. That is, it consists of four decimal numbers separated by three dots. For example, 10.1.2.155 is a legitimate IP address. Repeatedly, this book says that an IP address is really a 32-bit binary number, and 10.1.2.155 sure doesn't look like a binary number. The reason is that it isn't. What you are looking at is the decimal mask of a binary address. Converted to binary, this address follows:00001010.00000001.00000010.10011011
The dots, as mentioned in Chapter 6, are placed there just to make it easier to convert the long binary number into smaller decimal numbers. The true binary address, without any mask at all, follows:00001010000000010000001010011011
If that address isn't enough of a reason to use masks, what is? The decimal mask conceals this utterly unusable raw address and makes the IP address a bit more human friendly. Each IP address you see expressed in dotted-decimal notation is really a decimal mask for the raw, 32-bit binary IP address.
Network Masks
A network mask is a bit more specialized. Much like a decimal mask, the network mask also uses the dotted-decimal format to conceal the ugly 32-bit binary number. The difference between a decimal and network mask is that the network mask has a more specific purpose. The network mask tells network devices (not necessarily a network's human users) how many bits of an IP address are used to identify the network address.Chapter 6, you know that means that the first 8 bits identify the network address. The remaining 24 bits can identify hosts within that 8-bit network address.The dotted-binary form of the network mask simply shows you how to arrive at the network mask's decimal value. 28 is 256. Because IP starts counting at 0 instead of 1, the valid range is 0 through 255. Thus, a pattern of eight consecutive 1s yields a decimal mask value of 255.
Subnet Masks
A subnet mask is a 32-bit binary number that can be expressed in either dotted-decimal or dotted-binary form. In this regard, a subnet mask is structurally similar to an IP address. There are, however, some important distinctions! For example, a mask is not a real address; you can't assign it to any device on the network. Nor does it have to be unique. The best way to understand subnet masks is to think of them as just an extension of a network mask. Actually, they are directly based on the network mask.Subnet masks tell end systems (including routers and hosts in the LAN) how many bits of the IP address' host field have been borrowed for subnet identification. The bits in the mask that identify the network address, as well as the subnet address, are set to 1s. The remaining bits, which are used for host addresses within each subnet, are set to 0s.Table 7-5 shows you how many bits you need to borrow from the host field in a /24 network to create the following subnets. The bits that identify host addresses are shown in italics. The bits that were borrowed from the host field are indicated in bold italics.
Borrowed Bits | Subnet Mask in Dotted Decimal Form | Subnet Mask in Dotted Binary Form |
---|---|---|
2 | 255.255.255.192 | 11111111.11111111.11111111.11000000 |
3 | 255.255.255.224 | 11111111.11111111.11111111.11100000 |
4 | 255.255.255.240 | 11111111.11111111.11111111.11110000 |
5 | 255.255.255.248 | 11111111.11111111.11111111.11111000 |
6 | 255.255.255.252 | 11111111.11111111.11111111.11111100 |
Number of Bits in Network Prefix | Subnet Mask in Dotted-Decimal Form | Number of Possible Subnet Addresses | Number of Possible Hosts Per Subnet |
---|---|---|---|
2 | 255.255.255.192 | 4 | 64 |
3 | 255.255.255.224 | 8 | 32 |
4 | 255.255.255.240 | 16 | 16 |
5 | 255.255.255.248 | 32 | 8 |
6 | 255.255.255.252 | 64 | 4 |
Two Types of Subnets
Throughout this chapter you might have noticed that segmenting a network address created subnets of equal size. That wasn't an accident. That shows you the simplest approach to subnetting. This approach has become known as fixed-length subnet masking (FLSM) .variable-length subnet masking (VLSM). VLSM, in theory, solves the problem of the inherent inefficiency of trying to use the same mask size for all your subnets. VLSM offers the ability to create subnet masks that are specifically designed for the number of devices you need to support in each subnet. That means that VLSM is much more efficient than FLSM when it comes to the efficiency with which an address block can be used.hostmasters) prefer to base their subnetwork address schemes on FLSM rather than VLSM. That is, they first carve up their network address block into small subnetworks of fixed length and then add those fixed-length blocks together as needed to build subnets. Regardless of how you implement it, VLSM can be a tremendously powerful tool…if you can master it!