# Free Class C Subnetting Tutorial, What is CIDR, Subnet Mask, Directed and Limited Broadcast

This lesson is only a part of a series of IPv4 subnetting lessons. Please visit below links in order to learn IPv4 subnetting completely.

In this Class C Subnetting Tutorial - Part 1, you will learn how to subnet a Class C network. You need good knowledge about binary number system and the conversions between decimal to binary and binary to decimal. Click the following link to learn more about binary and hexadecimal number system. Please use the inbuilt calculator in your computer only to verify the calculations you did manually are correct or not. Click the following link to learn how to use the inbuilt calculator in Windows Operating System for binary, decimal and hexadecimal number conversions.

Subnetting (RFC 950) is the process of dividing any classful IP network (Class A, Class B, or Class C network) into smaller networks.

Before proceeding further deep into subnetting, we should know these terms.

## What is Subnet Mask?

If we recollect from the previous lessons, an IPv4 address has two components, the network part and the host part. Really, IPv4 address is a combination of IPv4 address and Subnet mask and the purpose of subnet mask is to identify which part of an IPv4 address is the network part and which part is the host part. Subnet mask is also a 32 bit number where all the bits of the network part are represented as "1" and all the bits of the host part are represented as "0".

If we take an example for a Class C network, 192.168.10.0, the address part and the subnet mask can be represented as below.

Component Binary Decimal
Address Part 11000000.10101000.00001010.00000000 192.168.10.0
Subnet Mask 11111111.11111111.11111111.00000000 255.255.255.0

For a Class C IPv4 address, the first three octets are used to represent the network part and the last octet is used to represent the host part. From the above table, for subnet mask, we can see all "1" in the network part and all "0" in the host part. When this subnet mask represented in binary number is converted to equivalant decimal number, it will become 255.255.255.0. The default subnet mask for a Class C network is 255.255.255.0, Class B network is 255.255.0.0 and Class A network is 255.0.0.0.

## What is a Network Address?

A network address is used to identify the subnet that a host may be placed on and is used to represent that network. We can find the network address by assigning all bits in the host part as 0.

## What is Directed Broadcast?

The host part values containing all 1's in the binary bit pattern indicates a directed broadcast address. A directed broadcast address can appear as the destination IPv4 address in an IPv4 datagram, but never as a source IPv4 address. A directed broadcast message will be seen by all nodes on that network.

An example of directed broadcast IPv4 address is shown next. The directed broadcast address for the network 192.168.10.0 will be 192.168.10.255, where all host bits are "1". In other words, directed broadcast IPv4 address is the last IPv4 address in that subnet block.

A directed broadcast is sent to a specific network identified in the Network part of the IPv4 address. Routers on the network configured to forward directed broadcasts will send the IP datagram to the final router that connects the destination specified in the network part, and the router at the destination network should forward it to the destination host.

## What is Limited Broadcast?

Limited broadcast is another type of broadcast, sent to destination IPv4 address of 255.255.255.255. The limited broadcast can be used in Local Area Networks (LAN), where a broadcast never crosses a router to reach another network. If a broadcast is to be done over the local network, you can use the limited broadcast. A limited broadcast address can never appear as a source IPv4 address; it can appear only as a destination IPv4 address in an IPv4 datagram.

## What is CIDR?

Classless Inter-Domain Routing (CIDR, RFC 1517, RFC 1518, RFC 1519, RFC 1520) was published in 1993 to keep the internet from running out of IPv4 addresses. The "classful" system of allocating IPv4 addresses can waste many IPv4 addresses. Any organization who need just a few IPv4 addresses more than 254 must get a Class B address block of 65533 IPv4 addresses. Even much more IPv4 addresses are wasted in the case of Class A, where total usable IPv4 addresses per network is 16777214 ((2^24) - 2).

The original "IPv4 Class A networks" uses 8 bits to represent the network part, "Class B networks" uses 16 bits to represent the network part and "Class C networks" uses 24 bits to represent the network part. CIDR replaced these categories with a more generalized network prefix. This network prefix could be of any length, not just 8, 16, or 24 bits.

For example; 172.16.120.213 255.255.128.0 can be represented in CIDR format as 172.16.120.213/17, because there are 17 bits used for network part.

Classless Inter-Domain Routing (CIDR) includes supernetting (supernetting is the method of using contiguous blocks of address spaces to simulate a single, larger, address space), VLSM (Variable Length Subnet Masking, a method of subnetting a subnet) and route aggregation (method representing multiple networks using a single entry in a router's routing table. This can greatly reduce the size of the routing tables in routers).

## Subnetting Equations

Before continuing further, please visit following lessons and learn binary to decimal conversion and decimal to binary conversion thoroughly.

Below equation is used to calculate how many possible combinations of bit patterns we can make from an n-bit binary number. Let us take an example of a 3-bit binary number. We can find the number of possible combinations of bits by using the below equation, 2n. Since we are discussing about a 3-bit number, substitute "n" with 3. That is 23, which is equal to eight. To understand above equation, let us write the possible combinations of numbers we can make from a 3-bit binary number. In this case, the possible combinations of three bits are 000, 001, 010, 011, 100, 101, 110 and 111. We have eight combinations of bits from a 3-bit binary number. The decimal equivalant of these eight combinations of bits in order are 0, 1, 2, 3, 4, 5, 6 and 7. So, we have eight decimal numbers from a 3-bit binary number.

When we learn about binary to decimal and decimal to binary conversions related with computer networking at first time, a confusion about two equations always arise. One is the above equation (2n) and the other one is the below equation ([2n)-1]). So, where the above equation (2(n))-1 is used? The equation (2(n))-1 is used to find the highest value decimal number we can get from a n-bit binary number. Again, let us take the example of a 3-bit binary number. To find the highest value decimal number we get from a 3-bit binary number, let us subsitute "n" in the equation (2(n))-1 with 3. That is (2(3))-1, which is equal to (8-1) = 7. To verify the answer is correct or not, let us convert above combination of a 3-bit binary numbers to decimal numbers. What are the equivalant of above combination of binay numbers in decimals? The equivalant bit combinations of binary numbers 000, 001, 010, 011, 100, 101, 110 and 111 in decimal number system are 0, 1, 2, 3, 4, 5, 6 and 7. The highest value decimal number we can make from a 3-bit binary number is seven.

When we make combinations of bits of binary numbers, always "0" also will be present. Hence, the highest value decimal number we can get from a binary number will be always one less than the possible bit combinations.

### How to find the number of subnets

The equation 2n can be used to find how many subnets we will get from subnetting a network or to find how many usable IPv4 addresses are there in each subnet for Class A network, Class B network and Class C network.

To find the number of subnets, please use below equation. To apply the equation in an example to find the number of subnets we get from subnetting, please refer Class C 3-bit subnetting tutorial section, which is at the bottom of this lesson. We have three bits in network part, so the number of subnets will be 23, which is equal to eight subnets.

### How to find the number of usable IPv4 addresses in a subnet

Since the first and the last IPv4 addresses in each subnet block are used to represent its network address and the directed broadcast address, you cannot use them to configure the devices inside your network. Hence, to find the number of usable IPv4 addresses in each subnet, please use below equation. We are deducting two to exclude network address and the directed broadcast address from the total number of available IPv4 addresses in each subnet. Again, use the Class C 3-bit subnetting tutorial section as an example. We have five bits in the host part, so the number of usable IPv4 addresses (after deducting network address and the directed broadcast address) in each subnet will be (2(5))-2, which is equal to (32-2) = 30.

## Class C Subnetting Tutorial

Subnetting is done by taking the bit/s from host part and adding it to the network part. Consider the same Class C example given above. Remember, the first three octets of a Class C network is used to represent the network and the last octet is used to represent the host. The default format for a Class C IPv4 address is Network.Network.Network.Host.

To make things easy, you may remember this.

If all the bits in the host part are "0", that represents the network id.

If all the bits in the host part are "0" except the last bit, it is the first usable IPv4 address.

If all the bits in the host part are "1" except the last bit, it is the last usable IPv4 address.

If all the bits in the host part are "1", that represents the directed broadcast address.

All the IPv4 addresses in a subnet block, except network address and directed broadcast address (the first and last IPv4 addresses in a subnet block), can be used to configure the devices in your network. You cannot use network address or directed broadcast address as IPv4 address for devices inside your network.

### Class C 1-bit subnetting tutorial

Let us try to visualize the unsubnetted Class C network 192.168.10.0 with default subnet mask 255.255.255.0 using below image. Network address is 192.168.10.0, first usable IPv4 address is 192.168.10.1, second usable IPv4 address is 192.168.10.2, third usable IPv4 address is 192.168.10.3 ...... up to last usable IPv4 address 192.168.10.254 and the broadcast address 192.168.10.255. Consider the example of Class C network 192.168.10.0 255.255.255.0, we discussed above. If we include one bit from the host part to the network part in the last octet, the default subnet mask of Class C network 255.255.255.0 is changed into 255.255.255.128. The single bit that is added to the network part from the host part, in the last octet, can have two possible values. Those two possible values are either 0 or 1.

That means, we can get two subnets if we do a single bit subnetting for a Class C network.

Please refer below image. SN No Description Binaries Decimal
1 Network Address 11000000.10101000.00001010.00000000 192.168.10.0
First IPv4 address 11000000.10101000.00001010.00000001 192.168.10.1
Last IPv4 address 11000000.10101000.00001010.01111110 192.168.10.126
2 Network Address 11000000.10101000.00001010.10000000 192.168.10.128
First IPv4 address 11000000.10101000.00001010.10000001 192.168.10.129
Last IPv4 address 11000000.10101000.00001010.11111110 192.168.10.254

The network 192.168.10.0 is divided into two subnets, each subnet has 128 total IPv4 addresses and 126 usable IPv4 addresses. Two IPv4 addresses are used in each subnet to represent the network address and the directed broadcast address. The subnet mask for 1-bit subnetting for a Class C network is 255.255.255.128.

Visualization of 1-bit subnetting of Class C network 192.168.10.0 with subnet mask 255.255.255.128 is given below.

Subnet 1 has its network address 192.168.10.0 with a subnet mask of 255.255.255.128. First usable IPv4 address is 192.168.10.1, second usable IPv4 address is 192.168.10.2, third usable IPv4 address is 192.168.10.3 ...... up to last usable IPv4 address 192.168.10.126 and the broadcast address 192.168.10.127.

Subnet 2 has its network address 192.168.10.128 with a subnet mask of 255.255.255.128. First usable IPv4 address is 192.168.10.129, second usable IPv4 address is 192.168.10.130, third usable IPv4 address is 192.168.10.131 ...... up to last usable IPv4 address 192.168.10.254 and the broadcast address 192.168.10.255. A genuine question. Seems everything is good, but what is the difference between unsubnetted Class C network having subnet mask of 255.255.255.0 and its two subnets with subnet mask of 255.255.255.128?

If we use the subnet mask of 255.255.255.0, all the IPv4 addresses from 192.168.10.1 to 192.168.10.254 are in the same network. Direct IPv4 communication is possible between all the devices with IPv4 addresses from 192.168.10.1 to 192.168.10.254.

Please refer below image. The IPv4 address 192.168.10.100 and 192.168.10.200 can communicate directly using IPv4 if we use the subnet mask of 255.255.255.0. If we use the subnet mask of 255.255.255.128, the IPv4 addresses from 192.168.10.1 to 192.168.10.126 are in the one subnet and 192.168.10.129 to 192.168.10.254 are in another subnet . Direct IPv4 communication is not possible between the devices configured with IPv4 addresses belongs to the first subnet and the second subnet. You need a router or routing capable devices like a firewall to connect devices having IPv4 addresses belongs those two different subnets.

Please refer below image. The IPv4 address 192.168.10.100 and 192.168.10.200 cannot communicate directly using IPv4, if we use the subnet mask of 255.255.255.128. The IPv4 address 192.168.10.100 belongs to the first subnet and 192.168.10.200 belongs to the second subnet. Since they belong to different subnets, direct IPv4 communication is not possible. You need a router to connect the devices configured with IPv4 addresses of two different subnets to enable IPv4 communication. ### Class C 2-bit subnetting tutorial

If we include two bits from the host part to the network part in the last octet, the default subnet mask of Class C network 255.255.255.0 is changed into 255.255.255.192. The two bits added to the network part from the host part, in last octet, can have four possible values. Those four possible values are 00, 01, 10 and 11.

That means, we get four subnets if we do a 2-bit subnetting for a Class C network.

Please refer below image. SN No Description Binaries Decimal
1 Network Address 11000000.10101000.00001010.00000000 192.168.10.0
First IPv4 address 11000000.10101000.00001010.00000001 192.168.10.1
Last IPv4 address 11000000.10101000.00001010.00111110 192.168.10.62
2 Network Address 11000000.10101000.00001010.01000000 192.168.10.64
First IPv4 address 11000000.10101000.00001010.01000001 192.168.10.65
Last IPv4 address 11000000.10101000.00001010.01111110 192.168.10.126
3 Network Address 11000000.10101000.00001010.10000000 192.168.10.128
First IPv4 address 11000000.10101000.00001010.10000001 192.168.10.129
Last IPv4 address 11000000.10101000.00001010.10111110 192.168.10.190
4 Network Address 11000000.10101000.00001010.11000000 192.168.10.192
First IPv4 address 11000000.10101000.00001010.11000001 192.168.10.193
Last IPv4 address 11000000.10101000.00001010.11111110 192.168.10.254

The network 192.168.10.0 is divided into four subnets, each subnet has 64 total IPv4 addresses and 62 usable IPv4 addresses. Two IPv4 addresses are used in each subnet to represent the network address and the directed broadcast address. The subnet mask for 2-bit subnetting for a Class C network is 255.255.255.192.

Visualization of 2-bit subnetting of Class C network 192.168.10.0 with subnet mask 255.255.255.192 is given below. ### Class C 3-bit subnetting tutorial

If we include three bits from the host part to the network part in last octet, the default subnet mask of Class C network 255.255.255.0 is changed into 255.255.255.224. The three bits added to the network part from the host part in the last octet can have eight possible values. Those eight possible values are 000, 001, 010, 011, 100, 101, 110 and 111.

That means, we get eight subnets if we do a 3-bit subnetting for a Class C network.

Please refer below image. SN No Description Binaries Decimal
1 Network Address 11000000.10101000.00001010.00000000 192.168.10.0
First IPv4 address 11000000.10101000.00001010.00000001 192.168.10.1
Last IPv4 address 11000000.10101000.00001010.00011110 192.168.10.30
2 Network Address 11000000.10101000.00001010.00100000 192.168.10.32
First IPv4 address 11000000.10101000.00001010.00100001 192.168.10.33
Last IPv4 address 11000000.10101000.00001010.00111110 192.168.10.62
3 Network Address 11000000.10101000.00001010.01000000 192.168.10.64
First IPv4 address 11000000.10101000.00001010.01000001 192.168.10.65
Last IPv4 address 11000000.10101000.00001010.01011110 192.168.10.94
4 Network Address 11000000.10101000.00001010.01100000 192.168.10.96
First IPv4 address 11000000.10101000.00001010.01100001 192.168.10.97
Last IPv4 address 11000000.10101000.00001010.01111110 192.168.10.126
5 Network Address 11000000.10101000.00001010.10000000 192.168.10.128
First IPv4 address 11000000.10101000.00001010.10000001 192.168.10.129
Last IPv4 address 11000000.10101000.00001010.10011110 192.168.10.158
6 Network Address 11000000.10101000.00001010.10100000 192.168.10.160
First IPv4 address 11000000.10101000.00001010.10100001 192.168.10.161
Last IPv4 address 11000000.10101000.00001010.10111110 192.168.10.190
7 Network Address 11000000.10101000.00001010.11000000 192.168.10.192
First IPv4 address 11000000.10101000.00001010.11000001 192.168.10.193
Last IPv4 address 11000000.10101000.00001010.11011110 192.168.10.222
8 Network Address 11000000.10101000.00001010.11100000 192.168.10.224
First IPv4 address 11000000.10101000.00001010.11100001 192.168.10.225
Last IPv4 address 11000000.10101000.00001010.11111110 192.168.10.254 