dslreports logo

    All FAQs Site FAQ DSL FAQ Cable Tech About DSL Distance DSL Hurdles »»


how-to block ads

An IP address is a 32-bit binary code (often written in the decimal-dot form) that contains network and host parts. The host bits define a particular computer.
The network prefix determines a network; its length depends on the network class.
Subnetting helps to organize a network by breaking it into several subnets. To define such subnets, you must take bits from the host portion of the IP address. That also extends the network prefix. The subnet mask explicitly defines network and host bits as 1 and 0, respectively.
Below, is a calculation of a subnet mask for a computer with IP address that belongs to network with six subnets.

Step 1
Determine the network class (A, B or C) based on IP address:
* If IP addresses begin with 1 to 126, it is Class A.
* If IP addresses begin with 128 to 191, it is Class B.
* If IP addresses begin with 192 to 223, it is Class C.
In our example, the network is class C since the IP address start with 192.

Step 2
Determine number of bits needed to define subnets:
* Number of subnets = (2^Number of bits) - 2. Hence,
* Number of bits = Log2(Number of subnets + 2).
In our example, there are six subnets:
* Number of bits = Log2(6 + 2) = Log2(8) = 3. Three bits in the IP address are used as a subnet portion.

Step 3
Compose the subnet mask in binary form by extending the default subnet mask with subnet bits. Default subnet mask for classes A to C are:
* 11111111.00000000.00000000.00000000 (Class A, network part is 8 bits)
* 11111111.11111111.00000000.00000000 (Class B, network part is 16 bits)
* 11111111.11111111.11111111.00000000 (Class C, network part is 24 bits)
In our example, an extension of the default class C subnet mask with 3 bits (Step 2) results in the subnet mask

Step 4
Convert the binary subnet mask to the decimal-dot form. The binary form contains four octets (8 bits in each). Use following rules:
* For "1111111" octet, write "255".
* For "00000000" octet, write "0".
* If octet contains both "1" and "0" use the formula:
Integer number = (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 either 1 or 0 in the corresponding position in the octet sequence.
In our example, 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
Subnet mask is

You can also use one of the many online Subnet calculators available on the net.
Here is one, »www.subnetonline.com/pages/subne ··· ator.php

To subnet the IPv6 address space, you use same ipv4 subnetting techniques to divide the 16-bit Subnet ID field for a 48-bit global or unique local address prefix in a manner that allows for route summarization and delegation of the remaining address space to different portions of an IPv6 intranet.
You need not subnet in any specific fashion. The subnetting technique described here assumes that you subnet by dividing the variable portions of the address space of the Subnet ID field using its high-order bits. Although this method promotes hierarchical addressing and routing, it is not required. For example, in a small organization with a small number of subnets, you can also easily create a flat addressing space for global addresses by numbering the subnets starting from 0.

More detailed information and examples for ipv4 and ipv6 here;
»technet.microsoft.com/en-us/libr ··· 997.aspx

Feedback received on this FAQ entry:
  • This is for IPv4, not IPv6

    2014-02-24 17:23:05

Expand got feedback?

by ironwalker See Profile
last modified: 2010-06-06 08:19:04