user2180206
user2180206

Reputation: 1

Longest Prefix Match Routing Table

I have to build a smallest routing table using longest prefix matching with an address pool of 1024 addresses. 32 goes to A, 48 to B, 48 to C, 128 to D.

What I have so far is this:

192.168.100.X/27  A (X is supposed to be 25 + B mask + C mask?)
192.168.100.Y/    B (Y is supposed to be 25 + C mask?)
192.168.100.25?/  C
192.168.100.0/25  D

The way I understand it, D needs 128 addresses going in. So (2^32)-(2^25) = 2^7 = 128. So the subnet mask(the number after / ) is 25.

So how do I get 48? 48 is not a power of 2.

What does it mean to be "smallest"? Does it just mean that there is minimal overlap of address ranges?

Can anyone help me out and correct any misunderstandings I might have on this topic?

Upvotes: 0

Views: 3548

Answers (1)

S.Ideler
S.Ideler

Reputation: 21

A: 32 = /27

B: 48 = /27 + /28

C: 48 = /27 + /28

D: 128 = /25

2x/28 3x/27 1x/25 which is a total of 256 addresses.

Which leaves 768 adresses remaining, which usually are in your route table but not further defined by a longer prefix match - the higher the prefix number, the longer the prefix is.

With the suggestion below, this leaves 768 ip's free, as a coherent block. If you would, instead, assign A B C and D randomly from the 1024 addresses it would mean that you are severely limiting yourself for any future assignments towards new customers due to the gaps and holes you create in the block, effectively waisting IP space.

So your routing table would contain the following:

192.168.100.0/22 - default route defining the 1024 addresses.

192.168.100.0/25 - routed towards D (128)

192.168.100.128/27 - routed towards B (32)

192.168.100.160/28 - routed towards B (16+32=48)

192.168.100.176/28 - routed towards C (16)

192.168.100.192/27 - routed towards C (32+16=48)

192.168.100.224/27 - routed towards A (32)

The slash 22 is what you'd normally announce to your peers and transits externally, instead of announcing numerous longer prefixes. As the slash 22 covers all of them, there is no need to. And when the traffic reaches your internal network, the longer prefixes take preference.

If I had to guess what is meant by smallest it is probably referring to the above, or by keeping all the subnets within a single slash 24 block.

Upvotes: 2

Related Questions