Subnets can be rather confusing in calculating the subnet mask,
and network addresses for a given classification of IP address,
and the number of bits borrowed from the host part. So I've written
a very basic program which does these calculations. I've kept the
design simple, so it doesn't have splash screens and help windows.
Class A address test
The first screen shot shows a test for a Class A address with 4
bits borrowed from the host field:

There will thus be 14 usable subnets, as two of
the subnet addresses (0000 and 1111) cannot be used as they are
reserved. The subnet mask will thus be:
255.1111 0000b.00000000b.00000000b [255.240.0.0]
The first usable subnet address (in the form w.x.y.z) will thus
be:
w.0001 0000b.00000000b.00000000b [w.16.0.0]
and the second usable subnet address will be:
w.0010 0000b.00000000b.00000000b [w.32.0.0]
Thus an organisation which has been granted the 23.0.0.0 address
will a first usable subnet of 23.16.0.0.
Class B address test
The next screen shot shows a test for a Class B
address with 12 bits borrowed from the host field:

There will thus be 4096 usable subnets, as two
of the subnet addresses cannot be used as they are reserved (for
network and broadcast purposes). The subnet mask will thus be:
255.255.11111111b.11110000b [255.255.255.240]
The first usable subnet address (in the form w.x.y.z) will thus
be:
w.x.00000000b.0001 0000b [w.x.0.16]
and the second usable subnet address will be:
w.x.00000000b.0010 0000b [w.x.0.32]
Class C address test
The final test is for a Class C address with 4 bits
borrowed from the host part:

There will thus be 14 usable subnets, as two of
the subnet addresses cannot be used as they are reserved (for network
and broadcast purposes). The subnet mask will thus be:
255.255.255.11110000b [255.255.255.240]
The first usable subnet address (in the form w.x.y.z) will thus
be:
w.x.y.0001 0000b [w.x.y.16]
and the second usable subnet address will be:
w.x.y.0010 0000b [w.x.y.32]
Refer to the notes for futher details on subnetting.
|