其他分享
首页 > 其他分享> > 重发布实验

重发布实验

作者:互联网

重发布实验

实验要求:
在这里插入图片描述
实验设计:
在这里插入图片描述
实验所用配置命令:
rip:
[r1]rip 1
[r1-rip-1]verify-source
[r1-rip-1]version 2
[r1-rip-1]un summary
[r1-rip-1]network 1.0.0.0
ospf:
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 24.1.1.2 0.0.0.0
抓流量—ACL :
[r1]ip ip-prefix abc permit 1.1.1.0 25
[r1]ip ip-prefix abc permit 2.2.2.0 24
[r1]ip ip-prefix acb index 15 deny 5.5.5.0 24
[r1]un ip ip-prefix abc index 10
[r1]ip ip-prefix a permit 10.1.1.0 25 less-equal 30 网络号10.1.1.0 掩码长度为25到30
[r1]ip ip-prefix a permit 11.1.1.0 24 greater-equal 25 网络号11.1.1.0 掩码长度25到32
[r1]ip ip-prefix a permit 12.1.1.0 24 greater-equal 26 less-equal 30 掩码范围26到30
[r1]ip ip-prefix a permit 0.0.0.0 0 less-equal 32 允许所有
[r1]ip ip-prefix aa permit 2.2.2.0 24 使用前缀列表抓取;ACL也可

[r1]interface GigabitEthernet 0/0/1 控制层面流量传输的接口
[r1-GigabitEthernet0/0/1]rip metricin ip-prefix aa 2 流量入,匹配前缀列表aa,度量加2
metricout 2000 2 流量出,匹配acl 2000,度量加2

[r2]ip ip-prefix qq deny 2.2.2.0 24
[r2]ip ip-prefix qq permit 0.0.0.0 0 less-equal 32

[r2]rip 1
[r2-rip-1]filter-policy ip-prefix qq ?
export Specify an export policy 出方向
import Specify an import policy 入方向
[r2-rip-1]filter-policy ip-prefix qq export GigabitEthernet 0/0/0
1.抓流量—acl和前缀列表均可
[r2-acl-basic-2000]rule 1 permit source 1.1.1.0 0.0.0.0
[r2-acl-basic-2000]q
[r2]acl 2001
[r2-acl-basic-2001]rule permit source 1.1.2.0 0.0.0.0
[r2-acl-basic-2001]q

[r2]ip ip-prefix a permit 1.1.3.0 24
[r2]ip ip-prefix b permit 1.1.4.0 24

2.路由策略
[r2]route-policy huawei deny node 10 创建名为huawei的路由策略,大动作为拒绝,序号为10
[r2-route-policy]if-match acl 2000 匹配一张ACL
[r2-route-policy]q
[r2]route-policy huawei permit node 20 列表huawei序号20,大动作为允许
[r2-route-policy]if-match acl 2001 匹配一张ACL
[r2-route-policy]apply cost-type type-1 定义小动作为修改度量类型,为类型1;
[r2-route-policy]q
[r2]route-policy huawei permit node 30
[r2-route-policy]if-match ip-prefix a 匹配前缀列表
[r2-route-policy]apply cost 7
[r2-route-policy]q
[r2]route-policy huawei permit node 40
[r2-route-policy]if-match ip-prefix b
[r2-route-policy]apply cost-type type-1
[r2-route-policy]apply cost 8
[r2-route-policy]q
[r2]route-policy huawei permit node 50 空表,允许所有;
[r2-route-policy]q

3.重发布时调用
[r2]ospf 1
[r2-ospf-1]import-route rip 1 route-policy Huawei

[r3]ip ip-prefix a permit 1.1.1.0 24
[r3]acl 2000
[r3-acl-basic-2000]rule permit sou 12.1.1.2 0.0.0.0
route-policy huawei permit node 10
if-match ip-prefix a
if-match ip next-hop acl 2000 与关系—被匹配流量必须同时满足这两个条件;
apply cost 10
apply cost-type type-1 与关系,同时执行两种操作

实验结果:
在这里插入图片描述

标签:r2,ip,route,prefix,发布,实验,permit,policy
来源: https://blog.csdn.net/qwuegqufgho/article/details/113358692