策略工具:Filter-Policy
Filter-Policy(过滤-策略)是一个很常用的路由信息过滤工具,能够对接收、发布、引入的路由进行过滤,可应用于IS-IS、OSPF、BGP等协议。
Filter-Policy在距离矢量路由协议中的应用,在距离矢量路由协议中,设备之间传递的是路由信息,如果需要对这种路由信息进行某种过滤,可以使用Filter-Policy实现,出方向和入方向的生效位置。
#sysname SW1#vlan batch 12#vlan 12description SW1-SW2-HuLian#interface Vlanif12description SW1-SW2-HuLianip address 12.1.1.1255.255.255.252#interface GigabitEthernet0/0/1port link-type trunkport trunk allow-pass vlan 2 to 4094#
#sysname SW2#vlan batch 1223#vlan 12description SW1-SW2-HuLianvlan 23description SW2-SW3-HuLian#interface Vlanif12description SW1-SW2-HuLianip address 12.1.1.2255.255.255.252#interface Vlanif23description SW2-SW3-HuLianip address 23.1.1.1255.255.255.252#interface GigabitEthernet0/0/1port link-type trunkport trunk allow-pass vlan 2 to 4094#interface GigabitEthernet0/0/2port link-type trunkport trunk allow-pass vlan 2 to 4094#
#sysname SW3#vlan batch 23#vlan 23description SW2-SW3-HuLian#interface Vlanif23description SW2-SW3-HuLianip address 23.1.1.2255.255.255.252#interface GigabitEthernet0/0/1port link-type trunkport trunk allow-pass vlan 2 to 4094#
#ospf 10area 0.0.0.0network 12.1.1.0 0.0.0.3#
#ospf 10area 0.0.0.0network 12.1.1.0 0.0.0.3network 23.1.1.0 0.0.0.3#
#ospf 10area 0.0.0.0network 23.1.1.0 0.0.0.3#
#ospf 10import-route static#ip route-static172.16.10.0255.255.255.0 NULL0ip route-static172.16.11.0255.255.255.0 NULL0ip route-static172.16.12.0255.255.255.0 NULL0ip route-static172.16.13.0255.255.255.0 NULL0#
我们可以看到目前所有设备均学习到全路由信息,可以互相通信。
5、根据用户需求了解到,用户希望OSPF网络中SW2连接的网络只能访问172.16.10.0/24、172.16.11.0/24和172.16.12.0/24三个网段的网络,其中SW1连接的网络只能访问172.16.10.0/24网段的网络。
此时我们可以考虑使用路由策略进行配置,具体思路如下对路由进行过滤:
A、在SW3上配置路由策略,在路由发布时运用路由策略,使SW3仅提供路由172.16.10.0/24、172.16.11.0/24和172.16.12.0/24给SW2,实现OSPF网络中只能访问172.16.10.0/24、172.16.11.0/24和172.16.12.0/24三个网段的网络。
B、在SW1上配置路由策略,在路由引入时运用路由策略,使SW1仅接收路由172.16.10.0/24,实现SW1连接的网络只能访问172.16.10.0/24网段的网络。
配置1:
a、在SW3中配置路由发布策略,前缀列表fabu。
ip ip-prefix fabu index10 permit 172.16.10.024ip ip-prefix fabu index11 permit 172.16.11.024ip ip-prefix fabu index12 permit 172.16.12.024
b、在SW3上发布路由器策略,引用前缀列表为fabu的策略
[SW3]ospf 10[SW3-ospf-10]filter-policy ip-prefix fabu export static
c、此时查看SW2路由表项,此时可以看到SW2上仅有172.16.10.0/24、172.16.11.0/24和172.16.12.0/24路由信息。
[SW1]ip ip-prefix jieshou index 10 permit 172.16.10.024#sysname SW2#vlan batch 1223#vlan 12description SW1-SW2-HuLianvlan 23description SW2-SW3-HuLian#interface Vlanif12description SW1-SW2-HuLianip address 12.1.1.2255.255.255.252#interface Vlanif23description SW2-SW3-HuLianip address 23.1.1.1255.255.255.252#interface GigabitEthernet0/0/1port link-type trunkport trunk allow-pass vlan 2 to 4094#interface GigabitEthernet0/0/2port link-type trunkport trunk allow-pass vlan 2 to 4094#0
推荐站内搜索:最好用的开发软件、免费开源系统、渗透测试工具云盘下载、最新渗透测试资料、最新黑客工具下载……




还没有评论,来说两句吧...