3路由策略_route-map(用于重分发)
原创
©著作权归作者所有:来自51CTO博客作者810105851的原创作品,请联系作者获取转载授权,否则将追究法律责任
拓扑图:
配置参数:
R1:
access-list 1 permit 11.11.11.0 0.0.0.255
route-map connected permit 10
match ip address 1
router rip
version 2
redistribute connected route-map connected
network 192.168.1.0
no
auto-summary
R2:
access-list 1 permit 3.3.3.0 0.0.0.255
access-list 2 permit 23.23.23.0 0.0.0.255
route-map ospf permit 10
match ip address 1
set
metric 1
route-map ospf permit 20
match ip address 2
set
metric 2
router ospf 1
redistribute rip subnets
network 192.168.2.0 0.0.0.255 area 0
router rip
version 2
redistribute ospf 1 route-map ospf
network 192.168.1.0
no
auto-summary
查看配置效果:
R2:
r2#sh ip rou
Gateway of last resort is not set
3.0.0.0/32 is subnetted, 1 subnets
O
3.3.3.3 [110/65] via 192.168.2.2,
00:13:16, Serial0/1
23.0.0.0/32 is subnetted, 1 subnets
O
23.23.23.23 [110/65] via 192.168.2.2, 00:13:16, Serial0/1
11.0.0.0/24 is subnetted, 1 subnets
R 11.11.11.0
[120/1] via 192.168.1.1, 00:00:17, Serial0/0
C
192.168.1.0/24 is directly connected, Serial0/0
C
192.168.2.0/24 is directly connected, Serial0/1
r2#
从上面可以看出R2只学习到了R1的1条直连路由(11.11.11.0/24)
R1:
r1#sh ip rou
1.0.0.0/24 is subnetted, 1 subnets
C
1.1.1.0 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
R 3.3.3.3 [120/1]
via 192.168.1.2, 00:00:07, Serial0/0
23.0.0.0/32 is subnetted, 1 subnets
R 23.23.23.23
[120/2] via 192.168.1.2, 00:00:07, Serial0/0
11.0.0.0/24 is subnetted, 1 subnets
C
11.11.11.0 is directly connected, Loopback1
C
192.168.1.0/24 is directly connected, Serial0/0
r1#
从上面可以看出R1学习到了3.3.3.0/24这条路由的路数为1,学习到23.23.23.0/24这条路由为2跳!!!实验配置成功!!!
拓扑图2:
配置参数:
在R1上先不要配置111.111.111.111这条,先配置好下面参数,等一下测试要用到。
R1:
access-list 1 permit 1.1.1.0 0.0.0.255 //ACL在这里用来匹配流量(只匹配1.1.1.0/24),然后在route-map中配置为只有1.1.1.0/24这条路由不匹配(不被重发布,使R2不能学习),其它路由则匹配(可以被重发布,使R2可以学习到)
route-map connected deny 10 //设置不匹配参数
match ip address 1 //设置不匹配的流量为访问列表1
route-map connected permit 20 //设置其它路由匹配(允许重发布)
router rip
version 2
redistribute connected route-map connected //在RIP重发布直连路由时应用上面配置的路由图connected
network 192.168.1.0
no
auto-summary
R2:与上个拓扑图配置一样。
查看配置效果:
R2:
r2#sh ip rou
3.0.0.0/32 is subnetted, 1 subnets
O
3.3.3.3 [110/65] via 192.168.2.2, 00:25:40, Serial0/1
23.0.0.0/32 is subnetted, 1 subnets
O
23.23.23.23 [110/65] via 192.168.2.2, 00:25:40, Serial0/1
11.0.0.0/24 is subnetted, 1 subnets
R 11.11.11.0
[120/1] via 192.168.1.1, 00:00:11, Serial0/0
C
192.168.1.0/24 is directly connected, Serial0/0
C
192.168.2.0/24 is directly connected, Serial0/1
r2#
可以看出了R2没有学习到1.1.1.1/24这条路由,而学习到了11.11.11.11/24这条路由。从上面R1的配置中,说明R2可以学习到除了1.1.1.1/24这条路由的其它路由,在这里我样可以测试一下:
现在在R1上配置一条111.111.111.111/24的路由,可以发现R2马上就可以学习到,如果是按照上一个拓扑图那样配置的话,R2是学习不到的。
R1:
r1(config)#int l2
r1(config-if)#ip add 111.111.111.111
255.255.255.0
r1(config-if)#no sh
r1(config-if)#
查看配置效果:
R2:
r2#sh ip rou
3.0.0.0/32 is subnetted, 1 subnets
O
3.3.3.3 [110/65] via 192.168.2.2, 00:29:29, Serial0/1
23.0.0.0/32 is subnetted, 1 subnets
O
23.23.23.23 [110/65] via 192.168.2.2, 00:29:29, Serial0/1
111.0.0.0/24 is subnetted, 1 subnets
R 111.111.111.0
[120/1] via 192.168.1.1, 00:00:18, Serial0/0
11.0.0.0/24 is subnetted, 1 subnets
R
11.11.11.0 [120/1] via 192.168.1.1, 00:00:18, Serial0/0
C
192.168.1.0/24 is directly connected, Serial0/0
C
192.168.2.0/24 is directly connected, Serial0/1
r2#
看到了吧,R2马上就学习到了!!!
上一篇:GNS3综合实验_0130
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章