
Subnetting
On a standard network environment, usually there is only one network for example, let’s say 192.168.1.0/24.
Now, for management and security reasons you may need to split your network based on your devices, departments or for any other reason you may want.
You can effectively accomplish this by dividing your network into smaller networks. This is what the term subnetting refers to.
Lets look at the table below:
Using subnetting, we can manage our network structure in a more efficient way. Let’s use some examples in our network with devices. So let’s say that we have 100 devices in 4 different departments. For instance:
- Accounting Department has 50 Users (devices).
- Legal Department has 28 Users (devices).
- Sales Department has 16 Users (devices).
- IT Department has 4 Users (devices).
Firstly, we need to split our network; from the beginning we consider the maximum amount of devices we will need on the network. For practical reasons, the bit’s or last 8 digits of the IP address should be written down separately on paper. Because our IP is class C, the first 3 digits of the 255 bits show the network section; and the last digit with 255 bits show the host section. So we have:
NNN.NNN.NNN.HHH
N= Network
H= Host
xxxxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx
For the example, we will use 8 bits to start the practise and our network (above) will contain 50 hosts:
128 64 32 16 8 4 2 1
0 0 1 1 0 0 1 0
Here, we can see that we have 32+16+2 = 50. The network is 192.168.1.0-192.168.1.63.
192.168.1.0 is the network IP and 192.168.1.63 is the broadcast IP, so from 192.168.1.1 to 192.168.1.62 you can assign to hosts which is the reason we sometimes quoted 64-2 (one for Network IP and one for Broadcast IP) the rest are host IP’s.
Now we have the first network we can’t just go and connect one device with the default subnet mask. We need to assign a specific subnet mask. In our case instead of the default subnet mask which is 255.255.255.0, we need to put 255.255.255.192. The last number 192 comes from the 128+64 bits that equals 192 in total (the network section), this is calculated because the largest number we use in order to reserve our host’s (based on the count) is lower than 64. So, we have the first 2 bits as zero, and our networks after the subnetting is 192.168.1.0, 192.168.1.64, 192.168.1.128, 192.168.1.192 – so we have 4 networks, but how can the host’s be assigned to them?
Let’s see:
192.168.1.0 is the network IP, 192.168.1.63 is the broadcast IP and 192.168.1.1 – 192.168.1.62 are the Host’s IP’s.
192.168.1.64 is the network IP, 192.168.1.127 is the broadcast IP and 192.168.1.65 – 192.168.1.126 are the Host’s IP’s.
192.168.1.128 is the network IP, 192.168.1.191 is the broadcast IP and 192.168.1.129 – 192.168.1.190 are the Host’s IP’s.
192.168.1.192 is the network IP, 192.168.1.255 is the broadcast IP and 192.168.1.193 – 192.168.1.254 are the Host’s IP’s.
If you would like to confirm the above you can search for online Subnet calculators, here is one example: http://www.subnet-calculator.com/
VLSM
You may wonder “ok so I have 50 devices set up in the Accounting department and 28 in the Legal Department, but the remainder is 16 and 4 which is not good for a network for Sales and IT of up to 62 devices.” Well, there is an answer to that, the VLSM (Variable length subnet masking).
VLSM is the way to split subnets into smaller pieces based on our needs, so again, we need to start with the biggest network so in our case we will have 50 devices. So let’s set out our requirements and see how we can accommodate them effectively:
- For 50 users, we can keep the 192.168.1.0/26 (255.255.255.192) that can give us up to 62 users.
- For 28 users we can use 192.168.1.64 (the second network) /27 (255.255.255.224) which gives us 30 users in total.
- For 16 users we can use 192.168.1.96/27 (255.255.255.224) that can provide up to 30 users again (it is over 16 users so we take the 16 bit as well as the rest).
128 64 32 16 8 4 2 1
0 0 0 1 0 0 0 0
Now, for the rest of the users we need to take the next subnet 192.168.1.128/29 (255.255.255.248) using an online VLSM calculator, we can double check and confirm our results as follows:
Subnetting Successful
Major Network: 192.168.1.0/24.
Available IP addresses in major network: 254.
Number of IP addresses needed: 98.
Available IP addresses in allocated subnets: 128.
About 53% of available major network address space is used.
About 77% of subnetted network address space is used.
By putting these figures into a pie chart we can see that:
Within subnetting, we have the ability to split our network into smaller pieces and in combination with the VLSM we can split them based on our needs without losing useful IP’s, you can see in above diagram there are still 50% of IP’s free for future usage.