Prefix List Exercises
Prefix lists are a powerful tool for route filtering but they also may be a little confusing when learning them. Here are some prefix list examples to reinforce knowledge. Answers should be syntactically sound commands and using the most specific matching possible.
- Filter the following routes:
* 10.1.5.1/24
* 10.2.2.1/24
* 10.5.7.1/24
- Filter the following routes:
* 10.1.1.1/24
* 10.2.1.1/25
* 10.2.1.128/25
* 10.100.1.1/30
- Filter all but the last route and allow no others
* 172.16.2.1/24
* 172.16.3.1/25
* 172.16.3.128/25
* 172.16.4.1/26
* 172.16.4.64/26
* 172.16.10.1/30
- Filter all routes using one command
* 10.1.1.1/16
* 10.2.1.1/17
* 10.2.128.1/17
* 10.10.10.5/30
- Filter all /30 routes
* 192.168.1.0/24
* 192.168.2.1/25
* 192.168.2.128/30
* 192.168.3.1/30
Answers are below so don’t scroll down too far!
Answers
1.
ip prefix-list 1 deny 10.0.0.0/13 ge 24 le 24
ip prefix-list 1 permit 0.0.0.0/0 le 32
2.
ip prefix-list 2 deny 10.0.0.0/8 ge 24 le 30
ip prefix-list 2 permit 0.0.0.0/0 le 32
3.
ip prefix-list 3 deny 172.16.0.0/20 ge 24 le 26
ip prefix-list 3 permit 172.16.10.0/30
4.
ip prefix-list 4 deny 10.0.0.0/12 ge 16 le 30
ip prefix-list 4 permit 0.0.0.0/0 le 32
5.
ip prefix-list 5 deny 192.168.2.0/23 ge 30 le 30
ip prefix-list 5 permit 0.0.0.0/0 le 32
Hi, i am trying to understand IP Prefix-list and i am finding your website very useful. However i don’t understand the second example, why the first statement is ip prefix-list 2 deny 10.0.0.0/9 ge 24 le 30 rather than 10.0.0.0/8 ge 24 le 30? Thank You so much for your help
Sorry about the long delay. You are correct and I fixed the answer.
The answer to the 3rd question seems incorrect.
Since the last prefix should be allowed, I believe we should not take it into consideration when calculating the prefix for the networks to be blocked. Therefore a block of 8 in the 3rd octet (/21) will include the necessary ones, so believe the correct answer is :
ip prefix-list 3 deny 172.16.0.0/21 ge 24 le 26
^
ip prefix-list 3 permit 172.16.10.0/30