How to Find Subnet Mask From IP Range - Netizzan

How to Find Subnet Mask From IP Range

A subnet mask is a crucial tool used to partition a large network into smaller subnetworks, allowing each to function independently as a broadcast domain. This aids in efficient IP address management, preventing the waste of IP addresses in smaller networks.

Each subnet mask corresponds to a range of IP addresses. At times, you might receive a specific range of IP addresses and need to determine the appropriate subnet mask for that range.

In this post, I’ll guide you on how to find a subnet mask from an IP range in four simple steps, using the example of a 128-IP address range.

There are two methods for this task: you can either reference a subnet mask cheat sheet or follow the step-by-step calculation process that I’ll outline.

How to Find Subnet Mask From IP Range

Here are steps to find subnet mask from an IP range;

Step 1: Identify the Number of Host bits

The number of host bits can be directly calculated from the IP range. Once you have the value of the IP range and you want to find the number of host bits, you can use the following formula:

ALSO READ:  Everything About Multiprotocol Label Switching (MPLS)

Number of Host Bits=log⁡2(IP Range)

Here, log⁡2 represents the logarithm to base 2. This formula is derived from the fact that the number of possible host addresses in a subnet is 2^(Number of Host Bits), so to find the number of host bits, you take the base-2 logarithm of the given IP range.

In our case where the value of IP range is 128,

Number of host Bits = log⁡2(128) = 7 bits.

Step 2: Find the number of Network bits

Once you have gotten the number of host bits, you can get the number of network bits by subtracting the number of host bits from 32 (which is the total number of bits for the IPV4 subnet mask).

In the last step, we calculated the number of host bits to be 7. Hence, the number of network bits is 32-7 = 25.

Step 3: Write out the Binary Representation

The binary representation for the subnet mask is written by setting all the network bits to “1s” and the host bits to “0s.” In this case, where we have the number of network bits to be 25 and the number of host bits to be 7, the binary representation is 11111111.11111111.11111111.10000000.

ALSO READ:  /26 Subnet Mask

Step 4: Convert the Binary Representation into dotted decimal

The last step is to convert the binary representation to dotted decimal. This simply means converting the binary number for each octet to decimal. This will result to 255.255.255.128

dotted decimal notation for /25 subnet mask

So, the subnet mask with 128 IP range is 255.255.255.128 in dotted decimal or /25 prefix length.

Example;

Find the subnet mask for the 130 IP range.

Answer;

To find a subnet mask that will accommodate 130 IP ranges or more,

Step 1: Finding the number of host bits

Number of host bits = log2(130) = 7.0223 bits.

We will approximate this to 8 bits (once you have decimals, approximate to the next whole number).

Step 2: Finding the number of network bits

The number of network bits is 32 minus 8 = 24 bits.

Step 3: Write the binary representation.

The binary representation in this case is 11111111.11111111.11111111.00000000.

Step 4: Converting from binary representation to dotted decimal representation.

11111111.11111111.11111111.00000000 in dotted decimal representation is 255.255.255.0. The prefix length is /24.

ALSO READ:  /25 Subnet Mask

dotted decimal notation for /24 subnet mask

Normally, a /24 subnet mask gives a total of 256 IP addresses. Although this number is greater than 130, which is the IP range given, it is the right subnet mask because 130 addresses are greater than 128, which is the IP range for the /25 subnet mask (the next subnet mask).

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top