# Learning To Subnet

### Description:

Subnetting can be tough! When studying for my CCNA, this is the subject I studied the hardest on. You need to do practice problem after practice problem until you feel confident!

Use this chart:

Souce: http://www.quest4.org/ccna/subnet_cheat_sheet.htm

### To Resolve:

1a. First know your subnet ranges:

Class A – has to start with a 0

0 0000001 = 1

0 1111111 – 128

Class B – has to start with a 10

10 00000 = 128

10 11111=191

Class C = has to start with a 110

110 0000 = 192

110 1111 = 223

RFC 1918/4193 set rules for private addresses

10.x.x.x /8

172.16.0.0 – 172.31.255.255 / 12

192.168.x.x /16

- Create a sheet that looks like this when you walk in to the exam:

Mask: 128 192 224 240 248 252 254 255

Bits Borrowed: 128 64 32 16 8 4 2 1

Subnets = 2 to the power of borrowed bits

Hosts = 2 to the power of unborrowed bits

*First thing to find in any subnet question is how many bits you borrowed from the closest major class (usually /24). Whatever you land on is the increment number. The number above it is the subnet mask.

- Example Questions:

Q: What network is host 172.16.5.68 255.255.255.240 in?

A: First look at the mask: 256 – 240 = 16, so you have the subnets going up in increments of 16, starting with zero (if subnet zero is permitted in the exam). Each subnet will need to have a subnet and a broadcast number, so this leaves 14 hosts per subnet. The subnets start at 0,16,32,48, 64, 80…224, 240 (the 0 and 240 are valid only if subnet zero is allowed).

Network First Host Last Host Broadcast

172.16.5.0 1 14 15

.16 17 30 31

.32 33 62 63

.64 65 78 79 * We know it’s in this range because 68 is between 65 and 78!

Q:

Admin 44 users

Faculty network has 60 users

media has 22 users

library has 12 users

- 255.255.255.128 / 1000000
- 255.255.255.192 / 1100000
- 255.255.255.224 / 111000
- 255.255.255.240 / 1111
- 255.255.255.248 11111

Questions you need to ask yourself:

- How many subnetworks do we need? At least 4 because there is four different departments.
- How big does the subnet need to be? Enough to cover the number of hosts in the largest network. In this case the one with 60 users, so a /26 which gives us 64 hosts in 4 subnets.
- What are the networks? 0, 64, 128, 192

Q: Which is a usable host address?

- 192.168.2.224 /28
- 192.168.2.47 /28
- 192.168.2.160 /28
- 192.168.2.192 /28
- None of the above

Questions to ask yourself:

What is the subnet mask?

255.255.255.240

What is the magic number? 16

What are the networks?

16

32

48

64

80

96

112

128

144

160

176

192

208

224

240

256

Answer: B. All the others land on a network address

Q: Given the IP Address space below, create 7 subnets

1st — 260 host minimum /23 with 512 hosts

2nd — 177 host minimum /24 with 256

3rd — 50 host minimum /26 with 64

4th — 20 host minimum /27 with 32

5th — point to point 2 host minimum /30

6th — point to point 2 host minimum /30

7th – — point to point 2 host minimum /30

192.168.0.0 /22

what is the subnet mask?

255.255.252.0

What is the bits borrowed (magic number)? 4 because /22 borrows 2 bits and 2^2 = 4. Our network will go up like:

192.168.4.0

192.168.8.0

…

How many host do we have? 260+177+50+20+2+2+2 = 513. We can’t do /23 because that only leaves 512 hosts, so we have to move to a /22 with 1024 hosts.

divide up the networks by checking the bits and hosts

/22 = 1024

/23 = 512

/24 = 256

/25 = 128

/26 = 64

/27 = 32

/28 = 16

/29 = 8

/30 = 4 only 2 are usable

Assign the networks to the problem

Now subnet it out

Network 1st is 192.168.0.0/23 — 192.168.1.255/23 # This network needs 260 hosts so we need a /23. We borrowed one bit to the LEFT OF /24. So we are creating another network. So 2^1 so networks go up by 2: 192.168.2.0, 4.0, 6.0, ….

network 2nd is 192.168.2.0/24 — 192.168.2.255/24 # standard class c network, covers our 177 host requirement on 1 network.

network 3rd is 192.168.3.0/26 — 192.168.3.63/26 # needs 50 host so a /26 which will cover 64 hosts on 4 sub-networks. I mean that we borrowed 2 bits so 2^2 is 4. But since /26 is SMALLER than /24, we are DIVIDING 256 by the number of borrowed bits, in this case 4 networks with 64 host each.

network 4th is 192.168.3.64/27 — 192.168.3.95/27# needs 20 host so a /27 which will cover 32 hosts with 8 sub-networks (2^3=8).

network 5th is 192.168.3.96/30 — 192.168.3.99/30# needs 2 host so a /30 which will cover 2 hosts. A /30 borrows 6 bits so 2^6=64 so we have 64 sub-networks with two hosts each.

network 6th is 192.168.3.100/30 — 192.168.3.103/30# needs 2 host so a /30 which will cover 2 hosts.

network 7th is 192.168.3.104/30 — 192.168.3.107/30# needs 2 host so a /30 which will cover 2 hosts.

Q: A common subnetting question may ask:

The admin network has 44 users

The teacher network has 123 users.

What should be the best subnet mask?

To Resolve:

In these situations, you want to answer to the lowest possible fit that you can, don’t make any room for expansion (not realistic).

The answer: The answer is /25 because that would create two networks, each with up to 126 usable IP’s. It’s tempting to think that you need to add the users and then pick a network that will support them but the question is usually asking what is the smallest subnet you can fit them in.

The Reasoning:

- So we know a classful Class C network has 24 network bits and 8 host bits that equal 256 hosts (2^8 = 256). This is done by adding the values 128+64+32+16+8+4+2+1=255 plus one because in networking, 0 counts as the first number. So we end with 256, BUT we have to subtract 2 for the network (.0) and the broadcast addresses (.255) so really only 254 usable hosts that can be assigned IP addresses.

- Well a /25 network is half of that. To get that just do the math, 2^7 = 128. An easy way to picture this is to think of the N to H relationship. /25 will have one of the H bits borrowed for the subnet only giving you 64+32+16+8+4+2+1=127 hosts. But remember the rule with 0 (so you have 128) and how 2 IP’s are always subtracted, this leaves you with 126 usable hosts.

- You can follow this pattern to create a table:

/24 is 256 host / 254 usable hosts per subnet. This the default class C network. This looks like 255.255.255.0

/25 is 128 hosts / 126 usable hosts per subnet. This looks like 255.255.255.128

/26 is 64 hosts / 62 usable hosts per subnet. This looks like 255.255.255.192

/27 is 32 hosts / 30 usable hosts per subnet. This looks like 255.255.255.224

/28 is 16 hosts / 14 usable hosts per subnet. This looks like 255.255.255.240

/29 is 8 hosts / 6 usable hosts per subnet. This looks like 255.255.255.248

/30 is 4 hosts / 2 usable hosts per subnet. This is the lowest you can go because you need at least two computers to network. This looks like 255.255.255.252

- On the other end of the spectrum is Class B and Class A networks where you borrow Network bits to make more hosts! The following tables describes:

/16 is 65536 hosts / 65534 usable hosts per subnet. This is the default class B network. This looks like 255.255.0.0

/17 is 32768 hosts / 32766 usable hosts per subnet. This looks like 255.255.128.0

/18 is 16384 hosts / 16382 usable hosts per subnet. This looks like 255.255.192.0

/19 is 8192 hosts / 8190 usable hosts per subnet. This looks like 255.255.224.0

/20 is 4096 hosts / 4094 usable hosts per subnet. This looks like 255.255.240.0

/21 is 2048 hosts / 2048 usable hosts per subnet. This looks like 255.255.248.0

/22 is 1024 hosts / 1022 usable hosts per subnet. This looks like 255.255.252.0

/23 is 512 hosts / 510 usable hosts per subnet. This looks like 255.255.254.0

Class A networks are uncommon but can be found here (http://www.tcpipguide.com/free/t_IPSubnettingSummaryTablesForClassAClassBandClassCN-2.htm)

A tabled version of this can be found here (https://www.aelius.com/njh/subnet_sheet.html)

*Always remember: 128,64,32,16,8,4,2,1 is the values in each octet. When adding they go up like 192,224,240,248,252,254,255

*Always remember: A subnet is represented as NNNNNNNN.NNNNNNNN.NNNNNNNN.NNHHHHH where N is network addresses and H is hosts. (a /26 network in this example)

*Always remember: You can get the total number of networks for a subnet by dividing the number of host from 256. For example, a /27 network has 32 hosts so 256/32=8 possible subnets.

A common subnetting question may ask:

192.168.3.55 /26

Is this a usable host address?

If so, what network is it in?

To Resolve:

Find the subnet mask. Since this is a /26 we know it is not classful (/24 for Class C, /16 for Class B, and /8 for Class A).

We write out 26 1’s from left to right

11111111.11111111.11111111.11000000 / the two 1’s are borrowed bits/subnet bits

We add the two left values to get 192 (128+64)

255.255.255.192

Find the magic number. The magic number is the value of the place the last number 1 was in.

In this case, it was 64. Values go: 128,64,32,16,8,4,2,1.128,64,32,16,8,4,2,1.128,64,32,16,8,4,2,1.128,64,32,16,8,4,2,1. 64 is where the 1’s ended.

Now that you know the magic number, you know the different sub-networks or subnets:

0-63 # where 0 and 63 are unusable because they are the network/broadcast addresses for the subnet respectively.

64-127 # where 64 and 127 are unusable because they are the network/broadcast addresses for the subnet respectively.

128-191 # where 128 and 191 are unusable because they are the network/broadcast addresses for the subnet respectively.

192-255 # where 192 and 255 are unusable because they are the network/broadcast addresses for the subnet respectively.

Now that we know the magic number we can also tell you how many hosts are available:

There are 4 networks because we borrowed 2 bits. 2^2 = 4.

There are 64 hosts because that is the value the last borrowed bit landed on (magic number). 2^6 = 64. BUT 2 of those are not usable, so there is really 62 usable host per subnet.

Now answer the questions, yes it’s usable and yes its in the 0-63 network.

Example 2:

192.168.1.153 /27

Is this a usable host address?

If so, what network is it in?

Find the subnet mask. Since this is a /27 we know it is not classful (/24 for Class C, /16 for Class B, and /8 for Class A).

We write out 27 11’s from left to right

11111111.11111111.11111111.11100000 / the three 1’s are borrowed bits/subnet bits

We add the three left values to get 224 (128+64+32)

255.255.255.224

Find the magic number. The magic number is the value of the place the last number 1 was in.

In this case, it was 32. Values go: 128,64,32,16,8,4,2,1.128,64,32,16,8,4,2,1.128,64,32,16,8,4,2,1.128,64,32,16,8,4,2,1. 64 is where the 1’s ended.

Now that you know the magic number, you know the different sub-networks or subnets:

32

64

96

128 – its in the .128 network. Broadcast is 159

160.. we can stop here

Now that we know the magic number we can also tell you how many hosts are available:

There are 8 networks because we borrowed 3 bits. 2^3 = 8.

There are 32 hosts because that is the value the last borrowed bit landed on (magic number). 2^5 = 32. BUT 2 of those are not usable, so there is really 30 usable host per subnet.

Now answer the questions, yes it’s usable and yes its in the 128-159 network.

NOTE: I highly recommend CCNA in 60 Days as that was my main study guide for the exam.