cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
53840
Views
42
Helpful
13
Replies

ip prefix list with le/ge options

sarahr202
Contributor
Contributor

Hi every body

i have few questions;

please consider the following:

ip prefix-list just seq permit 20.0.0.0/16 le 17

1)  Will 20.0.128.0  prefix match the list?

Here is my understanding which I want to confirm.

the prefix  20.0.0.0 prefix match  because  of the part (  permit 20.0.0.0/16) in above prefix list.

the prefix  20.0.128.0 does not match the prefix list because of the part(  20.0.0.0/16 le 17) in above prefix list which says  first 17 bits must match.

The following prefixes  match the above prefix list.

20.0.1.0

20.0.2.0

continue

20.0.127.255.

Is my understanding correct ?

thanks and have a great weekend.

5 Accepted Solutions

Accepted Solutions

Peter Paluch
Cisco Employee
Cisco Employee

Hi Sarah,

Nice to meet you again. How are you, how are things going?

ip prefix-list just seq permit 20.0.0.0/16 le 17

1)  Will 20.0.128.0  prefix match the list?

This particular prefix list matches prefixes of the form P/M (Prefix/Mask) that meet the following two conditions:

  1. P & /16 == 20.0.0.0
  2. /16 <= M <= /17

Now, 20.0.128.0 & /16 = 20.0.0.0, so the first condition is met. However, you have not indicated the mask of the prefix 20.0.128.0 and that is crucial to say what subnets would match. If their mask was either /16 or /17 and they were allocated from the 20.0.0.0/16 space, the prefix list would match. If the mask was different from these two values, the prefix list would not match.

In general, a prefix list of the form

ip prefix-list NAME permit|deny A.B.C.D/N ge L le U

matches all prefixes of the form P/M that meet the two following criteria:

  1. P & N == A.B.C.D (the prefix must be a subnet of the A.B.C.D/N)
  2. L <= M <= U (the mask of the prefix must be between L and U)

If the ge L argument is not used then the conditions are:

  1. P & N == A.B.C.D (the prefix must be a subnet of the A.B.C.D/N)
  2. N <= M <= U (the mask of the prefix must be between N and U)

If the le U argument is not used then the condition are:

  1. P & N == A.B.C.D (the prefix must be a subnet of the A.B.C.D/N)
  2. L <= M <= /32 (the mask of the prefix must be at least L)

If neither ge L nor le U are used then the prefix list evaluation is very simple: P must be exactly A.B.C.D and M must be exactly N.

This all is slightly confusing - I've had my share of misunderstandings about it. Please feel welcome to ask further, and please include LOTS of examples (or assignments) to be solved for you

Best regards,

Peter

View solution in original post