Subnetting is the process of dividing larger network into smaller, manageable segments. In IP subnetting, every segment is isolated, making it difficult for intruders to access the entire network, thereby enhancing security. IP subnetting also reduces broadcast traffic and congestion in the network, improving the performance of the network. Therefore, managing a smaller network is more efficient as it is easier to focus on smaller segments rather than the entire network. Apart from improved security and efficiency, there are several reasons why IP subnetting is effective for networks. In this page, we will explore what an IP subnet is, the basics of IP subnetting, various subnetting techniques, how to calculate a subnet, and best practices.
Knowing what an IP address is and its different classes will helps us understand subnets and subnetting easily.
IP address is a unique identifier assigned to every device that connects to the internet. Communication over the internet uses the Internet Protocol (IP), where data is transmitted from the source device to the destination device using the IP address of each device as a reference.
There are two types of IP addresses - IPv4 and IPv6.
IPv4 uses a 32-bit format, where each bit can either be a 0 or 1, resulting in approximately 4.3 billion possible combinations (2^32). An IPv4 address is represented by four octets separated by periods (e.g., 192.168.1.1). Each octet can represent a value between 0 and 256. The reason behind this is, each octet is 8 bits long, hence each octet can have 2^8 different values i.e between 0 and 256.
For example, the IP address 192.168.1.1 is represented in binary as 11000000.10101000.00000001.00000001.
A basic understanding of the decimal and binary number system is essential to understand IP addresses more accurately.
In the decimal number system, each number represents a number from 0 to 9 with a base of 10 i.e each number in the decimal number system has a place value like 1's place, 10's place, 100's place and so on.
For example: 129 is calculated as
1x100 + 2x10 + 1x9 = 129
However, in the binary number system, each number is either 1 or 0 with a base of 2 i.e each number in the binary number system has a place value like 1's, 2's, 4's place and so on.
Let's consider the same example, 129. In binary, 129 is 10000001.
1x128 + 0x64 + 0x32 + 0x16 + 0x8 + 0x4 + 0x2 + 1x1 = 129
IPs are converted from binary to decimal for ease of human readability. Now, let's gain an understanding about IPv6.
IPv6 uses 128-bit format, resulting in about 340 undecillion possible combinations. Realistically, every person on Earth can own up to 4 x 10^28 and we will still not run out of IPs. An IPv6 address is represented in hexadecimal format, a combination of numbers and alphabets, and are separated by collans (eg: 2001:0db8:85a3:0000:0000:8a2e:0370:7334)
Unlike IPv4 addresses, IPv6 uses a combination of alphabets and numbers; it is better read in its original hexa-decimal format rather than converting it from any other number system.
Now that we understood the different versions of IPs, here's a snippet of different classes of IPs and its purpose.
Since IPv4 is widely used and has distinct address classes, unlike IPv6, which doesn't use classes, it's important to understand the various IP address classes in IPv4.
To accommodate different network sizes and types, there are various classes of IPs. IP addresses are divided into 2 parts: the network prefix and the host identifier. The network portion helps identify the specific network, and the host identifier helps identify specific devices within the network.
Let us understand IP subnetting in detail.
As noted earlier, subnetting is the process of segmenting a larger network into smaller networks. The single, large IP network is divided into multiple sub-networks using a subnet mask where an IP address is separated into its network entity and host identifier entity.
A subnet mask is structured very much similar to an IP address, but it is used only within a network, for internal purposes. In a subnet mask, each octet represents a part of the mask. Subnet masks are used to mask the IPs to determine which part of the IP denotes the network and which part denotes the host part.
Basically, a subnet mask helps users determine which subnet an IP address belongs to.
Let's understand how subnet masks are calculated.
The first step is to understand your network's needs. You should first determine how your network should be subnetted i.e if you want fewer IPs per subnet with lots of subnets or lots of IPs per subnet with few subnets. Yeah, you need to read that again for better understanding.
Once you have clarity on this, you can get started with subnet calculation right away.
Ground rule:
If you are wondering why, here is the explanation.
255.255.0.0 converted to binary is 11111111.11111111.00000000.00000000
In Class B, 11111111.11111111 is the network part and 00000000.00000000 is the host part. Introducing 1s to the host part (00000000.00000000) reduces the ability of creating more hosts. Hence, adding 1s increases the number of subnets but reduces the number of hosts within the subnet.
On the other hand, removing 1s from the subnet i.e network part (11111111.11111111) reduces the ability of creating more subnets. Hence, removing 1s increases the number of hosts but reduces the number of subnets within the network.
Note: The IPs and the subnet mask we will be taking into consideration throughout will be of Class B. The most commonly used subnet mask in Class B is 255.255.0.0. Let's consider the same. As noted earlier, Class B ranges from 128.0.0.0 to 191.255.255.255.
With this subnet mask, you can have only one subnet, accommodating 65,534 hosts. This is the maximum number of hosts that a subnet can have in class B.
With this subnet mask, you can have 2 subnets accommodating 32,766 hosts, each subnet.
With this subnet mask, you can have 4 subnets accommodating 16,382 hosts, each subnet.
With this subnet mask, you can have 8 subnets accommodating 8,190 hosts, each subnet.
With this subnet mask, you can have 16 subnets accommodating 4,094 hosts, each subnet.
With this subnet mask, you can have 32 subnets accommodating 2,046 hosts, each subnet.
With this subnet mask, you can have 64 subnets accommodating 1,022 hosts, each subnet.
With this subnet mask, you can have 128 subnets accommodating 510 hosts, each subnet.
With this subnet mask, you can have 256 subnets accommodating 254 hosts, each subnet.
This makes it evident that reducing the 1s in the network portion (can be realized by observing the binary conversion from case 9 to case 1) will increase the number of hosts within a subnet.
Subnet Mask in Decimal | Subnet Mask in Binary | No of Subnets [Formula: 2^s] |
No of Hosts [Formula: 2^h - 2] |
---|---|---|---|
255.255.0.0 | 11111111.11111111.00000000.00000000 | 1 | 65,534 |
255.255.128.0 | 11111111.11111111.10000000.00000000 | 2 | 32,766 |
255.255.192.0 | 11111111.11111111.11000000.00000000 | 4 | 16,382 |
255.255.224.0 | 11111111.11111111.11100000.00000000 | 8 | 8,190 |
255.255.240.0 | 11111111.11111111.11110000.00000000 | 16 | 4,094 |
255.255.248.0 | 11111111.11111111.11111000.00000000 | 32 | 2,046 |
255.255.252.0 | 11111111.11111111.11111100.00000000 | 64 | 1,022 |
255.255.254.0 | 11111111.11111111.11111110.00000000 | 128 | 510 |
255.255.255.0 | 11111111.11111111.11111111.00000000 | 256 | 254 |
There are various subnetting techniques, like
Let's take a brief look at each of them and which IP subnetting technique is the right choice for your organization.
Fixed-Length Subnet Masking (FLSM) method involves dividing the entire network into subnets having equal number of hosts. This is a straightforward approach where all subnets can accommodate an equal number of hosts. While it may seem that management becomes easier with the FLSM (Fixed Length Subnet Mask) method, it is not efficient when the network has varying size requirements. This approach can sometimes lead to IP address wastage.
Let's consider you need to create four subnets for a Class C network using FLSM.
Default subnet mask for class C network - 255.255.255.0
However, we need four subnets. Let's consider the host range to be 192.168.1.0 to 192.168.1.255. So, the subnet mask would be 255.255.255.192.
Here is how the subnets are divided.
Variable-length subnet masking (VLSM) allows you to create subnets with different sizes within the same network, thereby enabling efficient use of IPs. This method ensures the subnets are tailored depending on the network's needs without IP address wastage.
Let's consider the same Class C network with range 192.168.1.0 to 192.168.1.255 as example.
But say, you want four subnets, each with different sizes. Say one accommodating 100 hosts, one for 50, and two subnets for 25 hosts, each.
Here's how the subnets can be divided.
where the number after "/" represents the host part, which is explained briefly in the next paragraph.
CIDR (Classless Inter-Domain Routing) method helps allocate IP address for IP routing. This method allows route aggregation, reducing the number of routing entries. In this method, subnets of different sizes can be created without the limitations offered by IP classes. This method again reduces IP wastage.
A CIDR looks like 192.168.1.0/24 where 24 indicates the first 24 bits that represents the network part. Rest of the 8 bits represent the host part.
For example, multiple networks such as 192.168.0.0/24 and 192.168.1.0/24 are combined into a single CIDR block like 192.168.0.0/23, thereby reducing the number of routes in the routing table.
Network 1: 192.168.0.0/24
Network 2: 192.168.1.0/24
Combined Network: 192.168.0.0/23
Before combining: Two separate routes
After combining: One single route
Route: 192.168.0.0/23
Hence, out of all IP subnetting techniques, CIDR is more efficient and scalable.
OpUtils is a comprehensive IP address management and switch port mapping solution that helps IT administrators manage their IP address space with ease. The in-built subnet monitoring capability within OpUtils helps you manage the subnets within your network efficiently.
With OpUtils' IP address subnet monitoring tool, you can perform a wide range of actions. Some of them are:
This is just an overview of what OpUtils can do for you. Download our 30 days free trial and try it yourself to see how OpUtils can monitor your subnetted space. You can also schedule a demo, and we will connect you with the right product expert who can clear product-related queries.