Subnetting (Class C)


This is the process of dividing a parent network into sub-networks. Subnetting an IP Network can be done for a variety of reasons, preservation of address space (ie, avoiding IP wastage), simplified administration and security. The most common reason is to control network traffic.


Why do we divide the parent network to sub-networks?
Consider a ‘Firm’, which has three departments ‘Quality’ (with 10  PC’s), ‘HR’ (with 10 PC’s) and ‘Account’ (with 5 PC’s).
Our requirement is that the PC’s in the relevant departments should be able to communicate with each other but not with PC’s in other departments, the reason being data privacy. One way to resolve this issue is by giving 3 different IP addresses for each department - 200.200.200.0, 210.210.210.0 and 220.220.220.0 respectively. However, doing so will lead to wastage of IP addresses. So the best practice is to determine the parent network of a given one IP address and then subnet them into sub networks.


Main formulas used for subnetting IP addresses:

m = number of bits taken for subnetting
n = the remaining bits in the host portion

Number of Networks = 2m – 2
Number of Hosts per Subnet = 2n – 2
Base Value = 2n
Mask Portion = 256 – Base Value
New Subnet Mask = Default Mask + Mask Portion in the subnetted octet
1st Network = Parent network + Base Value in the subnetted octet
Last network = Mask Portion – Base Value in the subnetted octet
1st host of the 1st  network = 1st network + 1, in the last octet
Broadcast of the 1st network = Second network -1, in the last octet
Last host of First network = Broadcast address – 1, in the last octet            
Next network = Given network + Base value in the subnetted octet
Last network = Mask Portion – Base value in the subnetted octet
Broadcast of the last network = Mask Portion – 1, in the last octet


Class C Subnetting -


Say you are assigned a Class C network number of 200.133.175.0. You want to utilize this network across multiple small groups within an organization. Extending this by 4 bits gives us 16 possible network numbers, 2 of which cannot be used;

Network Number
Host Address (1st thru Last)
Broadcast Address
200.133.175.0
Reserved
None
200.133.175.16
.17 thru .30
200.133.175.31
200.133.175.32
.33 thru .46
200.133.175.47
200.133.175.48
.49 thru .62
200.133.175.63
200.133.175.64
.65 thru .78
200.133.175.79
200.133.175.80
.81 thru .95
200.133.175.95
200.133.175.96
.97 thru .110
200.133.175.111
200.133.175.112
.113 thru .126
200.133.175.127
200.133.175.128
.129 thru .142
200.133.175.143
200.133.175.144
.145 thru .158
200.133.175.159
200.133.175.160
.161 thru .174
200.133.175.175
200.133.175.176
.177 thru .190
200.133.175.191
200.133.175.192
.193 thru .206
200.133.175.207
200.133.175.208
.209 thru .222
200.133.175.223
200.133.175.224
.225 thru .238
200.133.175.239
200.133.175.240
Reserved
None
 
Table Explained:
The 2 network numbers that cannot be used are 200.133.175.0 and 200.133.175.240.
First you need to determine ‘m’ and ‘n’ values.
As we are extending by 4 bits, m = 4
Sometimes the IP address maybe given like this, 200.133.175.0 / 28, from which you will have to find the value of m. Here the value 28 is called CIDR (Classless Inter Domain Routing). The default CIDR notifications for each class are;

Class C = 24, N8 . N8 . N8 . H
Class B = 16, N8 . N8 . H  . H
Class A = 8,   N8 . H  . H  . H

Also you need to know the default mask for each class;

Class C = 255.255.255.0
Class B = 255.255.0.0
Class A = 255.0.0.0

First you need to find out which class the IP address belongs to. Looking at the first octet value, 200, it is a Class C address. A Class C address has only one host (8 bits in total), so the last octet will be the subnetted octet. The default CIDR value for class C is 24, so m = 28 – 24 = 4 bit. Now, n = 4 (remaining bits in the host portion, as Class C has only one host part and the total bit in the host portion is 8bits)

Base Value = 2n = 24 = 16
Mask Portion = 256 – Base Value = 256 – 16 = 240
Number of networks = 2m – 2 = 24 – 2 = 14
Number of hosts = 2n – 2 = 24 – 2 = 14
Subnet Mask address (SNM) = 255.255.255.240
From the table the 1st network is 200.133.175.16, which is obtained by adding the Base Value to the subnetted octet of the Parent network. 2nd network is obtained by again adding the Base Value to the last octet of the 1st network, ie 200.133.175.32 and so on ….

To find the 1st host of the 1st network all you have to do is just add ‘1’ to the last octet of the 1st network,
200.133.175.(16+1)
200.133.175.17 is the 1st host of the 1st network

To find the Broadcast network of the 1st network all you need to do is subtract ‘1’ from the last octet of the 2nd network,
200.133.175.(32-1)
200.133.175.31 is the Broadcast network for the 1st network

To find the last host network of the 1st network, you just need to subtract ‘1’ from the last octet of the Broadcast network of the 1st network, ie
200.133.175.(31-1)
200.133.175.30 is the last host network of the 1st network

Last network is obtained as follows;
200.133.175.[Mask Portion – Base Value]
ie 200.133.175.(240-16)
ie 200.133.175.224 

To find the Broadcast network of the last network all you need to do is subtract ‘1’ from the Mask Portion and then replace the last octet with this value, ie
240 – 1 = 239
200.133.175.239 is the Broadcast network for the last network
 

Another example for Class C subnetting;
Subnet the given IP address 198.169.1.0/30 ?
Let us try to do this using the formula's.
The CIDR value given is 30, so we need to find out the number of bits to extend this IP.
CIDR value of Class C is 24
So the number of bits to extend this IP is 30 - 24 = 6
This is a 6 bit subnetting. So m = 6 and n = 2 (remaining host bits)
Base  =  22= 4
Number of networks =  2m – 2 =  26 – 2 = 64
Number of hosts = 2n – 2 =  22 – 2 = 2
Mask Portion = 256 - Base value = 256 - 4 = 252
Sub Net Mask (SNM) = 255.255.255.252
Subnetting we get;

Network Number
1st host address
Last host address
Broadcast address
198.169.1.4
198.169.1.5
198.169.1.6
198.169.1.7
198.169.1.8
198.169.1.9
198.169.1.10
198.169.1.11
198.169.1.12
198.169.1.13
198.169.1.14
198.169.1.15
198.169.1.16
198.169.1.17
198.169.1.18
198.169.1.19
198.169.1.20
198.169.1.21
198.169.1.22
198.169.1.23
.
.
.
.
.
.
.
.
.
.
.
.
198.169.1.248
198.169.1.249
198.169.1.250
198.169.1.251
 
We start with a parent network 198.169.1.0 ( Parent network is got by replacing the host part of thegiven network with '0')
Inorder to find the first network we use the formula;
First network = Parent network + Base value, in the subnetted octet
ie, 198.169.1.0 + 0.0.0.4 = 198.169.1.4 
1st host of the  1st network =  1st network + 1, in the last octet

ie, 198.169.1.4 + 0.0.0.1 = 198.169.1.5
Second network = 1st network + Base value, in the subnetted octet
ie, 198.169.1.4 + 0.0.0.4 = 198.169.1.8
Broadcast address of the first network =   1st network - 1, in the last octet
ie, 198.169.1.8 - 0.0.0.1 = 198.169.1.7
Last host of the first network = Broadcast host of the first network - 1, in the last octet
ie, 198.169.1.7 - 0.0.0.1 = 198.169.1.6
This gives us the first line in the table;
198.169.1.4        198.169.1.5        198.169.1.6        198.169.1.7 
          


Similarly, we do the same steps with the second network that we have which is 198.169.1.8

1st host of the  2nd network = 198.169.1.8 + 0.0.0.1 = 198.169.1.9
Third or Next network = 198.169.1.8 + 0.0.0.4 = 198.169.1.12
Broadcast of the 2nd network = 198.169.1.12 - 0.0.0.1 = 198.169.1.11
Last host of the  2nd network = 198.169.1.11 - 0.0.0.1 = 198.169.1.10
This gives us the second line in the table;
198.169.1.8        198.169.1.9        198.169.1.10        198.169.1.11      
 
As the number of networks is 62 it will take a lot of time for you to write all the networks to get to the last network. But we have a formula to find the last network for the given IP address;
Last network = Mask Portion - Base value, in the subnetted octet
ie, 198.169.1.252 - 0.0.0.4 = 198.169.1.248


1st host of the last network = 198.169.1.248 + 0.0.0.1 = 198.169.1.249
Broadcast of the last network = Mask Portion - 1, in the last octet
ie, 198.169.1.252 - 0.0.0.1 = 198.169.1.251
Last host of the last network = Broadcast of the last network - 1, in the last octet
ie, 198.169.1.251 - 0.0.0.1 = 198.169.1.250
This gives us the last line in the table;
198.169.1.248        198.169.1.249        198.169.1.250        198.169.1.251

Another example for Class C subnetting;
Subnet the given IP address 192.168.1.0/29 ?
CIDR = 29
The number of bits to extend the given IP = 29 - 24 = 5
m = 5 ; n = 3
Base value = 2n 23 = 8
Mask Portion = 256 - 8 = 248
No. of networks = 2m - 2 =  25 - 2 = 30         
No. of hosts = 2n - 2 =  23 - 2 = 6
SNM = 255.255.255.248
So by 5 bit subnetting we get;

Network Number
1st host address
Last host address
Broadcast address
192.168.1.8
192.168.1.9
192.168.1.14
192.168.1.15
192.168.1.16
192.168.1.17
192.168.1.22
192.168.1.23
192.168.1.24
192.168.1.25
192.168.1.30
192.168.1.31
192.168.1.32
192.168.1.33
192.168.1.38
192.168.1.39
192.168.1.40
192.168.1.41
192.168.1.46
192.168.1.47
.
.
.
.
.
.
.
.
.
.
.
.
192.168.1.240
192.168.1.241
192.168.1.246
192.168.1.247