Use Sophia to knock out your gen-ed requirements quickly and affordably. Learn more
×

IP Subnetting

Author: Sophia

1. Subnetting Basics

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.

term to know
Subnet
A portion of a network that shares a network address in which each component is identified by a number.

1a. Optimized Network Performance

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.

1b. Simplified Management

It’s easier to identify and troubleshoot network problems in a group of smaller connected networks than within one gigantic network.

1c. Facilitated Spanning of Large Geographical Distances

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.


2. How to Create Subnets

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.

step by step
Here are the steps to create an ideal design:
  1. Determine the number of required network IDs:
    1. one for each subnet
    2. one for each WAN connection
  2. Determine the number of required host IDs per subnet:
    1. one for each TCP/IP host
    2. one for each router interface
  3. Based on the previous requirements, create the following:
    1. one subnet mask for your entire network
    2. a unique subnet ID for each physical segment
    3. a range of host IDs for each subnet

2a. Understanding the Powers of 2

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 2 cubed is 2 × 2 × 2, which equals 8. Here’s a list of powers of 2 that you should commit to memory:
table attributes columnalign left end attributes row cell 2 to the power of 1 equals 2 end cell row cell 2 squared equals 4 end cell row cell 2 cubed equals 8 end cell row cell 2 to the power of 4 equals 16 end cell row cell 2 to the power of 5 equals 32 end cell row cell 2 to the power of 6 equals 64 end cell row cell 2 to the power of 7 equals 128 end cell row cell 2 to the power of 8 equals 256 end cell row cell 2 to the power of 9 equals 512 end cell row cell 2 to the power of 10 equals 1 comma 024 end cell row cell 2 to the power of 11 equals 2 comma 048 end cell row cell 2 to the power of 12 equals 4 comma 096 end cell row cell 2 to the power of 13 equals 8 comma 192 end cell row cell 2 to the power of 14 equals 16 comma 384 end cell end table
If you hate math, don’t get stressed out about remembering all these exponents—it’s helpful to know them, but it’s not absolutely necessary. Here’s a little trick, because you’re working with 2s: Each successive power of 2 is double the previous one.

EXAMPLE

All you have to do to remember the value of 2 to the power of 9 is to first know that 2 to the power of 8 space equals space 256. Why? Because when you double 2 to the eighth power (256), you get 2 to the power of 9 (or 512). To determine the value of 2 to the power of 10, simply start with 2 to the power of 8 space equals space 256, and then double it twice.

You can go the other way as well. If you need to know what 2 to the power of 6 is, for example, you just cut 256 in half two times: once to reach 2 to the power of 7 and then one more time to reach 2 to the power of 6.

2b. Subnet Masks

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.

key concept
Not all networks need subnets, meaning they use the default subnet mask. This is basically the same as saying that a network doesn’t have a subnet address.

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.

2c. Classless Inter-domain Routing

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.

terms to know
Classless Inter-domain Routing (CIDR)
An IP address notation such as 192.168.1.0/24 indicating a block of addresses. The number after the slash indicates how many bits are in the mask.
Variable Length Subnet Masking (VLSM)
A technique for subnetting a network into subnets of different sizes.
Supernetting
An IP network formed from two or more networks (or subnets) with a common CIDR routing prefix.

2d. Subnetting Class C Addresses

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:

  • How many subnets does the chosen subnet mask produce?
  • How many valid hosts per subnet are available?
  • What are the valid subnets?
  • What’s the broadcast address of each subnet?
  • What are the valid hosts in each subnet?
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? 2 to the power of x equals number space of space subnets. x is the number of masked bits, or the 1s. For example, in 11000000, the number of 1s gives us 2 squared subnets. In this example, there are four subnets.
  • How many hosts per subnet? 2 to the power of y – 2 equals number space of space hosts space per space subnet. y is the number of unmasked bits, or the 0s. For example, in 11000000, the number of 0s gives us 2 to the power of 6 – 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 256 – 192 equals 64. 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 2 to the power of 1 equals 2.

How many hosts per subnet? We have 7 host bits off (10000000), so the equation is 2 to the power of 7 – 2 equals 126 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


summary
In this lesson, you learned about subnetting basics, including the benefits of optimized network performance, simplified management, and facilitated spanning of large geographical distances. You were also introduced to ideas about how to create subnets, subnet masks, CIDR, and how to subnet Class C addresses.

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)

Terms to Know
Classless Inter-domain Routing (CIDR)

An IP address notation such as 192.168.1.0/24 indicating a block of addresses. The number after the slash indicates how many bits are in the mask.

Subnet

A portion of a network that shares a network address in which each component is identified by a number.

Supernetting

An IP network formed from two or more networks (or subnets) with a common CIDR routing prefix.

Variable Length Subnet Masking (VLSM)

A technique for subnetting a network into subnets of different sizes.