In this Cisco CCNA tutorial, you’re going to understand how we can implement submitting. Scroll down for the video and also text tutorial.
Subnetting Overview Video Tutorial
Just wanted to tell you that I have passed my CCNA yesterday thanks to your video training. It really helped me a lot, not just on the exam but in the field too.
Subnetting is a really important topic, not just for passing the CCNA exam, but for networking in general. It's one of the core knowledge areas that you need to understand if you're going to work in networking.
To understand this lecture, you need to think about it from the context of the originally intended IPv4 design where all hosts which can communicate on the internet have a public IP address.
If you're already working in a company where you've already got exposure to working on the network, the chances are your company is using private IP addresses. As we go through these lectures, do not think about it from that point of view.
We're going to get into private IP addresses later and I'll also explain how modern-day networks work. But before we get there, you need to understand how IPv4 worked in the first place. It's a natural progression.
Think about how the internet worked 10 or 15 years ago before we were running out of addresses and before everybody was using private addresses. The majority of companies are using private addresses, but there are a few out there that are using public addresses everywhere. That is pretty rare though.
For example, we're a network designer for a small business with four departments that are spread over two offices. We want to manage our own public address space and we could buy four separate Class C networks for that.
The problem is that public IP addresses cost money. Rather than buying separate networks from the internet authorities, we could purchase a single range and subnet it into smaller portions.
Let's say, we've only got a handful of hosts in each of those departments. Rather than buying 256 addresses for each, we can buy a single Class C range. Then, we can divide that network up into smaller networks and assign it to the different parts of our networks.
Borrowing Host Bits
For example, we've got a Class C range 22.214.171.124/24. We subnet it to divide the network into smaller subnetworks. To do that, we would need to borrow some host bits and add them to the network portion of the address.
We're going to move the line that separates the network portion of the address under the host portion further over to the right. We're going to take some of our host addresses away and give them to the network portion of the address.
When subnetting, the line always moves to the right. The further to the right we go, the more subnets that we're going to have but the less the amount of host that we'll have on each subnet.
Calculating the Number of Networks
To calculate the number of available subnets that we're going to get by moving the line to the right, we use a formula of 2 to the power of borrowed subnet bits (2borrowed bits). If a Class C network uses a /28 subnet mask, then we're borrowing bits from the default Class C subnet mask of /24.
To determine the borrowed bits, we get the difference between /28 and the default /24, which is equal to 4. We then calculate how many subnets we're going to get by substituting the borrowed 4 bits into the formula. Therefore, 24 is equal to 16 subnets.
An easy way to calculate the number of subnets is to do it with your fingers. Start with two, then double. So I go 2, 4, 8, 16. I'm going to have 16 available subnets for the 4 borrowed bits.
Another example, if a Class B network uses the same /28 subnet mask, we’ll subtract the default subnet mask for Class B which is /16. So we've got 12 borrowed bits. To see how many subnets we're going to get, it is going to be 212 and that would be 4,096 subnets.
Remember that hosts on different subnets need to go via a router if they want to communicate with each other. That's the whole point of our IP addressing and subnetting, to divide our network into different logical parts of the network. The routers know how to get everywhere and that can direct the traffic.
Calculating the Number of Hosts
To calculate the number of hosts, it's 2 to the power of how many hosts bits then minus 2. We need to subtract 2 because we've got the network address and the broadcast address that cannot be assigned to a host.
So if a Class C network uses a /28 subnet mask, then we've got 4 bits left for hosts. There’s a total of 32 bits in the address and we subtract 28 for the network portion. That leaves us 4 bits for the host portion.
Using the formula, 24 is equal to 16 minus 2 for the network address and the broadcast address, giving us 14 available addresses for our hosts. If we've got a Class B network and it's using a /28, we also have 4 bits left for our hosts. That would be 24 which is 16, minus 2. It will give us 14 addresses, the same with our Class C with /28.
Notice that the amount of hosts is dependent on the subnet mask size. It's going to be the same whether it's Class A, Class B, or Class C. The number of subnets is going to be different for Class A, Class B, and Class C because they've got different default subnet mask sizes.
For example, if we use a /28 with a Class B, we're going to have 4,096 available subnets. If we use a /28 with a Class C, we're going to have 16 available subnets. There's a difference in there, but for the number of hosts, they are going to be the same.
A quick note on the IP subnet-zero command, just like we have to subtract 2 to get the number of valid hosts, back in the day, we also used to subtract 2 from the number of available networks. Because in the original internet standards, it wasn't allowed to use network bits of all zeroes or all ones, just like we can't use host bits of all zeroes or all ones.
So that took away two of our available subnets. However, there wasn't any practical need for that and it wasted address space. With the host bits, there’s a practical need for it because we've got that network address and the broadcast address that is used.
On Cisco routers now, there's a default command of IP subnet-zero, which disables such behavior. The command is enabled by default, so those two extra network addresses are available in Cisco networks.
I must tell you this because you may look up something on the internet or in a subnet calculator and it might tell you that there are 14 networks available on Class C with a /28, for example, when I'm telling you that there's 16.
With Cisco networks and for the CCNA exam, do not take two away from the number of available subnets. I want to tell you about it so that you won't get confused if you're looking up anything on the internet.
IP Addressing and Subnetting for New Users: https://www.cisco.com/c/en/us/support/docs/ip/routing-information-protocol-rip/13788-3.html
Cisco CCNA IP Addressing and Subnetting: https://www.certificationkits.com/cisco-certification/cisco-ccna-640-802-exam-certification-guide/cisco-ccna-ip-addressing-and-subnetting-part-v/
Text by Libby Teofilo, Technical Writer at www.flackbox.com
With a mission to spread network awareness through writing, Libby consistently immerses herself into the unrelenting process of knowledge acquisition and dissemination. If not engrossed in technology, you might see her with a book in one hand and a coffee in the other.