# Subnetting Tips - PacketByte

Networking and Communications

Oct 23, 2013 (4 years and 7 months ago)

92 views

SUBNETTING

Subnetting Tips

Subnetting has always been a thorn in many people's side and most probably have
caused quite a few to throw up their hands in frustration.

Here are a few tricks that

As you know, an IPv4
IP address is composed of 32 bits in 4 octets separated by a
period (.). There are 8 bits per octet, thus making up the total of 32 bits in 4 octets.
Some of these bits are assigned to NETWORK addresses, others to HOST addresses.
For the sake of this tutor
ial, we are going to concern ourselves with only the IPv4
Classes A, B and C.

IP Ranges for Class A, B & C addresses.

The IP range for these three classes are:

Class A Range 0
-

127 in the first octet (with 0 and 127 being reserved)

Class B Range 128
-

19
1 in the first octet

Class C Range 192
-

223 in the first octet

Here is how each IP address is represented as far as what bits are assigned to
Networks, (
N
), and which bits are assigned to

Hosts, (
H
).

Class A:
NNNNNNNN
.
HHHHHHHH
.
HHHHHHHH
.
HHHHHHHH

Class B:
NNNNNNNN
.
NNNNNNNN
.
HHHHHHHH
.
HHHHHHHH

Class C:
NNNNNNNN
.
NNNNNNNN
.
NNNNNNNN
.
HHHHHHHH

Now consider the numbering of bits of each octet. Consider the period between each
octet as a border between the octets. The
numbers start at 1 at the far left and e
nd at
32 at the far right. 1
-

8

are in the 1
st

octet, 9
-

16

in the 2
nd

octet, 17
-

24

in the 3
rd

octet
and 25
-

32

in the 4
th

octet. Therefore, it is important to remember that the border
numbers to consider are bits
8, 16, 24 and 32
.

Things to remember

When calculating subnets or host addressing needs:

1.

W
hen calculating
Subnet

requirements, you count starting
LEFT to RIGHT
.

2. When calculation
Host

requirements, you count starting
RIGHT to LEFT
.

3. When counting
Bits
, you count starting from
LEFT to RIGHT
.

The Subnet Mask in comparison to the octet bit location.

This pattern is repeated for
each of the 4 octets.

128

192

224

240

248

252

254

255

Octet Bit

0

0

0

0

0

0

0

0

Calculating a Subnet requirement,
starting from the left most bit.

CIDR Notation

So you may be wondering, how you can figure out where a CIDR notation falls in the
range of the IP address. There are two ways to approach this.

One way is to start from
the far left bit and count right.

For

example, a "/18" would be the 18th bit from the
farthest most bit to the left, a "/28" would be the 28th bit from the farthest most bit to left,
etc.

Therefore, a /18 subnet mask would be a subnet mask of 224. A /28 would give
you a subnet mask of 240.

See the chart below for further explanation about CIDR
notation.

1st Octet CIDR

/1

/2

/3

/4

/5

/6

/7

/8

Bit

0

0

0

0

0

0

0

0

2nd Octet CIDR

/9

/10

/11

/12

/13

/14

/15

/16

Bit

0

0

0

0

0

0

0

0

3rd Octet CIDR

/17

/18

/19

/20

/21

/22

/23

/24

Bit

0

0

0

0

0

0

0

0

4th Octet CIDR

/25

/26

/27

/28

/29

/30

/31

/32

Bit

0

0

0

0

0

0

0

0

An additional thing to remember about CIDR is where you are actually borrowing the
bits from.

This chart should help make this a bit clearer.

/1
-

/8

Bits borrowed from the 1
st

octet.

Border bit is 8.

/9
-

/16

Bits borrowed from the 2
nd

octet.

Border bit is 16.

/17
-

/24

Bits borrowed from the 3
rd

octet.

Border bit is 24.

/25
-

/32

Bits borrowed from the 4
th

octet.

Border bit is 32.

Some Subnetting Examples

Here are a few
examples on how this works with the different IP classes.

Here are the
steps you should take to figure out each question.

1.

Locate the border bit.

2.

Subtract the mask from the border bit to find the block size.

3.

Using the exponent configuration, find the bits
borrowed.

4.

1.

Which subnet does the Class C address 192.168.27.57/29 reside?

1.

The mask is /29, so the border bit is 32 in the 4th octet.

2.

To find your exponent, subtract 29 from 32 and you get 3. (32
-

29 = 3)

3.

Now find 2 to
the exponent of 3 which give you 8 (2
3
= 8)

4.

Since you borrowed from the 4
th

octet, you start at 0 in the 4
th

octet and work up by

factors of 8 to define the subnets.

192.168.27.0

192.168.27.8

192.168.27.16

192.168.27.24

192.168.27.32

192.168.27.40

192
.168.27.48

192.168.27.56 (The IP 192.168.27.57 resides in the 192.168.27.56 subnet.)

192.168.27.64

192.168.27.72

etc...

2.

Which subnet does the Class B address 172.24.80.15/19 reside?

The mask is /19, so the border bit is 24 in the 3
rd

octet.

To find you
r exponent, subtract 19 from 24 and you get 5. (24
-

19 = 5)

Now find 2 to the exponent of 5 which give you 32. (2
5
=32)

Since you borrowed from the 3rd octet, you start at 0 in the 3
rd

octet and work up by
factors of 32 to define the subnets.

172.24.0.0

1
72.24.32.0

172.24.64.0 (The IP 172.24.80.15 belongs to the 172.24.60.0 subnet.)

172.24.96.0

172.24.128.0

172.24.160.0

etc...

3.

Which subnet does the Class A address 10.40.25.112/12 reside?

The mask is /12, so the border bit is 16 in the 2
nd

octet.

To fin
d your exponent, subtract 12 from 16 and you get 4. (16
-

12 = 4)

Now find 2 to the exponent of 4 which give you 16. (2
4

= 16)

Since you borrowed from the 2
nd

octet, you start at 0 in the 2
nd

octet and work up by
factors of 16 to define the subnets.

10.0.
0.0

10.16.0.0

10.32.0.0 (The IP 10.40.25.112 belongs to the 10.32.0.0 subnet.)

10.48.0.0

10.64.0.0

etc...

4. What is the valid host range for the 3
rd

subnet for the Class C address
192.168.35.0/26?

The mask is /26, so the border bit is 32 in the 4
th

octet.

To find your exponent, subtract 26 from 32 and you get 6. (32
-

26 = 6)

Now find 2 to the exponent of 6 which give you 64. (2
6

= 64)

Since you borrowed from the 4
th

octet, you start at 0 in the 4
th

octet and work up by
factors of 64 to define the subnets.

192.168.35.0

192.168.35.64

192.168.35.128 (This is the 3
rd

subnet with the valid host range 192.168.35.129
-

192.168.35.190)

192.168.35.192

etc...

192.168.35.191 cannot be valid host ad
dresses.

5.

What is the valid host range for the 2
nd

subnet for the Class B address
172.90.0.0/19

The mask is /19, so the border bit is 24 in the 3
rd

octet.

To find your exponent, subtract 19 from 24 and you get 5. (24
-

19 = 5)

Now find 2 to the exponent

of 5 which give you 32. (2
5

=32)

Since you borrowed from the 3
rd
, you start at 0 in the 3
rd

octet and work up by factors of
32 to define the subnets.

172.90.0.0

172.90.32.0 (This is the 2
nd

subnet with the valid host range 172.90.32.1 to
172.90.63.254.)

172.90.64.0

172.90.128.0

etc...

6.

What is the valid host range for the 5
th

subnet for the Class A address
10.0.0.0/13?

The mask is /13, so the

border bit is 16 in the 2
nd

octet.

To find your exponent, subtract 13 from 16 and you get 3. (16
-

13 = 3)

Now find 2 to the exponent of 3 which give you 8. (2
3

= 8)

Since you borrowed from the 2
nd

octet, you start at 0 in the 2
nd

octet and work up by
fac
tors of 8 to define the subnets.

10.0.0.0

10.8.0.0

10.16.0.0

10.24.0.0

10.32.0.0 (This is the 5
th

subnet with the valid host range 10.32.0.1 to 10.39.255.254.)

10.40.0.0

10.48.0.0

etc...

9.255.255

Subnet given in dotted decimal format?

If you get the subnet mask in the dotted decimal format, the math is even simpler.

Just
start from the left and locate the octet that does not have 255 in it.

Subtract that
number
from 256 to find the block number and then follow the steps above working from
zero.

Here are some examples of how this works.

1.

Subnet 255.255.255.19
2

You take 192 and subtract it from 256.

This gives you 64.

th

octet
and work up by 64.

2.

Subnet 255.255.240.0

You take 240 and subtract it from 256.

This gives you 16.

rd

octet and work up by 16.

3.

Subnet 255.248.0.0

You take 248 and subtract it from 256.

This gives you 8.