computer network - Basics of Subnetting
Subnetting allows you to create multiple logical networks that exist within a single Class A, B, or C network. If you do not subnet, you are only able to use one network from your Class A, B, or C network, which is unrealistic.
Some benefits of Subnetting:
- Reduced Network Traffic
- Optimized Network Performance
- Simplified Management
- Facilitated Spanning of Large Geographical Distances
How to Create Subnets:
To create subnetworks, you take bits from the host portion of the IP address and reserve them to define the subnet address. This means fewer bits for hosts, so the more subnets, the fewer bits are left available for defining hosts.
Now we are going to learn how to create subnets, starting with Class C addresses. But before we actually implement subnetting, we really need to determine our current requirements as well as plan for future conditions.
We are following these steps to do subnetting:
1. Determine the number of required network IDs:
- One for each subnet
- One for each wide area network (WAN) connection
2. Determine the number of required host IDs per subnet:
- One for each TCP/IP host
- One for each router interface
3. Based on the previous requirements, create the following:
- One subnet mask for your entire network
- A unique subnet ID for each physical segment
- A range of host IDs for each subnet
For the subnet address scheme to work, every machine on the network must know which part of the host address will be used as the subnet address.
A subnet mask is a 32-bit value that allows the recipient of IP packets to distinguish the network ID portion of the IP address from the host ID portion of the IP address.
Not all networks need subnets, meaning they use the default subnet mask.
Class Format Default subnet mask
A network.host.host.host 255.0.0.0
B network.network.host.host 255.255.0.0
C network.network.network.host 255.255.255.0
CIDR (Classless Inter-Domain Routing):
It provides the flexibility of borrowing bits of Host part of the IP address and using them as Network in Network, called Subnet. By using subnetting, one single Class A IP address can be used to have smaller sub-networks which provides better network management capabilities.
Subnet Mask CIDR value
Please note that the /8 through /15 can be used only with Class A network addresses; /16 through /23 can be used by Class A and B network addresses; /24 through /30 can be used by Class A, B, and C network addresses. This is a big reason why most companies use Class A network addresses. By being allowed the use of all subnet masks, they gain the valuable benefit of maximum flexibility for their network design.
Subnetting Class C Addresses:
There are many different ways to subnet a network. In a Class C address, only 8 bits are available for defining the hosts. Remember that subnet bits start at the left and go to the right, without skipping bits. This means that the only Class C subnet masks can be those listed here:
Binary Decimal CIDR
00000000 0 /24
10000000 128 /25
11000000 192 /26
11100000 224 /27
11110000 240 /28
11111000 248 /29
11111100 252 /30
We can't use a /31 or /32 because, we have to leave at least 2 host bits for assigning IP addresses to hosts.
Subnetting a Class C Address:
When you've chosen a possible subnet mask for your network and need to determine the number of subnets, valid hosts, and broadcast addresses of a subnet that the mask provides, all you need to do is answer five simple questions:
- How many subnets does the chosen subnet mask produce?
- How many valid hosts per subnet are available?
- What are the valid subnets?
- What's the broadcast address of each subnet?
- What are the valid hosts in each subnet?
Example as follows
Because 128 is 10000000 in binary, there is only 1 bit for subnetting, and there are 7 bits for hosts. We're going to subnet the Class C network address 192.168.10.0.
192.168.10.0 = Network address AND 255.255.255.128 = Subnet mask
Now, let's answer the above five questions:
- How many subnets?
Formula is: 2x = number of subnets. x is the number of masked bits, or the 1s.
Because 128 is 1 bit on (10000000), the answer is 21=2
- How many hosts per subnet?
Formula is: 2Y-2 = number of hosts per subnet. y is the number of unmasked bits, or the 0.
We have 7 host bits off (10000000), so the equation is 27-2=126 hosts.
- What are the valid subnets?
Formula is: 256-subnet mask = block size, or increment number.
So, 256-128=128. Remember, we'll start at zero and count in our block size, so our subnets are 0, 128.
- What's the broadcast address for each subnet?
The number right before the value of the next subnet is all host bits turned on and equals the broadcast address. For the 0 subnet, the next subnet is 128, so the broadcast of the 0 subnet is 127.
- What are the valid hosts?
These are the numbers between the subnet and broadcast address. The following table shows the 0 and 128 subnets, the valid host ranges of each, and the broadcast address of both subnets:
Now you can use this method to find of subnetting of every CIDR value and any IP address you have. You just follow above steps.