OSPF重分布中使用summary-address路由聚合

 

OSPF重分布中使用summary-address路由聚合_第1张图片 

R1上Lo1 : 172.16.0.1/24 R1、R2、R3之间网段为192.168.xy.0/24
Lo2 : 172.16.1.1/24
Lo3 : 172.16.2.1/24
Lo4 : 172.16.3.1/24
需求:
1、 R1的RID为1.1.1.1,R2的RID为2.2.2.2,将OSPF重分布进EIGRP 100内;
2、 重分布时拒绝1.1.1.1/32、2.2.2.2/32、192.168.12.0/24条目进入EIGRP;
(使用access-list、prefix-list、route-map多种方法实现)
3、 R1上使用summary-address命令将172.16.0.1/24-->172.16.3.1/24聚合为172.16.0.0/22
=====================================================
解决方案:
需求1 :
R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 1.1.1.1 0.0.0.0 area 0
R1(config-router)#network 192.168.12.0 0.0.0.255 area 0
R1(config-router)#network 172.16.0.0 0.0.3.255 area 0

R2(config)#router ospf 1
R2(config)#router-id 2.2.2.2
R2(config-router)#network 2.2.2.2 0.0.0.0 area 0
R2(config-router)#network 192.168.12.0 0.0.0.255 area 0
R2(config)#router eigrp 100
R2(config-router)#no au
R2(config-router)#network 192.168.23.0
R2(config-router)#redistribute ospf 1 metric 10000 100 255 1 1500 -->将OSPF重分布进EIGRP

R3(config)#router eigrp 100
R3(config-router)#no au
R3(config-router)#network 3.3.3.3 0.0.0.0
R3(config-router)#network 192.168.23.0

R3上学习到得路由条目:
R3#sh ip route eigrp
D EX 192.168.12.0/24 [170/2195456] via 192.168.23.2, 00:00:19, Serial1/0
1.0.0.0/32 is subnetted, 1 subnets
D EX 1.1.1.1 [170/2195456] via 192.168.23.2, 00:00:19, Serial1/0
2.0.0.0/32 is subnetted, 1 subnets
D EX 2.2.2.2 [170/2195456] via 192.168.23.2, 00:00:19, Serial1/0
172.16.0.0/32 is subnetted, 4 subnets
D EX 172.16.1.1 [170/2195456] via 192.168.23.2, 00:00:19, Serial1/0
D EX 172.16.0.1 [170/2195456] via 192.168.23.2, 00:00:19, Serial1/0
D EX 172.16.3.1 [170/2195456] via 192.168.23.2, 00:00:19, Serial1/0
D EX 172.16.2.1 [170/2195456] via 192.168.23.2, 00:00:19, Serial1/0

可以看到R3学到了OSPF区域的所有路由条目,现在进入需求2
=========================================================
需求2:
方法1:access-list配合route-map
R2(config)#access-list 1 permit 1.1.1.1 -->这相当于后面跟了0.0.0.0
R2(config)#access-list 1 permit 2.2.2.2
R2(config)#access-list 1 permit 192.168.12.0 0.0.0.255
R2(config)#route-map ccna deny 10
R2(config-route-map)#match ip address 1
R2(config)#route-map ccna permit 20
R2(config)#router eigrp 100
R2(config-router)#redistribute ospf 1 route-map ccna

在R3上查看路由表:
R3#sh ip route eigrp
172.16.0.0/32 is subnetted, 4 subnets
D EX 172.16.1.1 [170/2195456] via 192.168.23.2, 00:05:48, Serial1/0
D EX 172.16.0.1 [170/2195456] via 192.168.23.2, 00:05:48, Serial1/0
D EX 172.16.3.1 [170/2195456] via 192.168.23.2, 00:05:48, Serial1/0
D EX 172.16.2.1 [170/2195456] via 192.168.23.2, 00:05:48, Serial1/0

可以看到1.1.1.1/32、2.2.2.2/32、192.168.12.0/24已经被拒绝了。
--------------------------------------------------------------------------------
方法2:还是access-lis配合route-map,先清除方法1的配置
R2(config)#access-list 1 deny 1.1.1.1
R2(config)#access-list 1 deny 2.2.2.2
R2(config)#access-list 1 deny 192.168.12.0 0.0.0.255
R2(config)#access-list 1 permit any
R2(config)#route-map ccna permit 10
R2(config-route-map)#match ip address 1
R2(config)#router eigrp 100
R2(config-router)#redistribute ospf 1 route-map ccna

在R3上查看路由表:
R3#sh ip route eigrp
172.16.0.0/32 is subnetted, 4 subnets
D EX 172.16.1.1 [170/2195456] via 192.168.23.2, 00:00:06, Serial1/0
D EX 172.16.0.1 [170/2195456] via 192.168.23.2, 00:00:06, Serial1/0
D EX 172.16.3.1 [170/2195456] via 192.168.23.2, 00:00:06, Serial1/0
D EX 172.16.2.1 [170/2195456] via 192.168.23.2, 00:00:06, Serial1/0
可以看到1.1.1.1/32、2.2.2.2/32、192.168.12.0/24已经被拒绝了。
-----------------------------------------------------------------------
方法3:prefix-list配合route-map,先清除方法2的配置。
R2(config)#ip prefix-list ccnp permit 1.1.1.1/32
R2(config)#ip prefix-list ccnp permit 2.2.2.2/32
R2(config)#ip prefix-list ccnp permit 192.168.12.0/24
R2(config)#route-map ccna deny 10
R2(config-route-map)#match ip address prefix-list ccnp
R2(config)#route-map ccna permit 20

在R3上查看路由表:
R3#sh ip route eigrp
172.16.0.0/32 is subnetted, 4 subnets
D EX 172.16.1.1 [170/2195456] via 192.168.23.2, 00:00:03, Serial1/0
D EX 172.16.0.1 [170/2195456] via 192.168.23.2, 00:00:03, Serial1/0
D EX 172.16.3.1 [170/2195456] via 192.168.23.2, 00:00:03, Serial1/0
D EX 172.16.2.1 [170/2195456] via 192.168.23.2, 00:00:03, Serial1/0

可以看到1.1.1.1/32、2.2.2.2/32、192.168.12.0/24已经被拒绝了。
-----------------------------------------------------------------------------
方法4:还是prefix-list配合route-map,先清除方法3的配置。
R2(config)#ip prefix-list ccnp deny 1.1.1.1/32
R2(config)#ip prefix-list ccnp deny 2.2.2.2/32
R2(config)#ip prefix-list ccnp deny 192.168.12.0/24
R2(config)#ip prefix-list ccnp permit 0.0.0.0/0 le 32
R2(config)#route-map ccna permit 10
R2(config-route-map)#match ip address prefix-list ccnp

在R3上查看路由表:
R3#sh ip route eigrp
D EX 172.16.1.1 [170/2195456] via 192.168.23.2, 00:00:11, Serial1/0
D EX 172.16.0.1 [170/2195456] via 192.168.23.2, 00:00:11, Serial1/0
D EX 172.16.3.1 [170/2195456] via 192.168.23.2, 00:00:11, Serial1/0
D EX 172.16.2.1 [170/2195456] via 192.168.23.2, 00:00:11, Serial1/0

可以看到1.1.1.1/32、2.2.2.2/32、192.168.12.0/24已经被拒绝了。
=====================================================
需求3:注意summary-address命令是用来聚合重分布到OSPF区域的路由的!
R1(config)#router ospf 1
R1(config-router)#no network 172.16.0.0 0.0.3.255 area 0 -->取消原来的OSPF宣告
R1(config-router)#redistribute connected subnets -->重分布直连
R1(config-router)#summary-address 172.16.0.0 255.255.252.0
-->注意summary-address命令是用来聚合重分布进OSPF的路由的!

在R2和R3上查看效果:
R2#sh ip route ospf
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/65] via 192.168.12.1, 00:53:25, Serial1/0
172.16.0.0/22 is subnetted, 1 subnets
O E2 172.16.0.0 [110/20] via 192.168.12.1, 00:02:31, Serial1/0

R3#sh ip route eigrp
172.16.0.0/22 is subnetted, 1 subnets
D EX 172.16.0.0 [170/2195456] via 192.168.23.2, 00:01:29, Serial1/0

可以看到R2和R3上学习到了172.16.0.0/22的聚合路由!

 

你可能感兴趣的:(休闲,思科,ospf,重分布,路由聚合)