Given a network ip address what would be the optimal subnetting method? optimal, such as to use the less possible ip addresses, the less possible subnets, a subnet per vlan, multiple subnets per vlan, etc.

## a top down approach

We’ve been assigned this network x.y.z.w/L and a need for n department. Each department needs d_i ip address, where i is any number between 1 and n.

if we use a flat network assignment, the total of ip addresses we need are d_1 + d_2 + … + d_i + … + d_n = D.

D must be at least less than 2^(32-L) the total available user of host space in a flat network assignment…

In a top-down approach we start by the biggest d_i. We process x number such as 2^x > d_i > 2^(x-1)

x must satisfy this condition, L-x >= 0

Then we have 2^(32-L-x) new /32-x sub networks. The first network is used to satisfy d_i need. For the next biggest department we’re sur that the next available /32-x network would fit.

Our next job is to try to optimize this network usage of ip addresses…

This approach have some limitations. For example:

- a d_i = 1023 may require a 2048 subnet block instead of a 1024. To d_i we need to add the broadcast and network addresses that are not usable by hosts in non point-to-point network (/31 masks). The result is that 2048 – 1023 + 2 = 1023 addresses are reserved but not used…
- many subnets like the previous one may deplete rapidly our available space…

## a down top approach

The down-top approach helps resolve some top-down aproach limitations.

Let’s suppose now that we all our space is subnetted into /31 point network. In such way, if d_i is even, d_i/2 subnetwork of /31 fits its need totally. The worst case is when d_i/ is odd, then we need d_i/2 + 1, /31 subnets to fit d_i need…

We’ve realized the most optimal subnetting using only /31 subnets. It is optimal in terms of effective usage of the reserved ip address space…

This approach resolves some top-down approach limitations but causes other issues:

- each /31 subnet would correspond to a vlan? router sub interface? router interface?
- two /31 subnets pertaining to the same department would communicate through a layer 3 versus a layer 2 path which is noter optimal
- the available vlan space could be rapidly exhausted
- the routing table would grow rapidly…

## a hybrid

An hybrid approach would take advantages of the both down-top and top-down approach in building an efficient subnetting technique…