cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
160
Views
5
Helpful
5
Replies
Highlighted
Beginner

Do routers force larger networks first with VLSM?

I have been working on simple packet tracer project with VLSM working on router 1 as labeled in the picture. I decided that I wanted to make a small network on 192.168.1.0 between the example router and router 0 using a subnet mask of /30 to save addresses. This will use up the range of 192.168.1.0 to 192.168.1.4. Later I decided I wanted to give router 0 a larger number of IP addresses (12 hosts) on its interface connected to the switch, this is not normally best practice as larger networks should be assigned first to make sure all other networks will fit in your scheme. 

Using my proposed scheme although it would be technically possible to start a network at 192.168.1.4 (network address being 192.168.1.4 and the next network address being 192.168.1.20) with a mask of /28, the router will reject these commands saying the network overlaps. 

 

My question is, does the router force the best practice on to the user? If it detects two different masks and it knows one uses more addresses then the other will it start the largest one first? 

My scheme (wrong way)

NetworkFirst/Last usable
192.168.1.0/30First 192.168.1.1 Last: 192.168.1.3
192.168.1.4/28First: 192.168.1.5 last: 192.168.1.19 

 

How the router sees it?

networkFirst/Last usable
192.168.1.0/28first 192.168.1.1 last 192.168.1.15
192.168.1.16/30first 192.168.1.17 last 192.168.1.18

 

Image example

Untitled.png

Everyone's tags (3)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Hall of Fame Guru

Re: Do routers force larger networks first with VLSM?

The fundamental problem was a misunderstanding of where the subnet starts as shown here

Network First/Last usable
192.168.1.0/30 First 192.168.1.1 Last: 192.168.1.3
192.168.1.4/28 First: 192.168.1.5 last: 192.168.1.19 

The original poster makes a very logical mistake thinking that the /28 subnet started at .4. But with a /28 mask the subnet really starts at .0. And that is clearly an overlap with the /30 subnet.

 

The other mistake in logic is the assumption that the subnet could start at .4 and use the next 16 addresses ending at .19. A /28 would have 16 addresses, but the subnet must start on a bit boundary (the boundary being the address where all of the host bits are zero). So for /28 the subnets can start at .0 or at .16 or at .32 etc. 

 

So the solution is to assign non overlapping addresses. It would work to leave the original /30 at 192.168.1.0 and assign the /28 at 192.168.1.16. Or it would work to let the larger subnet go first 192.168.1.0 and move the /30 to 192.168.1.16.

 

Given the symptoms he was experiencing I can understand that the original poster might think that the router was attempting to put the larger subnet first. But that is not the case. The router was simply saying that the subnets can not overlap.

HTH

Rick

View solution in original post

5 REPLIES 5
Highlighted
VIP Mentor

Re: Do routers force larger networks first with VLSM?

Hello,

 

not sure what you are after exactly, but you cannot have overlapping IP addresses on interfaces on the same router (the exception being VRFs), because the router always prefers directly connected routes, and with two (or more) interfaces sharing the same address space, it wouldn't know where to route packets...

Highlighted
Hall of Fame Master

Re: Do routers force larger networks first with VLSM?

Hello @Glf20 ,

>>

My question is, does the router force the best practice on to the user? If it detects two different masks and it knows one uses more addresses then the other will it start the largest one first? 

My scheme (wrong way)

Network First/Last usable
192.168.1.0/30 First 192.168.1.1 Last: 192.168.1.3
192.168.1.4/28 First: 192.168.1.5 last: 192.168.1.19 

 

When subnetting the base subnet address has all zeros in the host portion if you write 4 in binary you get:

0000 || 0100

where || is the subnet boundary and the host portion is made of the last 4 bits

So 192.168.1.4/28 is not a valid subnet the valid subnet is 192.168.1.0/28

 

>> does the router force the best practice on to the user? 

The router does not enforce any best pratice the router detects the address overlapping between 192.168.1.0/30 and 192.168.1.0/28 and complains about this.

An acceptable choice could be:

192.168.1.0/30

192.168.1.16/28

or in alternative

your second choice

192.168.1.0/28

192.168.1.16/30

When doing VLSM you need to find out the needed subnet masks for the different use cases.

A good choice is to to start to subnet the original prefix 192.168.1.0/24 using the less specific subnet first and to accomodate all the subnets with the largest needs in terms of hosts first. Then you take a remaining /28 the last one for example and you carve the /30 from there 192.168.1.240/28 ->

192.168.1.240/30

192.168.1.244/30

and so on.

I prefer this approach because the first question that I like to answer is the given address block (in your case 192.168.1.0/24) is enough to accomodate all the required subnets with their respective needs ?

 

It is possibile also to do the opposite to start by allocating the most specfic subnets first and then the less specific but actually to avoid issues like the the one occurred to you you need to start with the less specific subnet mask first.

 

Hope to help

Giuseppe

 

Highlighted
VIP Expert

Re: Do routers force larger networks first with VLSM?

I think your confusion is based on a misunderstanding of VLSM address block allocations.

You cannot allocate just any group of consecutive addresses, of the "right" size, and have a ligitimate address block allocation.

For example, your 192.168.1.0/30 can be broken down into two /31s, 192.168.1.0/31 and 192.168.1.2/31. However, 192.168.1.1/31 is not valid because it doesn't align with its "parent" /30, i.e. it's not one of the two valid /31s for that /30.

Likewise, your 192.168.1.4/28 doesn't align with its parent /27 192.168.1.0/27, which comprises 192.168.1.0/28 and 192.168.1.16/28. When you try to allocate 192.168.1.4/28, what you're really allocating is 192.168.1.0/28; which is what overlaps with 192.168.1.0/30.

The thing to keep in mind, is address allocations are powers of two.

Since 192.168.1.0/27 comprises 192.168.1.0/28 and 192.168.1.16/28, you can allocate only one of those two as a /28. Further, when you allocate 192.168.1.0/30, you cannot use 192.168.1.0/28, nor 192.168.1.0/29, or 192.168.1.0/26, 192.168.1.0/25, 192.168.1.0/24. 192.168.1.4/30 can be used, but only as that or as two /31s or four /30s. 192.168.1.8/29 can be used and it also can be subdivided.

Highlighted
Hall of Fame Guru

Re: Do routers force larger networks first with VLSM?

The fundamental problem was a misunderstanding of where the subnet starts as shown here

Network First/Last usable
192.168.1.0/30 First 192.168.1.1 Last: 192.168.1.3
192.168.1.4/28 First: 192.168.1.5 last: 192.168.1.19 

The original poster makes a very logical mistake thinking that the /28 subnet started at .4. But with a /28 mask the subnet really starts at .0. And that is clearly an overlap with the /30 subnet.

 

The other mistake in logic is the assumption that the subnet could start at .4 and use the next 16 addresses ending at .19. A /28 would have 16 addresses, but the subnet must start on a bit boundary (the boundary being the address where all of the host bits are zero). So for /28 the subnets can start at .0 or at .16 or at .32 etc. 

 

So the solution is to assign non overlapping addresses. It would work to leave the original /30 at 192.168.1.0 and assign the /28 at 192.168.1.16. Or it would work to let the larger subnet go first 192.168.1.0 and move the /30 to 192.168.1.16.

 

Given the symptoms he was experiencing I can understand that the original poster might think that the router was attempting to put the larger subnet first. But that is not the case. The router was simply saying that the subnets can not overlap.

HTH

Rick

View solution in original post

Highlighted
Hall of Fame Guru

Re: Do routers force larger networks first with VLSM?

There have been several important (and hopefully interesting) aspects to this discussion. Subnetting can get complicated and there are several things to keep in mind. Subnets can be of various sizes and there are the various subnet masks of different lengths and different number of addresses in each length. It seems logical that you could designate a subnet with 4 addresses and right next to it designate a subnet with 16 addresses. But that is not how it works. Every subnet must start on a bit boundary where all of the host bits are zero.

 

There are multiple approaches about how to set up subnetting when using VLSM. Advice that I see frequently is to group together subnets of the same size. This makes it easier to manage. A frequent approach is to start with the larger size subnets and work the sizes down to smaller subnets. I have also seen it done to start with the smallest subnets and work up to the larger subnets. Another approach I have seen is to place the larger subnets at the beginning of the address space, to place the smaller subnets at the end of the address space and to have room in the middle to handle growth of the network.

 

Thank you for marking this question as solved. This will help other participants in the community to identify discussions which have helpful information. This community is an excellent place to ask questions and to learn about networking. I hope to see you continue to be active in the community.

HTH

Rick