**Subnetting**is the process of creating new networks (or

*subnets)*by

**stealing**

**bits**from the host portion of a subnet mask. There is one caveat: stealing bits

from hosts
creates

**more**networks but**fewer**hosts per network.
Consider
the following Class C network:

192.168.254.0

The
default subnet mask for this network is 255.255.255.0. This single network can
be segmented, or

*subnetted*, into multiple networks. For example, assume a minimum of*10*new networks are required. Resolving this is possible using the following magical formula:
2^n

The
exponent ‘

**n’**identifies the number of bits to steal from the host portion
of the
subnet mask. The default Class C mask (255.255.255.0) looks as

follows in
binary:

11111111.1111111.1111111.00000000

There are
a total of 24 bits set to

*1*, which are used to identify the network.
There are
a total of 8 bits set to

*0*, which are used to identify the host, and
these host
bits can be

*stolen*.
Stealing
bits essentially involves changing host bits (set to

*0*or*off*) in the
subnet
mask to network bits (set to

*1*or*on*). Remember, network bits in a
subnet
mask

**must always be contiguous**- skipping bits is not allowed.
Consider
the result if three bits are stolen. Using the above formula:

2^n

= 23

= 8 =

**8 new networks created**
However, a
total of 8 new networks

*does not*meet the original requirement
of at
least 10 networks. Consider the result if four bits are stolen:

2n

= 24

= 16 =

**16 new networks created**
A total of
16 new networks

*does*meet the original requirement. Stealing four
host bits
results in the following

*new*subnet mask:
11111111.11111111.11111111.11110000 =
255.255.255.240

the
previous example, a Class C network was subnetted to create

*16*new
networks,
using a subnet mask of

*255.255.255.240*(or*/28*in CIDR). Four
bits were
stolen in the subnet mask, leaving only four bits for hosts.

To
determine the number of hosts this results in, for each of the new 16

networks,
a slightly modified formula is required:

2n – 2

Consider the result if four bits are
available for hosts:

2n – 2 = 24 – 2 = 16 – 2 = 14 usable hosts per network

Thus,
subnetting a Class C network with a /28 mask creates 16 new

networks,
with 14 usable hosts per network.

Why is the
formula for calculating usable hosts 2n – 2? Because it is never

possible to assign a host an address with all

*0*or all*1*bits in the*host*portion
of the
address

**.**These are reserved for the subnet and broadcast addresses,
respectively.
Thus, every time a network is subnetted, useable host addresses

are lost.

*The 2n-2 Rule and Subnetted Networks*
To avoid
confusion, it was historically unacceptable to use the first and last

new

*networks*created when subnetting, as it is possible for a classful
network to
have the same subnet and broadcast address as its subnetted

networks.
This required the 2n – 2 formula to also be used when calculating

the number
of new

*networks*created while subnetting.
However,
this is no longer a restriction

**for modern equipment and routing**
protocols.
Specifically, on Cisco IOS devices, the following command is

now
enabled by default:

**Router(config)#**

*ip subnet-zero*

The

*ip subnet-zero*commands allows for the use of networks with all**or all***0*

*1***bits**in the

*stolen*network portion of the address. Thus, the formula for

calculating
the number of new networks created is simply

**2n**.
Remember though, the formula for
calculating usable

**.***hosts*is always 2n – 2

*Determining the Range of Subnetted Networks:--*
Determining
the

*range*of the newly created networks can be accomplished
using
several methods. The

*long*method involves some binary magic.
Consider
the example

*192.168.254.0*network again, which was subnetted
using a

*255.255.255.240*mask:
192.168.254.0:
11000000.10101000.11111110.00000000

255.255.255.240:
11111111.11111111.11111111.11110000

Subnetting
stole four bits in the fourth octet, creating a total of

*16*new
networks.
Looking at

*only*the fourth octet, the first newly created network is*0000*. The second new network is

*0001*. Calculating all possible

Note that
this equates to exactly

*16*new networks. The decimal value
represents
the first (or the

determine the range for the hosts of the *subnet*) address of each newly created network. To*first*new network:

The binary
value has been split to emphasize the separation of the stolen

*network*bits from the

*host*bits. The first address has all

*0*bits in the host

portion (

*0000*), and is the subnet address for this network. The last address
has all

*1*bits in the host portion, and thus is the broadcast address for this
network. Note that there are exactly 14 usable addresses to assign to
hosts.

Calculating
the ranges of subnetted networks can quickly become tedious

when using
the long binary method. The

*shortcut*method involves taking the
subnet
mask (

*255.255.255.240*from the previous example), and subtracting
the
subnetted octet (

*240*) from*256*.
256 – 240 = 16

Assuming

*ip subnet-zero*is enabled, the first network will begin at*0.*Then,
simply continue adding

*16*to identify the first address of each new network:
Knowing
the

the *first*address of each new network makes it simple to determine*last*address of each network:

Only the
first 10 networks were calculated, for brevity. The first address of

each
network becomes the

**subnet address**for that network**.**The last address
of each
network becomes the

**broadcast address**for that network**.**
Once the
first and last address of each network is known, determining the

usable range for hosts is
straightforward:

Hosts on
the same network (such as

*192.168.254.2*and*192.168.254.14*) can communicate freely.
Hosts on
different networks (such as

*192.168.254.61*and*192.168.254.66*)
require a router to communicate.

*Class A Subnetting Example*
Consider
the following subnetted Class A network: 10.0.0.0 255.255.248.0

Now
consider the following questions:

• How many
new networks were created?

• How many
usable hosts are there per network?

• What is
the full range of the first three networks?

By
default, the

*10.0.0.0*network has a subnet mask of*255.0.0.0*. To
determine
the number of bits stolen:

255.0.0.0:
11111111.00000000.00000000.00000000

255.255.248.0:
11111111.11111111.11111000.00000000

Clearly,

**13 bits**have been stolen to create the new subnet mask. To calculate
the total
number of new networks:

2n

= 213

=

**8192 new networks created**
There are
clearly

**11 bits**remaining in the host portion of the mask:
2n – 2 =
211 – 2 = 2048 – 2 =

**2046 usable hosts per network**
Calculating
the ranges is a bit tricky. Using the shortcut method, subtract the

third
octet (

*248)*of the subnet mask (*255.255.248.0*) from*256.*
256 – 248
= 8

The first
network will begin at

*0*, again.**However**, the ranges are spread
across multiple octets. The ranges of the first
three networks look as follows: