I explained the advantages of subnetting in my previous article. Here, I would like to take you through some important calculations and subnetting practically. Please stay with this article and review this as many times as you would like as this is the basics of calculations and subnetting. There is no point in going any further if you do not understand subnetting well and again no point if you do not get this article very well.

Doing this with an example would be better.

I am a network administrator and I have been asked to set up 4 networks with 30 users each. The networks are IT, HR, OPs and DMZ. That’s all. I am allowed to make standard assumptions and take decision as is suited best. How do I go about this???

Firstly, I quickly jot down the requirements.

Hosts :- 30 * 4 = 120

Networks = 4

**STEP 1:- Deciding on the class of IP address**

First question to be answered is, which class of IP address should I use to cover these many hosts? To understand this, simply take a look at the default net mask of each class and convert them into binary:-

Class A:- 255.0.0.0 :- 11111111:00000000:00000000:00000000

Class B:- 255.255.0.0 = 11111111:11111111:00000000:00000000

Class C:- 255.255.255.0 :- 111111111:11111111:11111111:00000000

Now, to know the possible hosts in each class, just apply this formula to the subnet mask:

This, for instance, a Class ‘C’ netmask calculates to:- 2^8 – 2 which is 254 possible host

Hence, if calculated for every class, the values of possible hosts are Class A:- 16,777,214 hosts , Class B:- 65534 hosts, Class C:- 254 hosts

Our requirement was 120 hosts and hence the best fit here is Class ‘C’ address. You could use Class B or Class A, but that would be phenomenal waste of IP addresses considering our requirement.

Hence, I decide on Class C IP address i.e 192.168.10.0 with default net mask of 255.255.255.0. But, if you have followed my previous article, you will note that this net mask makes only one network and our requirement is to create 4 networks.

**STEP2:- Subnetting**

Now, comes the concepts of multiple networks or ‘SUBNET’. To subnet i.e divide a network into 4 networks, I have to borrow as many bits that will make 4 networks from the Host part.

This formula will tell you the number of bits you need to borrow:-

Hence, If I borrow ‘1’ bit from Host, I can have 2 ^ 1 i.e 2 networks. If I borrow 2 bits, I can have 2^2 i.e 4 networks and so on.

I need 4 networks and hence as per calculations above, I will borrow 2 bits. Let’s see, how does borrowing pan out practically.

The default mask is

11111111:11111111:11111111:00000000

When I borrow 2 bits, this is how the net mask will look like

11111111:11111111:11111111:11000000

By doing this, you have broken 1 network into 4 networks. Each network here is called a ‘SUBNET’. Earlier, you calculated 254 hosts, look closely, will you have the same number of Hosts now?

After borrowing 2 bits, you are left with 6 ‘off’ bits. That converts to 2^6-2 = 62 hosts. If the earlier calculation meant that for 1 network, you can have 254 hosts, this time it means that for each network you can have 62 hosts. This will mean 248 hosts in total. Why this reduction in hosts from 254 to 248??

Did you notice the reduction of ‘2’ each time we calculated the number of hosts. Well, these are the 2 IP addresses reserved for ‘Network IP’ and ‘Broadcast IP’. These 2 IPs are not allowed to be allocated to hosts and these denote the start of a network and end of a network. Hence, for 4 networks/subnets, you have total of 8 IPs reserved on the basis of 2 for each network and hence 256-8 = 248.

Go back to the start of the article and read again. This will need some time to sink in.

**STEP3:- Allocating IP Addresses to Subnets & Hosts**

Ok, until now, we have divided the networks and calculated the number of hosts i.e 4 networks and 248 hosts. Now, comes the time to allocate the addresses to the networks and hosts.

First, translate the net mask after bit borrowing back to dotted decimal notation. It will translate to 255.255.255.**192 . **To calculate this, just add the place values of the ‘on’ bits in the 4^{th} octet. The ‘on’ bits have a place value of 128 and 64 totaling to 192 and hence the net mask of 255.255.255.192. Just simple revision, the Place values or block sizes are the values of the ‘on’ bits of an octet. Hence, the block sizes are 128,64,32,16,8,4,2,1.

Hence, now my IP address that I selected at the start i.e 192.168.10.0 has a net mask of 255.255.255.192. But still, what are the addresses of the 4 networks and hosts in them???

Look at the last bit that was borrowed in the host part and tell me what was the Block size or Place value. You are right, it is 64. If you are wrong, then look at this image, you will understand.

This means that each network block will be of 64. Hence the networks will be :-

Network 1 = 0 to 63

Network 2 = 64 to 127

Network 3 = 128 to 191

Network 4 = 192 to 255

Converting the above range into IP address range will look like this:-

Network 1:- 192.168.10.0 to 192.168.10.63

Network2:- 192.168.10.64 to 192.168.10.127

Network3:- 192.168.10.128 to 192.168.10.191

Network4:- 192.168.10.192 to 192.168.10.255

The first and last IPs are called ‘Network IP’ and ‘broadcast IP’ respectively. All Hosts should be between these. Hence, converting the above into valid hosts will give the below:-

Network1:- 192.168.10.1 to 192.168.10.62

Network 2:- 192.168.10.65 to 192.168.10.126

Network3:- 192.168.10.129 to 192.168.10.190

Network4:- 192.168.10.193 to 192.168.10.254

As a network administrator, I have just completed my task of bifurcating the network and allocating IPs. Network 1 will be called IT, Network 2 will be called Ops, Network 3 will be called HR and Network 4 will be called DMZ.

If all this looks overwhelming, it is fine. It is always at the start. Unknown territories are always scary. I started out as a novice in networking and in a couple of months cleared Cisco certification in Routing & Switching. So, I can endorse that it looks daunting at first, but very soon you get used to it and then it sure gets easy.

Try out these examples to tighten your grip around the concepts till now:-

- Find out the broadcast and network IP of

192.168.10.32 with subnet mask 255.255.255.224

192.168.10.124 with subnet mask 255.255.255.192

- I need a network with 10 hosts reserved for HR, 20 for IT and 35 for Operations. Please list out the Network and valid hosts
- I need a network with 20 hosts, 45 hosts,32 hosts and 120 hosts. Please list out the network and valid hosts. (Try this)