IP subnetting isn't some obscure topic that only network administration "gurus" can understand. In fact, if you work with networks, odds are pretty good that you're already somewhat familiar with Cisco IP subnetting.
But it never hurts to refresh your subnetting skills—particularly if you're planning on taking a Cisco exam soon. Last time, I told you five things you should know about Cisco IP subnetting, including what subnetting is, how to write out subnet masks, and more. Now, let's look at five more things you should know about subnetting.
Which formulas can I use to subnet a network?
To review, subnetting involves taking a single network that has a large number of hosts and breaking it into multiple networks each with a smaller number of hosts. That's why we call it subnetting—because we're creating subnetworks. Let's look at two formulas you need to know when subnetting a network.
This formula is 2x, where x is the number of 1s added to the subnet mask from the previous or default subnet mask when converted to binary.
For example, a subnet mask of 255.255.255.252 converted to binary is 11111111 11111111 11111111 11111100. Let's assume that this is from a classful network (i.e., a network that uses the five different classes of IP addresses), and it started out as a Class C subnet mask (255.255.255.0). To arrive at the new subnet mask (255.255.255.252), we added six 1s to the subnet mask, which had a default number of 24 1s.
So, 26 = 64, which means that changing the subnet mask from the default /24 (255.255.255.0) mask to a /30 (255.255.255.252) subnet mask would create 64 new networks.
This formula is 2y-2, where y is the number of 0s in the subnet mask when converted to binary.
Let's use the same example. Our subnet mask is 255.255.255.252, which is 11111111 11111111 11111111 11111100 when converted to binary. This subnet mask had two 0s. So, 22-2 = 2, which means there are two valid hosts in the subnet. The 2 we subtract in the formula stand for the network ID and the broadcast ID.
Let's say the IP address for this example is 192.168.1.0 with a /30 subnet mask (the 255.255.255.252 subnet mask above). This network would look like this:
192.168.1.0: Network ID 192.168.1.1: One of the usable hosts 192.168.1.2: One of the usable hosts 192.168.1.3: Broadcast ID
So, by using the /30 subnet mask, we've created 64 new networks with two useable hosts each.
Shouldn't I subtract 2 when using the networks formula?
A more experienced administrator out there might be wondering why we didn't subtract 2 when using the networks formula. Let me clarify: The original networks formula was 2x-2, where the subtracted 2 stood for networks with all 0s and all 1s. However, with modern IP stacks, you can use these networks, and it's no longer necessary to subtract them (RFC 1878).
Prior to Cisco IOS 12.0, by default, Cisco routers wouldn't allow you to configure an IP address on the all 0s network on an interface. However, you could configure this using the ip subnet-zero command in Global Configuration Mode.
Now, after IOS 12.0, the ip subnet-zero command is the default on routers. Note that this command not only allows the all 0s subnet, but it also permits the all 1s subnet. And that's why you no longer have to subtract 2 when using the network formula. For more information on this, see Cisco's "Subnet Zero and the All-Ones Subnet" documentation.
Which formulas should I know
for the CCNA exam?
Many CCNA test candidates want to know which subnetting formulas they should know for the CCNA exam. I researched this question, and here's what I found out: While most questions don't cover subnet 0 or subnet 1, it's still a possible test topic. However, the exam clearly states the situation and discloses whether the network in question uses the 0 or 1 subnets. So, I recommend CCNA exam candidates make sure they understand the difference and read the questions carefully.
What are special IP addresses?
In addition to the different classes of IP addresses (i.e., A, B, C, D, and E), you should also be familiar with special IP addresses. Let's look at three categories of special IP addresses.
Private IP addresses
Based on RFC 1918, private IP addresses are not routable on the Internet. Instead, the purpose of these addresses is for use on internal networks only. (While you may receive traffic from the Internet with a private IP address as the source, this is actually a spoofed source IP address.)
Here are the ranges of private IP addresses:
- 10.0.0.0 with a 255.0.0.0 (/8) subnet mask
- 172.16.0.0 through 172.31.255.255 with a 255.240.0.0 (/12) subnet mask
- 192.168.0.0 with a 255.255.0.0 (/16) subnet mask
Automatic private IP addressing
The 169.254.0.0 network with a 255.255.0.0 (/16) subnet mask is an IP address range used for private IP addressing in situations when a machine is unable to contact a DHCP server (RFC 3927). For example, this is a default configuration when a Windows machine can't contact a DHCP server.
The 127.0.0.0 network with a 255.0.0.0 (/8) subnet mask is a special IP address range from the Class A network, which administrators can use for loopback adapters (RFC 1166). These are internal, "virtual" adapters that represent a network interface.
Every system has a loopback adapter, and it's usually 127.0.0.1. What many people don't realize is that 127.123.3.240 also represents their loopback adapter. The standard domain name for the loopback adapter is localhost.
Do I have to calculate my subnetting manually?
The CCNA exam requires candidates to be able to figure out subnetting in longhand. However, in the real world, most network administrators use a calculator.
While you can use the Windows calculator to figure out the networks and hosts formulas, several specialized IP subnetting calculators are also available. In addition, these calculators can come in handy when you're studying for the CCNA exam and want to check your manual calculations.
Here's a selection of downloadable and online tools:
- SolarWinds' Advanced Subnet Calculator
- Boson's IP Subnet Calculator
- Cisco's Web-based IP subnet calculators (for registered users only)
- WildPackets' IP Subnet Calculator
- Online IP Subnet Calculator
How can I learn more?
There's a wealth of information available on the Internet about subnetting. Once again, here are some recommended resources:
- "TechRepublic Tutorial: Subnetting a TCP/IP network"
- "IP Addressing and Subnetting for New Users" Cisco documentation
- The TCP/IP Guide Web site
- Learn to Subnet Web site
Miss an issue?
Check out the new Cisco Routers and Switches Archive, and catch up on the most recent editions of this newsletter.
Want to learn more about router and switch management? Automatically sign up for our free Cisco Routers and Switches newsletter, delivered each Friday!
David Davis has worked in the IT industry for 12 years and holds several certifications, including CCIE, MCSE+I, CISSP, CCNA, CCDA, and CCNP. He currently manages a group of systems/network administrators for a privately owned retail company and performs networking/systems consulting on a part-time basis.