# 🧠 Cioara's Three Step Subnetting

Written by Tyler on May 4th, 2022 at 12:17 am.

I'm studying for my CCNA certification and am finding myself knee deep in subnetting again - my Network+ subnetting method must've fallen out of my brain, so I'm making myself write the method down for my own future reference.

These methods are taught by Jeremy Cioara and makes the most sense to me compared to the other methods I've seen. I highly recommend Cioara's materials on the CBTNuggets training site if you are willing to shell out the money - I'm watching all of the CCNA content in an effort to hammer the networking fundamentals into my head.

Anyways - this assumes you know how to represent base-10 numbers in base-2/binary - if not, this is probably going to make absolutely no sense. Here's my best attempt at a brief explanation:

#### Understanding Binary

Binary is based on 1s and 0s - ons and offs. Each number (bit) represents a power of 2. Since we're talking about IPv4, we're limited to 8-bit numbers, which allows for a maximum value of 255.

Like base-10 numbers, each digits represents a power - we're used to the power of 10s (10^0 = 1, 10^1 = 10, 10^2 = 100, 10^3 = 1000, etc.), but the same idea applies to binary - just with 2s instead of 10s. To convert back to something we can understand, we need to add the values together. Remember - the number is read from right to left, so the leftmost bit represents 128 and the rightmost represents 1.

1. Each bit represents a power of 2. For an 8-bit number:
• 2^7 = 128
• 2^6 = 64
• 2^5 = 32
• 2^4 = 16
• 2^3 = 8
• 2^2 = 4
• 2^1 = 2
• 2^0 = 1

2. Wherever there's a 1, add the power of 2 it's representing.
• 10011011 = 155
• 00101111 = 47
• 11111111 = 255
• 10000001 = 129
Since we're talking about 8-bit numbers, the maximum value we can represent in an octet is 255, as shown above. We can still do calculations with larger numbers for the purposes of subnetting - this limitation only applies to the addresses and masks.

Anyways, on to the meat and potatoes of my rambling:

#### 🏢 Three Step Subnetting - By Number of Networks

1. Convert the number of desired networks to binary, count the bits.
Let's say we were trying to split 200.5.1.0/24 into 50 seperate networks. We would convert 50 into binary:
```128 64 32 16 8 4 2 1
0   0  1  1  0 0 1 0```
50 expressed as a binary number is 110010, so we'll need 6 bits to represent it.

2. Reserve the bits in the given range's mask and find your "increment".
We're starting with a /24 (255.255.255.0) subnet mask. Since we're focused on the number of networks we're creating, we need to append our bits onto the starting mask:
`11111111.11111111.11111111.XXXXXX00`
This means that we have 2 bits left over for host addressing. Now, for the increment - this value is determined by the last network bit in the mask we just created. Our last bit lands in the 4 spot in the final octet, so our increment is 4.

One thing to note here - we're already starting with 1 network, so we really only need to subnet out 49 hosts. This would be particularly important if we're doing a power of two - e.g. if we want 8 networks, we need to borrow 3 bits, not 4 - we only need 7 additional networks.

3. Use the increment to generate network ranges.
• 200.5.1.0 - 200.5.1.3
• 200.5.1.4 - 200.5.1.7
• 200.5.1.8 - 200.5.1.11
Since we used 6 bits, we're actually creating 63 networks. This is as close as we could get to our target - so enjoy some freebies.

Not too bad, right? I think the stockholm syndrome must be kicking in...

#### 🖥 Three Step Subnetting - By Number of Hosts

1. Convert the number of desired hosts to binary, count the bits.
The process is pretty similar to what was mentioned above, but since we're focusing on hosts we count from the right instead of the left, making sure to reserve enough bits to properly express the number of hosts we want in each subnet.

For example, let's say we are subnetting 192.168.5.0/24 into blocks of at least 23 hosts. Since we lose two hosts to the network and broadcast addresses, we would convert 25 into binary:
```128 64 32 16 8 4 2 1
0   0  0  1  1 0 0 1```
25 expressed in binary is 11001, so we need 5 bits.

2. Reserve the bits in the given range's mask and find your "increment".
We're starting with a /24 (255.255.255.0) subnet mask. Again, since we're focusing on hosts, we need to reserve the last 5 bits:
`11111111.11111111.11111111.000XXXXX`
Since we only needed 5 bits to represent our hosts, we can fill the remaining 3 bits with 1s for the network portion. This will give us a subnet mask of /27. Our increment is on the bit representing 32 in the last octet, so that's our increment.

3. Use the increment to generate network ranges.