Subnetting Tutorial
Subnetting is the process of dividing a network into smaller subnetworks or subnets. It allows for efficient use of IP addresses and helps in organizing network resources. In this tutorial, I’ll explain the basics of subnetting and provide examples to illustrate the concepts. Let’s get started!
Table of Contents
Understanding IP Addresses
Subnet Mask
Network Address and Broadcast Address
Subnetting Examples
Example 1: Creating Two Subnets
Example 2: Creating Multiple Subnets
Understanding IP Addresses
An IP (Internet Protocol) address is a unique identifier assigned to each device connected to a network. It consists of four numbers separated by periods, such as 192.168.0.1. Each number can range from 0 to 255, giving a total of 2^32 (approximately 4.3 billion) unique IP addresses.
Subnet Mask
A subnet mask is a 32-bit value that separates the IP address into network and host portions. It is represented in dotted decimal notation, just like an IP address. The subnet mask consists of a series of consecutive 1s followed by a series of consecutive 0s.
For example, a subnet mask of 255.255.255.0 (or /24 in CIDR notation) means that the first 24 bits of the IP address represent the network portion, and the remaining 8 bits represent the host portion.
Network Address and Broadcast Address
In each subnet, there are two special addresses: the network address and the broadcast address.
Network Address: It is the first address in a subnet and represents the network itself. In an IP address, the host portion is set to all zeros. For example, if the IP address is 192.168.0.0 with a subnet mask of 255.255.255.0, the network address would be 192.168.0.0.
Broadcast Address: It is the last address in a subnet and is used to send a message to all devices within the subnet. In an IP address, the host portion is set to all ones. Using the same example as above, the broadcast address would be 192.168.0.255.
Subnetting Examples
Let’s go through a couple of examples to understand how to subnet an IP address.
Example 1: Creating Two Subnets
Suppose you have been allocated the IP address range 192.168.0.0/24 and you need to create two subnets from this range.
Step 1:
Determine the number of bits required to represent the desired number of subnets. In this case, we need two subnets, which can be represented using one additional bit (2 = 2^1).
Step 2:
Calculate the new subnet mask. Since we need one additional bit, the subnet mask becomes /25 (24 + 1 = 25). In binary, it would be 11111111.11111111.11111111.10000000, which translates to 255.255.255.128 in decimal notation.
Step 3:
Determine the range of IP addresses for each subnet. The first subnet will have the network address of 192.168.0.0 (same as the original network address) and the broadcast address of 192.168.0.127. The second subnet will have the network address of 192.168.0.128 and the broadcast address of 192.168.0.255.
Here’s a summary of the subnets created
Subnet 1:
Network Address: 192.168.0.0
Broadcast Address: 192.168.0.127
Subnet 2:
Network Address: 192.168.0.128
Broadcast Address: 192.168.0.255
Example 2: Creating Multiple Subnets
Let’s consider a larger example where we need to create multiple subnets from the IP address range 10.0.0.0/24.
Step 1:
Determine the number of bits required to represent the desired number of subnets. Let’s say we need 8 subnets, which can be represented using three additional bits (8 = 2^3).
Step 2:
Calculate the new subnet mask. Since we need three additional bits, the subnet mask becomes /27 (24 + 3 = 27). In binary, it would be 11111111.11111111.11111111.11100000, which translates to 255.255.255.224 in decimal notation.
Step 3:
Determine the range of IP addresses for each subnet. The first subnet will have the network address of 10.0.0.0 (same as the original network address) and the broadcast address of 10.0.0.31. The second subnet will have the network address of 10.0.0.32 and the broadcast address of 10.0.0.63. Similarly, you can calculate the network and broadcast addresses for the remaining subnets.
Here’s a summary of the subnets created (using decimal notation for simplicity):
Subnet 1:
Network Address: 10.0.0.0
Broadcast Address: 10.0.0.31
Subnet 2:
Network Address: 10.0.0.32
Broadcast Address: 10.0.0.63
Subnet 3:
Network Address: 10.0.0.64
Broadcast Address: 10.0.0.95
Subnet 4:
Network Address: 10.0.0.96
Broadcast Address: 10.0.0.127
Subnet 5:
Network Address: 10.0.0.128
Broadcast Address: 10.0.0.159
Subnet 6:
Network Address: 10.0.0.160
Broadcast Address: 10.0.0.191
Subnet 7:
Network Address: 10.0.0.192
Broadcast Address: 10.0.0.223
Subnet 8:
Network Address: 10.0.0.224
Broadcast Address: 10.0.0.255
These examples demonstrate how to subnet an IP address range into smaller subnets. By dividing a network into subnets, you can efficiently manage IP addresses and organize network resources based on your requirements.