Subnet calculator


Subnetworks, or subnets in short, are the subdivisions of an IP address. The process of creating subnets is called subnetting, wherein an IP address is usually broken down into smaller networks. Recently, subnetting has been used to refer to breaking down a CIDR block to a smaller CIDR block. CIDR, or Classless Inter-Domain Routing, is a process of allocating IP addresses and routing IP packets that is introduced by the Internet Engineering Task Force in 1993. The process of CIDR allows blocks of addresses to be clustered into single routing table entries, which are called CIDR blocks.

A subnet is a non physical ID or description for a physical sub-network, which is generally a switched network of host containing a single router (in a multi router environment). A subnet mask on the other hand is an ID or a description of which part of an IP address is deemed for the network and which one is for the use of the host. If you look at an IP address alone, it would be hard to tell which part of it is which. The subnet mask is the identifier of information so one can calculate the network and its portions easily.

In subnetting, there are two fundamental rules:

  1. If a bit in the subnet mask has a value of 1 (one), it is part of the network prefix in the corresponding IP address.
  2. If a bit in the subnet mask has a value of 0 (zero), then it is part of the host suffix in the corresponding IP address.

There are 3 main factors that make up modern subnet definitions. They are:

  1. The number of hosts needed to exist on the subnet – now and in the future.
  2. The security controls needed between networks.
  3. The performance vital for communications between the hosts.

With these rules given, the default subnet masks of the different classes of the IP address are:

  • Class A = 255.0.0.0
  • Class B = 255.255.0.0
  • Class C = 255.255.255.0

The 255 represents the network prefix and the 0 is representing the host suffix. The standard Class A subnet mask is 255.0.0.0. When you see a subnet mask like this, no subnetting is performed.

Subnet Mask Notation

There are two ways of subnet mask notation, the standard notation and the CIDR notation. Both of these subnet mask notation methods use the network address or base address to define the starting point of the network. For example, 192.168.1.0. Here the network starts at 192.168.1.0 and if a host IP address is added on the subnet would be 192.168.1.1

Standard Subnet Mask Notation

A four octet numeric value is used with the base address in a standard subnet mask notation. For example, 255.255.255.0. The standard subnet mask can be calculated by creating four binary values for each of the octet, assigning the binary digit .1. to the network address and .0. to the host. Therefore, in the example given above, the value would be 11111111.11111111.11111111.00000000. Keep in mind that there is a subnet definition with this base address. Therefore, the standard subnet notation would be 192.168.1.0 255.255.255.0.

CIDR Notation

In the CIDR subnet mask notation, the 1’s in the mask’s binary version is counted from the left. That number is attached to the end of the base address, following a slash (/). Therefore in the same example, the CIDR notation is 192.168.1.0/24.

Network Subnetting

When it comes to a subnetted network, there is what we call extended network portion. For example, the subnet mask 255.255.255.0 will subnet a class B IP address space by using its 3rd byte. If this scheme is used, the first two octets of the IP address will be the identifier of the Class B network, the next octet will identify the subnet in that network, and the last octet would identify the individual host.

Class C Subnetting

The subnetting for the Class C IP addresses is comparably easier than the two classes. For example, a company is using a single class C network of 192.168.0.0 with the default mask of 255.255.255.0. The said company has 6 departments with 30 hosts each. You have the requirement to segment them and for security reasons as well as increasing bandwidth availability to maximum, you need to break the single broadcast domain. This is what you have to do. Start with 3 bits of subnetting using the formula 2n-2 (where n is the value of the subnet bits). The subnet bits would then change the host address of the subnet mask which will be 255.255.255.224 after subnetting. In bit count format, this would be 192.168.0.0/27.

Computing the Maximum Number of Hosts for a Subnet Mask

Computing for the maximum number of hosts for a subnet mask is easy. All you have to do is take two and raise it to the total amount of bits allocated to the subnet (by counting the number of 0s in the subnet mask binary value) then subtract two (because the first value (0s) in the IP address range is reserved for the network address and the last value (1s) is for the network broadcast address.

For example: DSL networks commonly use 8 bits for their subnets. In this case, the formula for their max hosts will be: (2^8)-2 = 254 hosts max.

Remember that as users subnet the networks, the number of bits that the subnet mask represents will then decrease. Decrease the octets in order from the rightmost value and then proceed to the left toward a zero value.

The values of the masks decrease by a power of two every time a network is split into additional subnets. The values are as follows: 255, 254*, 252, 248, 240, 224, 224, 192, 128. Every decrease indicates an additional bit has been allocated. After the 128, the following bit will reduce the fourth octet to 0 and the third octet will again follow the same 8 number succession.

Changing a Subnet Mask under Microsoft Windows

Steps to change a Subnet Mask in a Microsoft Windows Operating System:

  1. Go to the properties tab of Local Area Connection.
  2. Select TCP/IP and then go to the properties tab of it.
  3. Click the subnet mask field once and delete it.
  4. Enter the new configured subnet mask and click OK.
  5. Use the command "ipconfig" to check the new subnet mask.

Another way to change a subnet mask in a Microsoft Windows operating system would be to execute the command "set address local static ip address subnet mask" in the netsh interface ip>mode.