ospf

 

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] vi a 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] vi a 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] vi a 10.1.1 .2, 00:02:40, Serial1/0

O IA    13.4.0 .0/24 [110/129] vi a 10.1.1 .2, 00:02:40, Serial1/0

O IA    13.7.0 .0/24 [110/129] vi a 10.1.1 .2, 00:02:30, Serial1/0

O IA    13.6.0 .0/24 [110/129] vi a 10.1.1 .2, 00:02:41, Serial1/0

O IA    13.1.0 .0/24 [110/129] vi a 10.1.1 .2, 00:02:51, Serial1/0

O IA    13.0.0 .1/32 [110/129] vi a 10.1.1 .2, 00:02:52, Serial1/0

O IA    13.3.0 .0/24 [110/129] vi a 10.1.1 .2, 00:02:41, Serial1/0

O IA    13.2.0 .0/24 [110/129] vi a 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] vi a 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] vi a 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] vi a 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] vi a 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] vi a 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] vi a 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] vi a 10.1.1 .2, 00:00:14, Serial1/0

O E2    12.5.0 .0 [110/20] vi a 10.1.1 .2, 00:00:14, Serial1/0

O E2    12.6.0 .0 [110/20] vi a 10.1.1 .2, 00:00:15, Serial1/0

O E2    12.7.0 .0 [110/20] vi a 10.1.1 .2, 00:00:15, Serial1/0

O E2    12.0.0 .0 [110/20] vi a 10.1.1 .2, 00:00:15, Serial1/0

O E2    12.1.0 .0 [110/20] vi a 10.1.1 .2, 00:00:15, Serial1/0

O E2    12.2.0 .0 [110/20] vi a 10.1.1 .2, 00:00:15, Serial1/0

O E2    12.3.0 .0 [110/20] vi a 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] vi a 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] vi a 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] vi a 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] vi a 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] vi a 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] vi a 10.1.1 .2, 00:03:04, Serial1/0

 

汇总已经完成。

 

总结:

OSPF中进行汇总。区域汇总和外部路由汇总使用的命令是不一样的,这点要注意。

区域汇总:

area area-id range ip-address mask

外部路由汇总:

summary-address ip-address mask

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值