# Subnetting a IPv4 /24 into 7 equally large subnets

I wrote a test a few days ago and wasn't able to solve one task in there:

Create 7 Subnets in the 192.168.10.0/24 Net
The subnets should be equally large.
The address range must be completely used.

So at first I tried to create one Subnet with /26 mask, so I get 64 hosts and the remaining address range gets filled with six /27 masked subnets (32 hosts).
Then I noticed that the second requirement has not been fulfilled.

When I create only /27 masked subnets, the third (or first) requirement is not fulfilled.
In the end I gave up and created eight /27 masked subnets, where the last subnet is not used.

Now my question is whether I didn't understand something in subnetting or the teacher made a mistake.
I still hope that the task was not possible, so I can talk to the teacher.

• The downvoter might explain why he downvoted the question. I showed my effort, my question is pretty clear. – user217 Jun 25 '13 at 14:18
• It sounds like a math textbook question. The requirements are not relevant to network engineering (equally large, completely used). And a subnet/CIDR calculator can give you the answer. – sdaffa23fdsf Jun 25 '13 at 16:03

There's no solution which satisfies all requirements, your answer of making 8 /27's is probably the most logical one.

You can easily verify this by trying to divide 256 by 7, you can't do this without a remainder. Also, all subnets need to have a size which is a power of 2, and 7 * 32 (a /27) = 252, 8 * 16 (a /26) = 512, so there's no way to do this without unused space.

In the end I gave up and created eight /27 masked subnets, where the last subnet is not used.

I think this is (almost) the solution meant by the author of the questions. It's common for such questions to be written from time to time, and to be passed on and on through ages without adapting to actual technology. In this particular case, the author, I think, suggests that you cannot use a 'subnet-zero' i.e. subnet with all subnet bits set to zero resulting in 192.168.10.0/27. It was the case back in the days so you had to specifically permit usage of such addresses ('ip subnet-zero' in cisco ios). However, if you configure "no ip subnet-zero" you cannot use first subnet, thus giving only 7 usable /27 in a /24.

tl;dr: you're right, but the first (zero-th) subnet is not used due to an old currently irrelevant restriction

UPDATE:

Back in the days of old, it was not encouraged to use all-zeros and all-ones subnets (RFC 950, p.6, "the values of all zeros and all ones in the subnet field should not be assigned to actual (physical) subnets"). So, borrowing 3 bits for subnetting, we end up with only 6 usable subnets. However, vendors started to support using all-ones and all-zeros subnets on interfaces. In cisco world, the all-ones subnet was supported without any configuration, and all-zeros support was activated by appropriate cli command, more info here: http://www.cisco.com/en/US/tech/tk648/tk361/technologies_tech_note09186a0080093f18.shtml.

``````I've done a little experiment in GNS3 (cisco ios 12.4), so the results are:
1) you can use 8 subnets with 'ip subnet-zero' command (default)
2) you can use only 7 subnet with 'no ip subnet-zero' command.
3) classful or classless routing doesn't affect 1) or 2)
``````

This is basic subnetting/binary logic. There's 2 /25s in a /24, 2 /26s in a /25 (ergo 4 /26s in a /24) and so forth.

The closest match to the requirements is to use `/27` which will leave you with one spare subnet. You cannot by definition have an odd number of subnets exist from any given subnet size. Either your teacher actually intended this and the 7 was a red herring, or somebody failed hard at math.

By definition a subnet size is a power of 2 so a group of equal size address spaces that is subnetted must also be a power of 2. so a /24 can be broken up in to equal size address spaces 2, 4, 8, 16, 32, 64, 128 (probably not as zero (subnet) and 1 (broadcast)).

What we used to get on our tests was:

Create 7 Subnets in the 192.168.10.0/24 Net

The subnets should be equally large.

The address range must be used as optimal as possible.

If you say as optimal as possible you there is some flexibility, but it also makes the student think. A classic example we used to get was:

Give the smallest subnet mask possible to fit in 1023 hosts.

The answer was to have a 255.255.248.0 subnetmask (which can hold 2046).

Good answers have already been provided by the others with regards to answering the test question. I just wanted to offer a simpler way to look at the subnetting itself.

If your goal is to subnet and create X number of subnets, then you simply use powers of two until you get one big enough to hold X. So if the goal is 7 subnets, start counting up powers of two: 2, 4, 8. At the third power, you reach 8. So that means that you will need to use 3 bits of subnetting in order to create that many subnets. /24 + 3 = /27. You move the network portion of the address three bits to the right to create your new subnets.

If you were for example asked to create 10 subnets within that same /24 network, you would have to add another bit to your subnetting in order to do so: 2, 4, 8, 16. Since 16 is the first one that is bigger than 10, you would use that. /24 + 4 = /28

Remember that as you take bits away from the host area, you have fewer possible hosts within that subnet. So a /27 has only 30 possible hosts, and a /28 has only 14 possible hosts per subnet!

``````  Let's Start with table;
128     64    32     16     8     4    2     1   ----> Binary
128    192   224    240   248   252   254   255  ----> Sunet Mask
/25    /26   /27    /28   /29   /30   /31   /32  ----> CIDR
126     62    30     14     6     2    *     *   ----> Host
``````

192.168.10.0 / 27

`````` Ip   Address   Range |  Network
192.168.10.0  -- 32  |   ->1
192.168.10.32 -- 64  |   ->2
192.168.10.64 -- 96  |   ->3
192.168.10.96 -- 128 |   ->4
192.168.10.128 - 160 |   ->5
192.168.10.160 - 192 |   ->6
192.168.10.192 - 224 |   ->7
192.168.10.224 - 256 |   ->8

You will have eight(8) equally divided available network
with CIDR /27 with subnet mask 255.255.255.224
EACH NETWORK will have 30 usable Hosts.

Technically you can not divide to 7 networks equally.
256/7=36.571 wrong
256/8=32     correct
``````
• Actually, a `/31` network has two hosts. It is the `/32` network that has only one host. – Ron Maupin Nov 6 '17 at 15:50
• – Ron Maupin Nov 6 '17 at 16:34