Welcome to our comprehensive guide on Subnet Masks! This tutorial is designed for beginners and intermediate learners, so let's dive right in.
A Subnet Mask is a bit pattern that's used to divide an IP address into two parts: the Network Address and the Host Address. It helps in network segmentation and efficient management of internet resources.
Subnet Masks are essential for network segmentation. By dividing an IP address into networks and hosts, we can:
Before we dive into Subnet Masks, let's understand binary numbers. An IP address and Subnet Mask are represented in binary format. Each number has 32 bits, but we usually work with the first 3 octets (8 bits each) for the IP address and the 4th octet for the Subnet Mask.
A Subnet Mask is typically written in decimal notation (e.g., 255.255.255.0). However, it's important to know that it's composed of 1s and 0s in binary notation. For example, the Subnet Mask 255.255.255.0 is represented as 11111111.11111111.11111111.00000000 in binary.
Classless subnetting is a more flexible approach that allows us to divide an IP address range into smaller networks. In contrast, classful subnetting, which is based on the original IP address classes (A, B, C, D, and E), divides the IP address space rigidly.
With a Subnet Mask, we can determine the number of subnets and hosts in a network. The formula for finding the number of subnets is 2^(number of 1s in the Subnet Mask). For hosts, the formula is 2^(total bits in the host field) - 2.
Now that you understand the basics, let's look at some practical examples.
Example 1 - Classful Subnetting
IP Address: 192.168.1.0 Subnet Mask: 255.255.255.0
Example 2 - Classless Subnetting
IP Address Range: 192.168.1.0 - 192.168.1.255 Subnet Mask: 255.255.255.128
What is the purpose of a Subnet Mask in a network?
What is the difference between Classless and Classful Subnetting?