Subnetting might be one of the hardest topics to understand in CCNA but if you get the concept right, it’s a piece of cake. By the end of this post, you will able to do subnetting on a Class-C IP address. So let’s take a look at basics of Subnetting.
Why Use Subnetting in a network?
As you already know that there are two versions of IP address: IPv4 and IPv6. Mostly, IPv4 is used in a network but one problem with IPv4 address is the available number of IP addresses. With IPv4, we can only have 2^32 IP Addresses. Among them, some are public IP Addresses; some are Private IP Addresses; some are reserved for future use and some IP addresses cannot be assigned in a network. With network traffic increasing day by day, we will soon run out of available IPv4 address. Take a look at total available IP Addresses,
That’s why most of the companies are converting their network from IPv4 to IPv6. That is a tough and time taking task because not everyone is using IPv6 addressing. So how will they communicate? One way of overcoming this problem is to use Subnetting and reduce IP wastage.
Breaking Broadcast Domain:
Take this example, if you have 10 departments (only 10 users in each department) in your company and you don’t want the users of those departments to communicate with each other. How will you do that?
Simple, we will use 10 different-different networks and that will do. Right? Well, that’s right but what about the IP wastage? If you use different networks then there will be a lot of IP addresses that will be of no use.
By subnetting, we break a large network into smaller Sub-Networks without changing the network and those sub networks cannot communicate to each other. In short, we are breaking the Broadcast domain of the network by creating smaller networks.
Minimum IP wastage:
There is a technique in subnetting that is called: VLSM (variable length subnet mask) that allows us to reduce IP wastage to minimum. There will be some IP wastage but Minimum.
Maintenance of Network:
Breaking a network into smaller parts also allows us to manage those subnets individually. Managing a large network is tough but if you break it in more than one sub-network; management becomes easy.
In brief, we need subnetting to divide a large network into smaller sub-networks to reduce IP wastage and for management purpose.
How to Subnet?
We use subnet mask of a network to create subnets. Subnet mask is used to separate Network and Host portion of an IP address. In subnet mask all 1s are Network Bits and all 0s are Host bits. In subnetting we convert host bits into network bits. Or you can say convert 0s into 1s.
There are 3 classes that we can use while assigning IP Address: Class A, Class B and Class C. We can do subnetting for all those classes. So, let’s do it.
Subnetting Class C addresses
Let’s take a class C IP address- 192.168.10.1/24. Here /24 represents no of 1s (Network Part) in the IP address. It is also called CIDR Value. So we have 32-24=8 bits in which we can do subnetting.
There are 4 main things to consider in subnetting.
- CIDR Value/ Subnet Mask,
- No of Subnets
- No of hosts per subnet
- Network Address and Broadcast address
- Valid Range
For our example of 192.168.10.1/25
- CIDR = 25 that means subnet Mask = 255.255.255.128. How?
Let’s right /25 in bits form,
Now convert it into binary. That will be equal to 255.255.255.128. Got it?
- For Number of subnets, just use the formula,
Number of subnets = 2^no of subnetted bits
In our case no of subnetted bits is 1. Why?
Because IP address that we are using here belongs to Class C and default CIDR Value of Class C is 24. We are using /25 here. That means No of subnetted bits = 25-24=1.
That means if we use /25 subnet mask (255.255.255.128), it will create 2^1=2 sub-networks. And we don’t even have to change the Network.
- So, we will get 2 subnets from /25 but what about hosts?
Number of Hosts per Subnets = 2^No of non-subnetted bits (No of Zeros)
In our case, it is 2^7=128
Means there will be 128 hosts in a subnet and there will be two subnets. Total = 128×2=256
- Each subnet will start with an IP address and end at some IP address. After that, new subnet will start. IP addresses in a particular subnet will be its range.
We have two subnets, so first subnet will start from 192.168.10.0 and will end at 192.168.10.127 because there could be only 128 hosts (IP Addresses) in a subnet.
So first range will be,
192.168.10.0 – 192.168.10.127
And second range will be,
192.168.10.128 – 192.168.10.255
- In each Range there will be a network address that will represent complete network for that subnet and there will be some broadcast address. Those addresses will always be first and last IP address of the range.
For first range:
Network Address: 192.168.10.0
Broadcast Address: 192.168.10.127
For second range:
Network Address: 192.168.10.128
Broadcast Address: 192.168.10.255
- Note that we cannot assign Network address and Broadcast address in our network. So valid range will be different from normal range. Valid range consists of IP addresses that we can assign in our network. So valid IP ranges will be,
192.168.10.1 – 192.168.10.126
192.168.10.129 – 192.168.10.254
We can assign IP Addresses from that range.
Valid Range will be No of hosts per network – 2. These are also called Valid Hosts.
That is how you can create sub-networks from a single network.
Now let’s quickly do it for /27
- CIDR Value/ Subnet mask = 255.255.255.224
- No of subnets = 2^Subnetted bits = 2^3 = 8 (27-24=3, if you are wondering)
- No of Hosts per subnet = 2^no of non-subnetted bits = 2^5 = 32
- Range will be,
192.168.10.0 – 192.168.10.31
192.168.10.32 – 192.168.10.63
192.168.10.64 – 192.168.10.95
192.168.10.96 – 192.168.10.127
192.168.10.128 – 192.168.10.159
192.168.10.160 – 192.168.10.191
192.168.10.192 – 192.168.10.223
192.168.10.224 – 192.168.10.255
- Valid IP Addresses = 32-2 = 30 for each subnet
- Network Address: First IP address of each Subnet
- Broadcast Address: Last IP address of each Subnet
That was really TOUGH. Wasn’t it?
DO IT YOURSELF:
If you understood the concept of subnetting, try to subnet a /31 and /32 IP address. Can you subnet it? /31 can be done because there is 1 host bit remaining that can be converted into Network Bit. But in /32, do you have any bit to convert? No. That is why you cannot do subnetting on /32.
But wait a min, try it for /31….. Done?
How many IP addresses you can assign in your network? NONE, because /31 means 2^1 hosts per network or Subnet. That will give you only 2 IP addresses and those will be your Network and Broadcast address. There is no valid IP address in /31 so we cannot use it in our network either.
Interesting. Finally if you do it for /30, you will come up with only 4 IP addresses in a subnet. 2 of them will be Network and Broadcast Addresses and remaining 2 can be assigned in a network.
That kind of Subnetting is very useful in a point-to-point Network.
Subnetting of remaining classes will be posted soon.