How to Compute an IP Subnet Mask

Nov 5
10:02

2009

Jameson Meer

Jameson Meer

  • Share this article on Facebook
  • Share this article on Twitter
  • Share this article on Linkedin

IP address is a code that has host and network parts. The host bits describe a particular PC. The network prefix shows a network; its measurement leng...

mediaimage
IP address is a code that has host and network parts. The host bits describe a particular PC. The network prefix shows a network; its measurement lengthwise depends on the class of network. Sub-netting helps to arrange a network by splitting it to several subnets. To describe such subnets, you should take bits from the portion of host of the IP address. That also expands the network prefix. The subnet mask openly describes network and host bits as 1/0,How to Compute an IP Subnet Mask Articles respectively.

 

In this instance, we will compute a subnet mask for a PC with IP address “193.35.127.93 that goes to network with 6 subnets.

 

1.            Step 1

 

Verify the network class A/B/C based on IP addresses:

 

* If the IP addresses start with 1 - 126, it is Class A.

* If the IP addresses start with 128 - 191, it is Class B.

* If the IP addresses start with 192 - 223, it is Class C.

 

In our illustration, the network is class C because the IP address 193.35.127.93 begin with 192.

 

2.            Step 2

 

Know the number of bits required to define subnets:

 

* Number of subnets = (2^ # of bits) - 2. Therefore,

* Number of bits = Log2(# of subnets + 2).

 

In our illustration, there are 6 subnets:

 

* Number of bits = Log2(6 + 2) = Log2(8) = 3. 3 bits in the IP address are utilized as a subnet portion.

 

3.            Step 3

 

Create the subnet mask in a binary form by expanding the original subnet mask w/ subnet bits. Original subnet mask for class A - C are:

 

* 11111111.00000000.00000000.00000000 (Class A, network part = 8 bits)

* 11111111.11111111.00000000.00000000 (Class B, network part = 16 bits)

* 11111111.11111111.11111111.00000000 (Class C, network part = 24 bits)

 

In our illustration, an addition of the default “class C” subnet mask with three bits (Step 2) outcomes in the subnet mask

11111111.11111111.11111111.11100000.

 

4.            Step 4

 

Change the subnet mask binary to the decimal form. The binary form has 4 octets. Utilize the following rules:

 

* Write 255 for "1111111" octet.

* Write 0 for "00000000" octet.

* If octet has 1 and 0 utilize the formula:

 

Integer # is equals to (128 x n) + (64 x n) + (32 x n) + (16 x n) + (8 x n) + (4 x n) + (2 x n) + (1 x n)

 

Where N is “1” or “0” in the corresponding place in the sequence of octet.

 

In our illustration, for 11111111.11111111.11111111.11100000

11111111 = 255

11111111 = 255

11111111 = 255

11100000 = (128 x 1) + (64 x 1) + (32 x 1) + (16 x 0) + (8 x 0) + (4 x 0) + (2 x 0) + (1 x 0) = 224

 

The Subnet mask is “255.255.255.224”.