Table of Contents |
In the last tutorial, you learned how to define and find the valid host ranges used in a Class A, Class B, or Class C network address. In this tutorial, you will learn about subnetting, which allows you to take one larger network and break it into a set of smaller networks. Let’s talk about the benefits of subnetting.
Most traffic will stay on the local network; only packets destined for other networks will pass through the local router. Routers create broadcast domains. The more broadcast domains you create, the smaller the broadcast domains and the less network traffic on each network segment. Reducing the amount of traffic on each broadcast domain improves network performance.
It’s easier to identify and troubleshoot network problems in a group of smaller connected networks than within one gigantic network.
Because WAN links are considerably slower and more expensive than LAN links, a single large network that spans long distances can create problems in every area previously listed. Connecting multiple smaller networks makes the system more efficient.
To create subnetworks, you take bits from the host portion of the IP address and reserve them to define the subnet address. This means fewer bits for the host portion of the IP address, so the more subnets, the fewer bits left available for defining hosts.
The first step of subnetting a network is to determine your current requirements as well as plan for future network growth.
Powers of 2 are really important to memorize for use with IP subnetting. To review powers of 2, remember that when you see a number with another number to its upper right (an exponent), this means you should multiply the number by itself as many times as the upper number specifies.
EXAMPLE
Note that is 2 × 2 × 2, which equals 8. Here’s a list of powers of 2 that you should commit to memory:EXAMPLE
All you have to do to remember the value of is to first know that . Why? Because when you double 2 to the eighth power (256), you get (or 512). To determine the value of , simply start with , and then double it twice.You can go the other way as well. If you need to know what is, for example, you just cut 256 in half two times: once to reach and then one more time to reach .
For the subnet address scheme to work, every machine in the network must know which part of the host address will be used as the subnet address. This is accomplished by assigning a “subnet mask” to each machine. A subnet mask is a 32-bit value that allows the recipient of IP packets to distinguish the network ID portion of the IP address from the host ID portion of the IP address.
The network administrator creates a 32-bit subnet mask composed of 1s and 0s. The 1s in the subnet mask represent the positions that refer to the network and subnet addresses.
The table below shows the default subnet masks for Classes A, B, and C. These default masks cannot and do not change. In other words, you can’t make a Class B subnet mask read 255.0.0.0. If you try, the host will read that address as invalid and usually won’t even let you type it in. For a Class A network, you can’t change the first byte in a subnet mask; it must read 255.0.0.0 at a minimum. Similarly, you cannot assign 255.255.255.255, because it is made up of all 1s—a broadcast address. A Class B address must start with 255.255.0.0, and a Class C has to start with 255.255.255.0.
Another term you need to know is classless inter-domain routing (CIDR). It’s basically the method that internet service providers (ISPs) use to allocate a number of addresses to a company or a home connection. They provide addresses in a certain block size. You’ll learn about that in greater detail later in this chapter. Another term for the use of different length subnet masks in the network is variable length subnet masking (VLSM).
When you receive a block of addresses from an ISP, what you get will look something like this: 192.168.10.32/28. This tells you what your subnet mask is. The slash notation (/) indicates how many bits are turned on (1s). Obviously, the maximum could only be /32, because a byte is 8 bits and there are 4 bytes in an IP address: 4 × 8 = 32. But keep in mind that the largest subnet mask available (regardless of the class of address) can only be a /30, because you have to keep at least 2 bits for host bits.
Take, for example, a Class A default subnet mask, which is 255.0.0.0. This means that the first byte of the subnet mask is all 1s, or 11111111. When referring to a slash notation, you need to count all the bits that are 1s to figure out your mask. So, 255.0.0.0 is considered a /8, because it has 8 bits that are 1s—that is, 8 bits that are turned on.
A Class B default mask would be 255.255.0.0, which is a /16 because 16 bits are 1s: 11111111.11111111.00000000.00000000.
The table below offers a listing of every available subnet mask and its equivalent CIDR slash notation.
According to RFC 1518, any device or software that claims to be CIDR compliant will allow supernetting, meaning a traditionally Class C address can be used with a /23 subnet mask in almost all cases. Further, /8 through /15 can be used only with Class A network addresses; /16 through /23 can be used with Class A and B network addresses; and /24 through /30 can be used with Class A, B, and C network addresses. This is a major reason most companies use Class A network addresses. Because they are allowed to use all subnet masks, they gain the valuable benefit of maximum flexibility for their network design.
There are many different ways to subnet a network. The right way is the way that works best for you. In a Class C address, only 8 bits are available for defining the hosts. Remember that subnet bits start at the left and go to the right, without skipping bits. This means that the only Class C subnet masks can be those listed here:
Binary | Decimal | CIDR |
---|---|---|
00000000 | 0 | /24 |
10000000 | 128 | /25 |
11000000 | 192 | /26 |
11100000 | 224 | /27 |
11110000 | 240 | /28 |
11111000 | 248 | /29 |
11111100 | 252 | /30 |
We can’t use a /31 or /32 because, remember, we have to leave at least 2 host bits for assigning IP addresses to hosts.
Subnetting a Class C Address: The Fast Way!
When you’ve chosen a possible subnet mask for your network and need to determine the number of subnets, valid hosts, and broadcast addresses of a subnet that the mask provides, all you need to do is answer five simple questions:
IN CONTEXT
At this point, it’s important that you both understand and memorize your powers of 2. Please refer to the sidebar “Understanding the Powers of 2” earlier in this lesson if you need some help. Here’s how you get the answers to those five big questions:
- How many subnets? . x is the number of masked bits, or the 1s. For example, in 11000000, the number of 1s gives us subnets. In this example, there are four subnets.
- How many hosts per subnet? . y is the number of unmasked bits, or the 0s. For example, in 11000000, the number of 0s gives us – 2 hosts. In this example, there are 62 hosts per subnet. You need to subtract 2 for the subnet address and the broadcast address, which are not valid hosts.
- What are the valid subnets? 256 – subnet mask = block size, or increment number. An example would be . The block size of a 192 mask is always 64. Start counting at 0 in blocks of 64 until you reach the subnet mask value, and these are your subnets: 0, 64, 128, 192. Easy, huh?
- What’s the broadcast address for each subnet? Here’s the really easy part. Because we counted our subnets in the last section as 0, 64, 128, and 192, the broadcast address is always the number right before the next subnet. For example, the 0 subnet has a broadcast address of 63, because the next subnet is 64. The 64 subnet has a broadcast address of 127 because the next subnet is 128 and so on. Remember, the broadcast address of the last subnet is always 255.
- What are the valid hosts? The valid hosts are the numbers between the subnets, omitting all the 0s and all the 1s. For example, if 64 is the subnet number and 127 is the broadcast address, then 65–126 is the valid host range—it’s always the numbers between the subnet address and the broadcast address.
Subnetting can seem confusing. But it really isn’t as hard as it seems to be at first—just hang in there! Why not try a few and see for yourself? You may find it helpful to watch some online videos on how to subnet. Finding an online subnetting calculator and practice problems online may be helpful as well.
Practice example #2c: 255.255.255.128 (/25)
Because 128 is 10000000 in binary, there is only 1 bit for subnetting, and there are 7 bits for hosts. We’re going to subnet the Class C network address 192.168.10.0.
192.168.10.0 = Network address
255.255.255.128 = Subnet mask }}
Now, let’s answer the big five:
How many subnets? Because 128 is 1 bit on (10000000), the answer is .
How many hosts per subnet? We have 7 host bits off (10000000), so the equation is hosts.
What are the valid subnets? 256 – 128 = 128. Remember, we’ll start at 0 and count in our block size, so our subnets are 0 and 128.
What’s the broadcast address for each subnet? The number right before the value of the next subnet indicates all the host bits turned on and equals the broadcast address. For the 0 subnet, the next subnet is 128, so the broadcast address of the 0 subnet is 127.
What are the valid hosts? These are the numbers between the subnet and the broadcast address. The easiest way to find the hosts is to write out the subnet address and the broadcast address. This way, the valid hosts are obvious. The following table shows the 0 and 128 subnets, the valid host ranges of each, and the broadcast address of both subnets:
Subnet | 0 | 128 |
First host | 1 | 129 |
Last host | 126 | 254 |
Broadcast | 127 | 255 |
Source: This content and supplemental material has been adapted from CompTIA Network+ Study Guide: Exam N10-007, 4th Edition. Source Lammle: CompTIA Network+ Study Guide: Exam N10-007, 4th Edition - Instructor Companion Site (wiley.com)