3

Is there any particular reason as of why we should assign IP addresses to the largest subnet first? Could anyone give a simple example of why this is the better option?

Let's say I have two subnets: one for 40 hosts, and the second one for 4 hosts. How come that starting with the smaller subnet would cause a bigger waste of IPs? The hosts take the same number of IPs no matter what IPs were assigned to them.

user5539357
  • 173
  • 1
  • 5
  • Explain what you mean by "The hosts take the same number of IPs no matter what IPs were assigned to them." – lampwins Apr 07 '16 at 17:09
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide your own answer and accept it. – Ron Maupin Aug 07 '17 at 14:22

2 Answers2

3

I'll add to what @RonMaupin is trying to say by using this analogy. When you are packing the trunk of a car, you start by putting in the largest items first and make your way down to the smallest. In this way, the space in the trunk is optimized because the smaller objects can fit in the free space left behind from the putting the large objects in first. You can certainly start with the small objects, but you run the risk of running out of open space and will have to rip out everything and start over. By optimizing the space utilization from the start, you can more easily anticipate when you will run out of space. The same principal applies to subnetting.

lampwins
  • 173
  • 1
  • 6
  • The difference is I cant run out of space even if I start with smallest subnet. Give me any address space that has all addresses utilized and I will rearrange the subnets so that lowest addresses are for the smallest subnets. No address will be wasted. The only drawback I can see with smallest subnet first approach is that it makes adding new subnets harder, but thats the case if the whole address space hasnt been used yet. – user5539357 Apr 07 '16 at 16:54
  • If we had your mentality in 1978 we would have run out of ipv4 addressable space a long time ago, instead of just a few years ago. @RonMaupin explains why. In the real world, you can't rip out your subnet assignments and redo it. In much larger networks we have to plan much further into the future knowing there will be expansion of the network, thus the best practice is just that. – lampwins Apr 07 '16 at 17:07
  • Of course it's the best practice, I'm not questioning that. But it's wrong to say that starting with smallest subnets will **waste** IP addresses somehow, because it won't. Your car analogy is not the best, because indeed if there's a small gap in the very edge of your trunk and you've blocked it with other stuff, you cant put anything there anymore. In case of addresses, you still can fill that gap with a subnet that's small enough. The choice of subnets assignment order doesn't matter - each subnet will take the same number of IPs no matter what the order is. – user5539357 Apr 08 '16 at 11:08
  • It will waste IP addresses in the *real world*. Again I come back to yes, you can do it your way, but no one does because in the real world what happens if we need a new /22 but because of the way we subnetted from the beginning leaves us with only a bunch of /29's? In the real world we cannot easily reassign subnets because there is too much relying on them. You asked why you would want to do it this way. Best practices aren't based on what is theoretically possible, they are based on what is actually done, usually to make life easier. Are you correct, sure but should you actually do it? – lampwins Apr 08 '16 at 13:45
  • I don't think you are getting the analogy. You don't get to choose the items you are to put in the trunk, they are forced upon you and you must fit them into the trunk. Here's another one. You have a two lane highway and a truck decides to drive over the line and be in the middle of the two lanes. Now no one in either lane can pass him because he has placed himself in such a way that there is *not enough* room on the sides. All the vehicles take up the same amount of space no matter where they are on the road, but you can't cut a car in half in order to fit around the truck. – lampwins Apr 08 '16 at 13:52
  • Again, I do agree that addressing starting from the largest subnet is the best practice. If I gave you an address pool of `192.168.1.0/26` and told you to assign addresses for n subnets of different size (say, subnet A with 10 hosts, subnet B with 10 hosts and subnet C with 30 hosts), you would start with largest subnet C, then A and B. Fine. And all IP from `192.168.1.0/26` would be used. My point is that I could as well start wtih A, then B and C and the subnets would still be addressed properly. Give me an example of address pool and a list of subnets like above... – user5539357 Apr 10 '16 at 11:03
  • such that I wouldn't be able to assign IPs to the subnets properly if I started with the smallest subnet, but I could do that if I started with the largest subnet. That's my question, whether you can find such an example or not. Forget about analogies and stuff, just give me such an example. – user5539357 Apr 10 '16 at 11:04
2

It because you can't start the network for 40 hosts immediately after the network for four hosts.

If the network for four hosts is 10.0.0.0/29, the network for 40 hosts would need to start at 10.0.0.64/26. That means you have dead addresses from 10.0.0.8 to 10.0.0.63.

On the other hand, if the network for 40 hosts is 10.0.0.0/26, the network for 4 hosts can be 10.0.0.64/29, leaving no dead addresses in between.

Ron Maupin
  • 98,218
  • 26
  • 115
  • 191
  • But those 'dead' addresses can still be used by subnets that are small enough. If you had `192.168.0.0/24` and subnetted it into n subnets, starting with the largest subnet, I could rearrange those subnets in any way I like and those IPs would still suffice. Or if you could give a counterexample, I'd be grateful. – user5539357 Mar 07 '16 at 14:08
  • 2
    You really just make it more difficult. You would need to need the correct sizes. You asked why the practice is to start with the largest networks, and I gave it to you. If you need a bunch of networks of various sizes, you can arrange them from the largest to the smallest, almost without any thought, but mixing them up requires planning and more thought, and you really make it harder on yourself than it needs to be. Unless you are really running short of addresses, it is actually just easier to assign using a single block size which is large enough to accommodate the largest with growth. – Ron Maupin Mar 07 '16 at 18:21