1.基本概念
ACL只能匹配目的网络地址,不能匹配目的网络子网掩码。
IP前缀列表可以匹配目的网络地址和子网掩码,可以被route-policy和filter-polict调用。
命令:ip ip-prefix 名称 index 序列号 {permit|deny} 目的地址 子网掩码长度 {greate-equal|less-equal}子网掩码长度范围
2.基本配置
1)Router-Polic调用IP前缀列表
![图片[1]-6.4 IP前缀列表-大赛人网](https://www.dsrw.com/wp-content/uploads/2023/03/图片2-11.png)
(1)基本配置
[R3]ip route-static 192.168.1.0 24 NULL 0
[R3]ip route-static 192.168.2.0 24 NULL 0
[R3]ip route-static 192.168.3.0 24 NULL 0
[R3]ip route-static 172.16.0.0 16 NULL 0
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1-area-0.0.0.0]network 34.1.1.0 0.255.255.255
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 34.1.1.0 0.255.255.255
(2)R3配置Router-Polic调用IP前缀列表拒绝172.16.0.0/16网络信息
[R3]ip ip-prefix dsrw deny 172.16.0.0 16
[R3]ip ip-prefix dsrw permit 0.0.0.0 0 less-equal 32
[R3]route-policy dsrw.com permit node 10
[R3-route-policy]if-match ip-prefix dsrw
[R3]ospf 1
[R3-ospf-1]import-route static route-policy dsrw.com
(3)查看R4路由表
<R4>display ip routing-table protocol ospf
Destination/Mask Proto Pre Cost Flags NextHop Interface
3.3.3.3/32 OSPF 10 1 D 34.1.1.3 GigabitEthernet0/0/2
192.168.1.0/24 O_ASE 150 1 D 34.1.1.3 GigabitEthernet0/0/2
192.168.2.0/24 O_ASE 150 1 D 34.1.1.3 GigabitEthernet0/0/2
192.168.3.0/24 O_ASE 150 1 D 34.1.1.3 GigabitEthernet0/0/2
2)Fliter-Polic调用IP前缀列表
![图片[2]-6.4 IP前缀列表-大赛人网](https://www.dsrw.com/wp-content/uploads/2023/03/图片3-11-1024x289.png)
(1)基本配置
[R1]rip 1
[R1-rip-1]version 2
[R1-rip-1]undo summary
[R1-rip-1]network 12.0.0.0
[R1-rip-1]network 192.168.1.0
[R1-rip-1]network 192.168.2.0
[R1-rip-1]network 192.168.3.0
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 23.1.1.0 0.255.255.255
[R2]rip 1
[R2-rip-1]version 2
[R2-rip-1]undo summary
[R2-rip-1]network 12.0.0.0
[R3]ospf 1 r
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 23.1.1.0 0.255.255.255
(2)R2配置Fouter-Polic调用IP前缀列表拒绝192.168.2.0/30网络信息
[R2-rip-1]import-route ospf 1
[R2]ip ip-prefix dsrw.com deny 192.168.2.0 24 greater-equal 30 less-equal 30
[R2]ip ip-prefix dsrw.com permit 0.0.0.0 0 less-equal 32
[R2]ospf 1
[R2-ospf-1]import-route rip
[R2-ospf-1]filter-policy ip-prefix dsrw.com export rip
(3)查看R3路由表
[R3]display ip routing-table protocol ospf
Destination/Mask Proto Pre Cost Flags NextHop Interface
2.2.2.2/32 OSPF 10 1 D 23.1.1.2 GigabitEthernet0/0/1
12.0.0.0/8 O_ASE 150 1 D 23.1.1.2 GigabitEthernet0/0/1
192.168.1.0/24 O_ASE 150 1 D 23.1.1.2 GigabitEthernet0/0/1
192.168.3.0/30 O_ASE 150 1 D 23.1.1.2 GigabitEthernet0/0/1
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
请登录后查看评论内容