前缀列表(prefix-list)讲解

上传人:第*** 文档编号:31396041 上传时间:2018-02-07 格式:DOCX 页数:6 大小:15.42KB
返回 下载 相关 举报
前缀列表(prefix-list)讲解_第1页
第1页 / 共6页
前缀列表(prefix-list)讲解_第2页
第2页 / 共6页
前缀列表(prefix-list)讲解_第3页
第3页 / 共6页
前缀列表(prefix-list)讲解_第4页
第4页 / 共6页
前缀列表(prefix-list)讲解_第5页
第5页 / 共6页
点击查看更多>>
资源描述

《前缀列表(prefix-list)讲解》由会员分享,可在线阅读,更多相关《前缀列表(prefix-list)讲解(6页珍藏版)》请在金锄头文库上搜索。

1、不同于用于匹配流量的 IP 访问列表,IP 前缀列表主要是用来指定具体的网络可达的。前缀列表用来匹配前缀(网段)和前缀长度(子网掩码)。前缀列表有两个参数很难理解。下面是普通的前缀列表的参数:ip prefix-list name permit | deny prefix/lenname 为任意的名字或者数字,prefix 是指定的路由前缀(网段),len 是指定的前缀长度(子网掩码)。例子如下:ip prefix-list LIST permit 1.2.3.0/24上面的例子中指定匹配网段 1.2.3.0,并且指定子网掩码为 255.255.255.0,这个列表不匹配 1.2.0.0/24

2、,也不匹配 1.2.3.4/32ip prefix-list LIST permit 0.0.0.0/0上面的例子指定匹配网段 0.0.0.0 和子网掩码 0.0.0.0。这个列表用来匹配默认路由。通常情况下,在使用前缀列表的时候加上“GE”(大于或等于)和“LE”(小于或等于)时比较容易发生混淆。这是因为当使用“GE”和“LE”时,列表的长度(len)发生了改变。另外一种前缀列表的参数:ip prefix-list name permit | deny prefix/len ge min_length le max_lengthname 为任意的名字或者数字,prefix 是将要进行比较的路

3、由前缀(网段),len 是指从最左边开始的比特位,min_length 为最小的子网掩码的值,max_length 为最大的子网掩码的值使用 GE 和 LE,必须满足下面的条件:len GE = LE上面的参数很容易混淆,简单的说就是一个匹配前缀或子网的地址的范围。看下面的例子:ip prefix-list LIST permit 1.2.3.0/24 le 32上面的例子表示前缀 1.2.3.0 前面的 24 位必须匹配。此外,子网掩码必须小于或等于 32 位ip prefix-list LIST permit 0.0.0.0/0 le 32上面的例子意味着 0 位需要匹配,此外子网掩码必须

4、小于或等于 32 位。一位所有的网段的掩码都小于或等于 32 位,并且一位都不用匹配,所以这句话等于permit anyip prefix-list LIST permit 10.0.0.0/8 ge 21 le 29上面的例子说明网段 10.0.0.0 的前 8 位必须匹配,此外子网掩码必须在 21 位和 29 位之间。注意:使用前缀列表不能像访问列表那样匹配具体的应用流。前缀列表也不能用来具体匹配奇数或偶数的前缀,或什么可以被 15 整除的前缀在前缀列表中,比特位必须是连续的,并且从左边开始ip prefix-list fuck permit 0.0.0.0/0 ge 1 表示除了默认路由

5、外的所有路由ip prefix-list test16 seq 5 permit 0.0.0.0/1 ge 8 le 8 配置 A 类地址ip prefix-list test16 seq 10 permit 128.0.0.0/2 ge 16 le 16 配置B 类地址ip prefix-list test16 seq 15 permit 192.0.0.0/3 ge 24 le 24 配置C 类地址-Exercises:1. Construct a prefix list that permits only the 192.168.1.0/24 network.ip prefix-list

6、 test1 seq 5 permit 192.168.1.0/242. Construct a prefix list that denies network 119.0.0.0, and permits all other prefixes (including all subnets of 119.0.0.0).ip prefix-list test2 seq 5 deny 119.0.0.0/8ip prefix-list test2 seq 10 permit 0.0.0.0/0 le 323. Construct a prefix list that permits only th

7、e default route.ip prefix-list test3 seq 5 permit 0.0.0.0/04. Construct a prefix list the permits everything except the default route.ip prefix-list test4 seq 5 deny 0.0.0.0/0ip prefix-list test4 seq 10 permit 0.0.0.0/0 le 325. Construct a prefix list that permits network 172.16.0.0 and any of its s

8、ubnets, and denies all other prefixes.ip prefix-list test5 seq 5 permit 172.16.0.0/16 le 326. Construct a prefix list that permits only the following prefixes: 10.2.8.32/27 10.2.8.32/28 10.2.8.32/29 10.2.8.32/30ip prefix-list test6 seq 5 permit 10.2.8.32/27 le 307. Construct a prefix list that:Permi

9、ts 197.25.94.128/25 Denies 197.25.94.192/26 Permits 197.25.94.224/27 Denies 197.25.94.240/28 Permits 197.25.94.248/29 Denies 197.25.94.252/30 Permits all other prefixes, except for 198.82.0.0/16ip prefix-list test7 seq 5 deny 197.25.94.192/26ip prefix-list test7 seq 10 deny 197.25.94.240/28ip prefix

10、-list test7 seq 15 deny 197.25.94.252/30ip prefix-list test7 seq 20 deny 198.82.0.0/16ip prefix-list test7 seq 25 permit 0.0.0.0/0 le 328. Construct a prefix list that permits any prefix matching the first 20 bits of 175.29.64.0 which has a mask of at least /26 but not exceeding /29, and denies all

11、other prefixes.ip prefix-list test8 seq 5 permit 175.29.64.0/20 ge 26 le 299. Construct a prefix list that denies any prefix matching the first 19 bits of 15.26.96.0 with any mask up to and including /32, and permits any other prefix.ip prefix-list test9 seq 5 deny 15.26.96.0/19 le 32ip prefix-list

12、test9 seq 10 permit 0.0.0.0/0 le 3210. Construct a prefix list that denies the RFC 1918 private networks and any of their subnets, and permits everything else.ip prefix-list test10 seq 5 deny 10.0.0.0/8 le 32ip prefix-list test10 seq 10 deny 172.16.0.0/12 le 32ip prefix-list test10 seq 15 deny 192.1

13、68.0.0/16 le 32ip prefix-list test10 seq 20 permit 0.0.0.0/0 le 3211. Construct a prefix list that permits any subnet of network 15.0.0.0 (but not the network), and denies everything else. Your router lies within AS 65011. Place the prefix list in service in the inbound direction with BGP neighbor 1

14、.2.3.4.ip prefix-list test11 seq 5 permit 15.0.0.0/8 ge 9To place it in service: router bgp 65011neighbor 1.2.3.4 prefix-list test11 in12. Construct a prefix list that denies 162.56.0.0/16 and all of its subnets (with the exception of 162.56.209.208/29, which is permitted), and permits all other pre

15、fixes. Your router lies within AS 65012. Place the prefix list in service in the outbound direction with its BGP neighbor having address 5.6.7.8.ip prefix-list test12 seq 5 permit 162.56.209.208/29ip prefix-list test12 seq 10 deny 162.56.0.0/16 le 32ip prefix-list test12 seq 15 permit 0.0.0.0/0 le 3

16、2To place it in service: router bgp 65012neighbor 5.6.7.8 prefix-list test12 out13. Construct a prefix list that permits the CIDR block containing the thirty-two class C networks beginning with 200.202.160.0/24, and denies everything else. Your router is within AS 65013. Place the prefix list in service in the inbound direction

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号