6.3 Filter-Policy

1.基本概念

过滤策略,一种路由过滤器。

2.基本配置

1)Filter-Policy过滤RIP发出的路由

图片[1]-6.3 Filter-Policy-大赛人网
图6-5 双点双向路由调用route-policy网络拓扑

(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]rip 1
[R2-rip-1]version 2
[R2-rip-1]undo summary 
[R2-rip-1]network 12.0.0.0
[R2-rip-1]network 23.0.0.0

[R3]rip 1     
[R3-rip-1]version 2
[R3-rip-1]undo summary 
[R3-rip-1]network 3.0.0.0
[R3-rip-1]network 23.0.0.0

(2)在R2配置过滤192.168.1.0策略

[R2]acl 2000
[R2-acl-basic-2000]rule deny source 192.168.1.0 0.0.0.0
[R2-acl-basic-2000]rule permit 
[R2-acl-basic-2000]quit
[R2]rip 1
[R2-rip-1]filter-policy 2000 export GigabitEthernet 0/0/1
Filter-Policy过滤RIP接收的路由
[R2-rip-1]filter-policy 2000 import GigabitEthernet 0/0/0

(3)查看R2路由表

[R2]display ip routing-table protocol rip 
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
3.3.3.3/32  RIP     100  1           D   23.1.1.3        GigabitEthernet0/0/1
192.168.1.0/24  RIP     100  1           D   12.1.1.1        GigabitEthernet0/0/0
192.168.2.0/24  RIP     100  1           D   12.1.1.1        GigabitEthernet0/0/0
192.168.3.0/24  RIP     100  1           D   12.1.1.1        GigabitEthernet0/0/0

(4)查看R3路由表(过滤了192.168.1.0/24网段)

[R3]display ip routing-table protocol rip 
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
12.0.0.0/8   RIP     100  1           D   23.1.1.2        GigabitEthernet0/0/1
192.168.2.0/24  RIP     100  2           D   23.1.1.2        GigabitEthernet0/0/1
192.168.3.0/24  RIP     100  2           D   23.1.1.2        GigabitEthernet0/0/1

2)Filter-Policy过滤OSPF发出的路由

图片[2]-6.3 Filter-Policy-大赛人网
图6-6 Filter-Policy过滤OSPF发出的路由

(1)基本配置

[R1]ospf 1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 12.1.1.0 0.255.255.255

[R2]ospf  1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 12.1.1.0 0.255.255.255
[R2-ospf-1-area-0.0.0.0]network 23.1.1.0 0.255.255.255

[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)在R1配置过滤路由

[R1]acl 2000
[R1-acl-basic-2000]rule deny source 192.168.1.0 0.0.0.0
[R1-acl-basic-2000]rule permit 
[R1]ospf 1
[R1-ospf-1]import-route direct 
[R1-ospf-1]filter-policy 2000 export 

(3)查看R2路由表

[R2]display ip routing-table protocol ospf
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

1.1.1.1/32  O_ASE   150  1           D   12.1.1.1        GigabitEthernet0/0/0
3.3.3.3/32  OSPF    10   1           D   23.1.1.3        GigabitEthernet0/0/1
192.168.2.0/24  O_ASE   150  1           D   12.1.1.1        GigabitEthernet0
© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称

    请登录后查看评论内容