注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 CCIE-Lab考试将新增10分钟..
 帮助

OSPF实验6:OSPF汇总


2007-08-16 20:19:44
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://gairuhe.blog.51cto.com/77728/38558

OSPF实验6OSPF汇总

实验等级:Professional
 
实验拓扑:
 
 
实验说明:
 
OSPF骨干区域当中,一个区域的所有地址都会被通告进来。但是如果某个子网忽好忽坏不稳定,那么在它每次改变状态的时候,都会引起LSA在整个网络中泛洪。为了解决这个问题,我们可以对网络地址进行汇总。
Cisco路由器的汇总有两种类型:区域汇总和外部路由汇总。区域汇总就是区域之间的地址汇总,一般配置在ABR上;外部路由汇总就是一组外部路由通过重发布进入OSPF中,将这些外部路由进行汇总。一般配置在ASBR上。
 
 
实验基本配置:
 
R1
interface Loopback0
 ip address 1.1.1.1 255.255.255.0
 ip ospf network point-to-point
!
interface Serial1/0
 ip address 10.1.1.1 255.255.255.0
 serial restart-delay 0
!
router ospf 10
 router-id 1.1.1.1
 log-adjacency-changes
 network 1.1.1.0 0.0.0.255 area 0
 network 10.1.1.0 0.0.0.255 area 0
 
R2
interface Loopback0
 ip address 2.2.2.2 255.255.255.0
!
interface Loopback1
 ip address 12.1.0.1 255.255.255.0 secondary
 ip address 12.2.0.1 255.255.255.0 secondary
 ip address 12.3.0.1 255.255.255.0 secondary
 ip address 12.4.0.1 255.255.255.0 secondary
 ip address 12.5.0.1 255.255.255.0 secondary
 ip address 12.6.0.1 255.255.255.0 secondary
 ip address 12.7.0.1 255.255.255.0 secondary
 ip address 12.0.0.1 255.255.255.0
!
interface Serial1/0
 ip address 10.1.1.2 255.255.255.0
 serial restart-delay 0
!
interface Serial1/1
 ip address 11.1.1.1 255.255.255.0
 serial restart-delay 0
!
router ospf 10
 router-id 2.2.2.2
 log-adjacency-changes
 area 1 virtual-link 3.3.3.3
 network 10.1.1.0 0.0.0.255 area 0
 network 11.1.1.0 0.0.0.255 area 1
 
R3
interface Loopback0
 ip address 3.3.3.3 255.255.255.0
!
interface Loopback1
 ip address 13.1.0.1 255.255.255.0 secondary
 ip address 13.2.0.1 255.255.255.0 secondary
 ip address 13.3.0.1 255.255.255.0 secondary
 ip address 13.4.0.1 255.255.255.0 secondary
 ip address 13.5.0.1 255.255.255.0 secondary
 ip address 13.6.0.1 255.255.255.0 secondary
 ip address 13.7.0.1 255.255.255.0 secondary
 ip address 13.0.0.1 255.255.255.0
!
!
interface Serial1/0
 ip address 11.1.1.2 255.255.255.0
 serial restart-delay 0
!
router ospf 10
 router-id 3.3.3.3
 log-adjacency-changes
 area 1 virtual-link 2.2.2.2
 network 3.3.3.0 0.0.0.255 area 2
 network 11.1.1.0 0.0.0.255 area 1
 network 13.0.0.0 0.0.255.255 area 2
 network 13.1.0.0 0.0.255.255 area 2
 network 13.2.0.0 0.0.255.255 area 2
 network 13.3.0.0 0.0.255.255 area 2
 network 13.4.0.0 0.0.255.255 area 2
 network 13.5.0.0 0.0.255.255 area 2
 network 13.6.0.0 0.0.255.255 area 2
 network 13.7.0.0 0.0.255.255 area 2
 
1.OSPF区域路由汇总:
 
我们在R1上查看路由表
R1#sho ip rou
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is not set
 
     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
O IA    3.3.3.3 [110/129] via 10.1.1.2, 00:02:51, Serial1/0
     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, Serial1/0
     11.0.0.0/24 is subnetted, 1 subnets
O IA    11.1.1.0 [110/128] via 10.1.1.2, 00:02:51, Serial1/0
     13.0.0.0/8 is variably subnetted, 8 subnets, 2 masks
O IA    13.5.0.0/24 [110/129] via 10.1.1.2, 00:02:40, Serial1/0
O IA    13.4.0.0/24 [110/129] via 10.1.1.2, 00:02:40, Serial1/0
O IA    13.7.0.0/24 [110/129] via 10.1.1.2, 00:02:30, Serial1/0
O IA    13.6.0.0/24 [110/129] via 10.1.1.2, 00:02:41, Serial1/0
O IA    13.1.0.0/24 [110/129] via 10.1.1.2, 00:02:51, Serial1/0
O IA    13.0.0.1/32 [110/129] via 10.1.1.2, 00:02:52, Serial1/0
O IA    13.3.0.0/24 [110/129] via 10.1.1.2, 00:02:41, Serial1/0
O IA    13.2.0.0/24 [110/129] via 10.1.1.2, 00:02:51, Serial1/0
路由表中粗体的内容就是我们要进行汇总的路由。
 
我们观察这些地址,通过计算得出汇总的地址是13.0.0.0/13
前面说过,区域汇总是在ABR上进行的,在这个试验中,产生这些路由的路由器是R3。所以我们在R3上进行如下配置:
 
R3(config)#router ospf 10
R3(config-router)#area 2 range 13.0.0.0 255.248.0.0
 
此时在查看R1的路由表:
R1#sho ip rou
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is not set
 
     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
O IA    3.3.3.3 [110/129] via 10.1.1.2, 00:00:00, Serial1/0
     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, Serial1/0
     11.0.0.0/24 is subnetted, 1 subnets
O IA    11.1.1.0 [110/128] via 10.1.1.2, 00:11:12, Serial1/0
     13.0.0.0/13 is subnetted, 1 subnets
O IA    13.0.0.0 [110/129] via 10.1.1.2, 00:00:17, Serial1/0
汇总已经完成。
 
在进行区域汇总的时候,为了防止路由黑洞。我们一般会使用将这条汇总地址增加一条静态路由指向空接口(Null)。
 
R3(config)#ip route 13.0.0.0 255.248.0.0 null0
 
2.外部路由汇总
 
我们将R2的直连接口重发布到OSPF上:
 
R2(config)#router ospf 10
R2(config-router)#redistribute connected subnets
  
此时查看R1的路由表:
   R1#sho ip rou
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is not set
 
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     2.0.0.0/24 is subnetted, 1 subnets
O E2    2.2.2.0 [110/20] via 10.1.1.2, 00:00:14, Serial1/0
     3.0.0.0/32 is subnetted, 1 subnets
O IA    3.3.3.3 [110/129] via 10.1.1.2, 00:00:24, Serial1/0
     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, Serial1/0
     11.0.0.0/24 is subnetted, 1 subnets
O IA    11.1.1.0 [110/128] via 10.1.1.2, 00:00:24, Serial1/0
     12.0.0.0/24 is subnetted, 8 subnets
O E2    12.4.0.0 [110/20] via 10.1.1.2, 00:00:14, Serial1/0
O E2    12.5.0.0 [110/20] via 10.1.1.2, 00:00:14, Serial1/0
O E2    12.6.0.0 [110/20] via 10.1.1.2, 00:00:15, Serial1/0
O E2    12.7.0.0 [110/20] via 10.1.1.2, 00:00:15, Serial1/0
O E2    12.0.0.0 [110/20] via 10.1.1.2, 00:00:15, Serial1/0
O E2    12.1.0.0 [110/20] via 10.1.1.2, 00:00:15, Serial1/0
O E2    12.2.0.0 [110/20] via 10.1.1.2, 00:00:15, Serial1/0
O E2    12.3.0.0 [110/20] via 10.1.1.2, 00:00:15, Serial1/0
     13.0.0.0/13 is subnetted, 1 subnets
O IA    13.0.0.0 [110/129] via 10.1.1.2, 00:00:25, Serial1/0
路由表中粗体的部分就是我们要进行外部路由汇总的地址。
 
经过计算,汇总的地址为12.0.0.0/13
外部路由的汇总在ASBR上进行,既本实验的R2。配置如下:
 
R2(config-router)#router ospf 10                     
R2(config-router)#summary-address 12.0.0.0 255.248.0.0
  
此时回到R1上查看路由表:
R1#sho ip rou
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is not set
 
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     2.0.0.0/24 is subnetted, 1 subnets
O E2    2.2.2.0 [110/20] via 10.1.1.2, 00:02:54, Serial1/0
     3.0.0.0/32 is subnetted, 1 subnets
O IA    3.3.3.3 [110/129] via 10.1.1.2, 00:03:04, Serial1/0
     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, Serial1/0
     11.0.0.0/24 is subnetted, 1 subnets
O IA    11.1.1.0 [110/128] via 10.1.1.2, 00:03:04, Serial1/0
     12.0.0.0/13 is subnetted, 1 subnets
O E2    12.0.0.0 [110/20] via 10.1.1.2, 00:00:38, Serial1/0
     13.0.0.0/13 is subnetted, 1 subnets
O IA    13.0.0.0 [110/129] via 10.1.1.2, 00:03:04, Serial1/0
 
汇总已经完成。
 
总结:
OSPF中进行汇总。区域汇总和外部路由汇总使用的命令是不一样的,这点要注意。
区域汇总:
area area-id range ip-address mask
外部路由汇总:
summary-address ip-address mask

本文出自 “盖如鹤的步徒” 博客,请务必保留此出处http://gairuhe.blog.51cto.com/77728/38558





    文章评论
 
2007-08-16 21:21:03
R1#sho ip rou
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

要记下来

2007-08-18 18:37:23
恩,这个实验相当不错,如果能加上路由重发布那就更好了。RIP和OSPF的双向注入还是很重要的,希望后续有此内容。

我已将你加入友情链接,希望以后多多交流……

2007-08-19 01:39:41
实验拓扑:



实验要求:
在R1、R2上配置OSPF区域1,在R2、R3上配置OSPF区域0,在R3、R4上配置RIP(V1),要求为OSPF 与RIP(V1)互相重新发布,以便让每一台路由器的路由表中必须存在到达其他任何一台路由器的全部子网的路由项目。
IP地址表:
路由器         接口         IP地址
  R1           Loop0       10.10.10.10/24
  R1           Loop1       172.16.10.1/28
  R1           Loop2       1.1.1.1/28
  R1           S0         172.16.1.1/30
  R2           S0         172.16.1.2/30
  R2           S1         172.16.2.1/30
  R3           S0         172.16.2.2/30
  R3           S1         172.16.3.1/24
  R4           S0         172.16.3.2/24
  R4           Loop0       4.4.4.4/24
实验配置如下:
一、基本配置
配置R1:
Router>en
Router#conf t
Router(config)#host R1
R1(config)#int loop0
R1(config-if)#ip add 10.10.10.10 255.255.255.0
R1(config-if)#int loop1
R1(config-if)#ip add 172.16.10.1 255.255.255.240
R1(config-if)#int loop2
R1(config-if)#ip add 1.1.1.1 255.255.255.240
R1(config-if)#int S0
R1(config-if)#ip add 172.16.1.1 255.255.255.252
R1(config-if)#no shut
R1(config-if)#end
R1#sh run
配置R2:
Router>en
Router#conf t
Router(config)#host R2
R2(config)#int S0
R2(config-if)#ip add 172.16.1.2 255.255.255.252
R2(config-if)#no shut
R2(config-if)#clock rate 64000
R2(config-if)#int S1
R2(config-if)#ip add 172.16.2.1 255.255.255.252
R2(config-if)#no shut
R2(config-if)#clock rate 64000
R2(config-if)#end
R2#sh run
配置R3:
Router>en
Router#conf t
Router(config)#host R3
R3(config)#int S0
R3(config-if)#ip add 172.16.2.2 255.255.255.252
R3(config-if)#no shut
R3(config-if)#int S1
R3(config-if)#ip add 172.16.3.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#clock rate 64000
R3(config-if)#end
R3#sh run
配置R4:
Router>en
Router#conf t
Router(config)#host R4
R4(config)#int S0
R4(config-if)#ip add 172.16.3.2 255.255.255.0
R4(config-if)#no shut
R4(config-if)#int loop0
R4(config-if)#ip add 4.4.4.4 255.255.255.0
R4(config-if)#end
R4#sh run
二、配置OSPF与RIP(V1)
R1#conf t
R1(config)#router ospf 10
R1(config-router)#network 172.16.1.1 0.0.0.3 area 1
R1(config-router)#network 10.10.10.10 0.0.0.255 area 1 //发布两个直连的网段
R1(config-router)#end
R1#sh ip route
R2#conf t
R2(config)#router ospf 20
R2(config-router)#network 172.16.1.2 0.0.0.3 area 1 //ABR 连接两个区域
R2(config-router)#network 172.16.2.1 0.0.0.3 area 0
R1(config-router)#end
R1#sh ip route
R3#conf t
R3(config)#router ospf 30
R3(config-router)#network 172.16.2.2 0.0.0.3 area 0
R3(config-router)#router rip
R3(config-router)#network 172.16.3.1 //ASBR 连接两个AS
R3(config-route)#end
R1#sh ip route
R4#conf t
R4(config)#router rip
R4(config-router)#network 172.16.3.2 //发布RIP
R4(config-router)#network 4.4.4.4
R4(config-router)#end
R4#sh ip route
三、路由再发布:
R1#conf t
R1(config)#router ospf 10
R1(config-router)#redistribute connected subnets //在R1上发布未通告的直连段
R1(config-route)#summary-address 172.16.10.1 255.255.255.0 //汇总成/24给RIP
R1(config-router)#end
R1#sh ip route
R2#conf t
R2(config)#router ospf 20
R2(config-router)#area 1 range 172.16.1.0 255.255.255.0 //在ABR 上进行区域1汇总
R2(config-router)#end
R2#sh ip route
R3#conf t
R3(config)#router ospf 30
R3(config-router)#redistribute rip subnets
R3(config-router)#default-metric 64 //在ASBR 上重发布RIP
R3(config-router)#router rip
R3(config-router)#redistribute ospf 30 //在ASBR 上重发布OSPF
R3(config-router)#default-metric 2
R3(config-router)#exit
R3(config)#ip route 172.16.2.0 255.255.255.0 null 0 //在ASBR 上使用静态路由汇总到空接口,通过空接口进行转发通信信息,便于RIP学习到
R3(config-router)#int S0
R3(config-if)#ip summary rip 172.16.2.0 255.255.255.0
R3(config)#end
R3#sh ip route
R2#sh ip route
R4#sh ip route
R3#sh ip route

实验总结:
1.在R1上发布未通告的直连口,这样其他OSPF区域就可以学习到了。
2.由于RIP(V1)只支持有类路由,它只能学习到/8,/16/,/24的路由信息,所以需要在R1上对172.16.10.1/28
进行汇总,汇总成/24的,这样才能让RIP学习到。
3.为了让RIP(V1)学习到OSPF 上区域1的172.16.1.0/30 网段,需要在R2上对区域1的172.16.1.0 进
行汇总。汇总成/24,这样RIP就可以学习到了。
4.为了让RIP(V1)能学习到OSPF的全部区域路由信息,需要在ASBR-R3上互相重新发布RIP和OSPF
信息;为了让RIP(V1)学习到OSPF 的区域0 的172.16.2.0/30 的网段,需要在R3 上对区域0 的
172.16.2.0通过空接口进行静态路由映射,映射成/24的,以便RIP能学习的。
经过上面的四步后,每台路由器特别是RIP(V1)区域的R4路由器就能学习到整个网络的全部路由信息。
PS:1.在ABR 路由器上进行汇总:area <number> range ip-address netmask
例如:area 1 172.16.1.0 255.255.255.0
2.在ASBR 路由器上进行汇总:summary-address ip-address netmask
例如:summary-address 172.16.10.1 255.255.255.0
两者均在OSPF模式下配置!


 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: