cheng029 发表于 2013-1-17 09:31:00

OSPF路由聚合实验(详细)

理论准备:

利用abr-summary 过滤区域内的路由,对区域类型没有要求。

利用asbr-summary过滤区域内的外部路由,需要在区域内部的ASBR上配置,当ASBR很多时,配置比较复杂。


利用asbr-summary过滤区域内的外部路由,只需要在ABR上配置,但是要求区域必需为NSSA 。

not-advertise参数:不通告匹配指定IP地址/掩码的路由

一、实验证明以下两点

利用abr-summary 过滤区域内的路由
abr-summary ip-address mask [ advertise | not-advertise ]


利用asbr-summary过滤区域内的外部路由
asbr-summary ip-address mask [ not-advertise | tag tag-value ]

拓扑如下,配置会在最后会贴出来,设备用的是华三的模拟器






1、1配置聚合前:
<R4>dis ip ro
Routing Tables: Public
      Destinations : 15       Routes : 15

Destination/Mask    ProtoPreCost         NextHop         Interface

3.3.3.0/30          OSPF   10   3124         4.4.4.1         S0/6/1
3.3.3.2/32          O_ASE1501            4.4.4.1         S0/6/1
4.4.4.0/30          Direct 0    0            4.4.4.2         S0/6/1
4.4.4.1/32          Direct 0    0            4.4.4.1         S0/6/1
4.4.4.2/32          Direct 0    0            127.0.0.1       InLoop0
6.1.1.1/32          O_ASE1501            4.4.4.1         S0/6/1
6.1.2.1/32          O_ASE1501            4.4.4.1         S0/6/1
6.1.3.1/32          O_ASE1501            4.4.4.1         S0/6/1
7.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0
7.1.2.1/32          Direct 0    0            127.0.0.1       InLoop0
7.1.3.1/32          Direct 0    0            127.0.0.1       InLoop0
10.1.1.2/32         O_ASE1501            4.4.4.1         S0/6/1
10.1.1.4/32         Direct 0    0            127.0.0.1       InLoop0
127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0
127.0.0.1/32      Direct 0    0            127.0.0.1       InLoop0
R4的路由表中有三条O_ASE 6.1.0.0/16网段

dis ospf lsdb

         OSPF Process 1 with Router ID 10.1.1.4
               Link State Database

                         Area: 0.0.0.1
Type      LinkState ID    AdvRouter          AgeLen   Sequence   Metric
Router    10.1.1.4      10.1.1.4         81284    80000004       0
Router    10.1.1.3      10.1.1.3         81348    80000002       0
Sum-Net   3.3.3.0         10.1.1.3         82128    80000001    1562
Sum-Asbr10.1.1.2      10.1.1.3         82128    80000001    1562

               AS External Database
Type      LinkState ID    AdvRouter          AgeLen   Sequence   Metric
External6.1.2.1         10.1.1.2         26636    80000001       1
External6.1.3.1         10.1.1.2         26636    80000001       1
External6.1.1.1         10.1.1.2         26636    80000001       1
External3.3.3.0         10.1.1.2         85436    80000001       1
External3.3.3.2         10.1.1.2         85436    80000001       1
External10.1.1.2      10.1.1.2         85436    80000001       1





dis ip ro
Routing Tables: Public
      Destinations : 13       Routes : 13

Destination/Mask    ProtoPreCost         NextHop         Interface

3.3.3.0/30          Direct 0    0            3.3.3.1         S0/6/0
3.3.3.1/32          Direct 0    0            127.0.0.1       InLoop0
3.3.3.2/32          Direct 0    0            3.3.3.2         S0/6/0
4.4.4.0/30          OSPF   10   3124         3.3.3.2         S0/6/0
6.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0
6.1.2.1/32          Direct 0    0            127.0.0.1       InLoop0
6.1.3.1/32          Direct 0    0            127.0.0.1       InLoop0
7.1.1.1/32          OSPF   10   3124         3.3.3.2         S0/6/0
7.1.2.1/32          OSPF   10   3124         3.3.3.2         S0/6/0
7.1.3.1/32          OSPF   10   3124         3.3.3.2         S0/6/0
10.1.1.2/32         Direct 0    0            127.0.0.1       InLoop0
127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0
127.0.0.1/32      Direct 0    0            127.0.0.1       InLoop0

R1的路由表中有三条ospf路由到 7.1.0.0/16网段

下面我们再来分析R1的LSA



dis ospf lsdb

         OSPF Process 1 with Router ID 10.1.1.2
               Link State Database

                         Area: 0.0.0.0
Type      LinkState ID    AdvRouter          AgeLen   Sequence   Metric
Router    10.1.1.3      10.1.1.3         77848    80000003       0
Router    10.1.1.2      10.1.1.2         78248    80000002       0
Sum-Net   4.4.4.0         10.1.1.3         76028    80000001    1562
Sum-Net   7.1.3.1         10.1.1.3         18228    80000001    1562
Sum-Net   7.1.2.1         10.1.1.3         18228    80000001    1562
Sum-Net   7.1.1.1         10.1.1.3         18228    80000001    1562

               AS External Database
Type      LinkState ID    AdvRouter          AgeLen   Sequence   Metric
External6.1.2.1         10.1.1.2         20236    80000001       1
External6.1.3.1         10.1.1.2         20236    80000001       1
External6.1.1.1         10.1.1.2         20236    80000001       1
External3.3.3.0         10.1.1.2         79136    80000001       1
External3.3.3.2         10.1.1.2         79136    80000001       1
External10.1.1.2      10.1.1.2         79136    80000001       1





1、2 在R1上加入如命令后:
ospf 1 router-id 10.1.1.2
asbr-summary 6.1.0.0 255.255.0.0
import-route direct



在R2的区域1配置聚合的命令后
area 0.0.0.1   
abr-summary 7.1.0.0 255.255.0.0

我们再来看路由表
<R4>dis ip ro
Routing Tables: Public
      Destinations : 13       Routes : 13

Destination/Mask    ProtoPreCost         NextHop         Interface

3.3.3.0/30          OSPF   10   3124         4.4.4.1         S0/6/1
3.3.3.2/32          O_ASE1501            4.4.4.1         S0/6/1
4.4.4.0/30          Direct 0    0            4.4.4.2         S0/6/1
4.4.4.1/32          Direct 0    0            4.4.4.1         S0/6/1
4.4.4.2/32          Direct 0    0            127.0.0.1       InLoop0
6.1.0.0/16          O_ASE1502            4.4.4.1         S0/6/1//聚合成功
7.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0
7.1.2.1/32          Direct 0    0            127.0.0.1       InLoop0
7.1.3.1/32          Direct 0    0            127.0.0.1       InLoop0
10.1.1.2/32         O_ASE1501            4.4.4.1         S0/6/1
10.1.1.4/32         Direct 0    0            127.0.0.1       InLoop0
127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0
127.0.0.1/32      Direct 0    0            127.0.0.1       InLoop0

dis ospf lsdb

         OSPF Process 1 with Router ID 10.1.1.4
               Link State Database

                         Area: 0.0.0.1
Type      LinkState ID    AdvRouter          AgeLen   Sequence   Metric
Router    10.1.1.4      10.1.1.4         39184    80000005       0
Router    10.1.1.3      10.1.1.3         39348    80000003       0
Sum-Net   3.3.3.0         10.1.1.3         40128    80000002    1562
Sum-Asbr10.1.1.2      10.1.1.3         40128    80000002    1562

               AS External Database
Type      LinkState ID    AdvRouter          AgeLen   Sequence   Metric
External6.1.0.0         10.1.1.2            7436    80000001       2
External3.3.3.0         10.1.1.2         42936    80000002       1
External3.3.3.2         10.1.1.2         42936    80000002       1
External10.1.1.2      10.1.1.2         42936    80000002       1


external 6.1.0.0/24的五类LSA由三条变为一条,说明聚合成功



<R1>dis ip ro
Routing Tables: Public
      Destinations : 12       Routes : 12

Destination/Mask    ProtoPreCost         NextHop         Interface

3.3.3.0/30          Direct 0    0            3.3.3.1         S0/6/0
3.3.3.1/32          Direct 0    0            127.0.0.1       InLoop0
3.3.3.2/32          Direct 0    0            3.3.3.2         S0/6/0
4.4.4.0/30          OSPF   10   3124         3.3.3.2         S0/6/0
6.1.0.0/16          OSPF   2550            0.0.0.0         NULL0
6.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0
6.1.2.1/32          Direct 0    0            127.0.0.1       InLoop0
6.1.3.1/32          Direct 0    0            127.0.0.1       InLoop0
7.1.0.0/16          OSPF   10   3124         3.3.3.2         S0/6/0   //可见7.1.0.0/16网段已经聚合成功
10.1.1.2/32         Direct 0    0            127.0.0.1       InLoop0
127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0
127.0.0.1/32      Direct 0    0            127.0.0.1       InLoop0


dis ospf lsdb

         OSPF Process 1 with Router ID 10.1.1.2
               Link State Database

                         Area: 0.0.0.0
Type      LinkState ID    AdvRouter          AgeLen   Sequence   Metric
Router    10.1.1.3      10.1.1.3         35748    80000004       0
Router    10.1.1.2      10.1.1.2         36348    80000003       0
Sum-Net   4.4.4.0         10.1.1.3         34028    80000002    1562
Sum-Net   7.1.0.0         10.1.1.3            2928    80000001    1562

               AS External Database
Type      LinkState ID    AdvRouter          AgeLen   Sequence   Metric
External6.1.0.0         10.1.1.2            1136    80000001       2
External3.3.3.0         10.1.1.2         36736    80000002       1
External3.3.3.2         10.1.1.2         36736    80000002       1
External10.1.1.2      10.1.1.2         36736    80000002       1

sum-net LSA 7.1.0.0/16由三条变为两条,聚合成功

附加说明:

利用abr-summary 过滤区域内的路由,对区域类型没有要求。

利用asbr-summary过滤区域内的外部路由,需要在区域内部的ASBR上配置,当ASBR很多时,配置比较复杂。


利用asbr-summary过滤区域内的外部路由,只需要在ABR上配置,但是要求区域必需为NSSA 。





二、用实验证明加了not-advertise后不通告匹配指定IP地址/掩码的路由。

在R1上加入如命令后:
ospf 1 router-id 10.1.1.2 not-advertise
asbr-summary 6.1.0.0 255.255.0.0
import-route direct



在R2的区域1配置聚合的命令后
area 0.0.0.1   
abr-summary 7.1.0.0 255.255.0.0not-advertise


1、我们来看R4的路由表
<R4>dis ip ro
Routing Tables: Public
      Destinations : 14       Routes : 14

Destination/Mask    ProtoPreCost         NextHop         Interface

2.2.2.0/30          OSPF   10   4686         4.4.4.1         S0/6/1
2.2.2.2/32          O_ASE1501            4.4.4.1         S0/6/1
3.3.3.0/30          OSPF   10   3124         4.4.4.1         S0/6/1
3.3.3.2/32          O_ASE1501            4.4.4.1         S0/6/1
4.4.4.0/30          Direct 0    0            4.4.4.2         S0/6/1
4.4.4.1/32          Direct 0    0            4.4.4.1         S0/6/1
4.4.4.2/32          Direct 0    0            127.0.0.1       InLoop0
7.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0
7.1.2.1/32          Direct 0    0            127.0.0.1       InLoop0
7.1.3.1/32          Direct 0    0            127.0.0.1       InLoop0
10.1.1.2/32         O_ASE1501            4.4.4.1         S0/6/1
10.1.1.4/32         Direct 0    0            127.0.0.1       InLoop0
127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0
127.0.0.1/32      Direct 0    0            127.0.0.1       InLoop0

没有6.1.0.0/16网段的路由,说明ASBR没有把这个网段通告出来

2、我们来看R1的路由表

dis ip ro
Routing Tables: Public
      Destinations : 13       Routes : 13

Destination/Mask    ProtoPreCost         NextHop         Interface

2.2.2.0/30          Direct 0    0            2.2.2.1         S0/6/3
2.2.2.1/32          Direct 0    0            127.0.0.1       InLoop0
2.2.2.2/32          Direct 0    0            2.2.2.2         S0/6/3
3.3.3.0/30          Direct 0    0            3.3.3.1         S0/6/0
3.3.3.1/32          Direct 0    0            127.0.0.1       InLoop0
3.3.3.2/32          Direct 0    0            3.3.3.2         S0/6/0
4.4.4.0/30          OSPF   10   3124         3.3.3.2         S0/6/0
6.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0
6.1.2.1/32          Direct 0    0            127.0.0.1       InLoop0
6.1.3.1/32          Direct 0    0            127.0.0.1       InLoop0
10.1.1.2/32         Direct 0    0            127.0.0.1       InLoop0
127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0
127.0.0.1/32      Direct 0    0            127.0.0.1       InLoop0

没有7.1.0.0/16网段的路由,说明ASB没有把这个网段通告出来

这里要注间了,是ABR没有通网段通告出来,那ABR上应当有7.1.0.0/16的路由,也就是说R4是把路由传给R2的


请看R2的路由表

dis ip ro
Routing Tables: Public
      Destinations : 15       Routes : 15

Destination/Mask    ProtoPreCost         NextHop         Interface

2.2.2.0/30          OSPF   10   3124         3.3.3.1         S0/6/0
2.2.2.2/32          O_ASE1501            3.3.3.1         S0/6/0
3.3.3.0/30          Direct 0    0            3.3.3.2         S0/6/0
3.3.3.1/32          Direct 0    0            3.3.3.1         S0/6/0
3.3.3.2/32          Direct 0    0            127.0.0.1       InLoop0
4.4.4.0/30          Direct 0    0            4.4.4.1         S0/6/1
4.4.4.1/32          Direct 0    0            127.0.0.1       InLoop0
4.4.4.2/32          Direct 0    0            4.4.4.2         S0/6/1
7.1.1.1/32          OSPF   10   1562         4.4.4.2         S0/6/1
7.1.2.1/32          OSPF   10   1562         4.4.4.2         S0/6/1
7.1.3.1/32          OSPF   10   1562         4.4.4.2         S0/6/1
10.1.1.2/32         O_ASE1501            3.3.3.1         S0/6/0
10.1.1.3/32         Direct 0    0            127.0.0.1       InLoop0
127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0
127.0.0.1/32      Direct 0    0            127.0.0.1       InLoop0

好了,实验到此结束,欢迎大家在线交流,共同学习

配置如下





R1

dis cu
#
version 5.20, Alpha 1011
#
sysname R1
#
password-control login-attempt 3 exceed lock-time 120
#
undo voice vlan mac-address 00e0-bb00-0000
#
ipsec cpu-backup enable
#
undo cryptoengine enable
#
domain default enable system
#
vlan 1
#
domain system
access-limit disable
state active
idle-cut disable
self-service-url disable
#
interface Serial0/6/0
link-protocol ppp
ip address 3.3.3.1 255.255.255.252
#
interface Serial0/6/1
link-protocol ppp
#
interface Serial0/6/2
link-protocol ppp
#
interface Serial0/6/3
link-protocol ppp
#
interface NULL0
#
interface LoopBack0
ip address 10.1.1.2 255.255.255.255
#
interface LoopBack1
ip address 6.1.1.1 255.255.255.255
#
interface LoopBack2
ip address 6.1.2.1 255.255.255.255
#               
interface LoopBack3
ip address 6.1.3.1 255.255.255.255
#
interface Ethernet0/4/0
port link-mode bridge
#
interface Ethernet0/4/1
port link-mode bridge
#
interface Ethernet0/4/2
port link-mode bridge
#
interface Ethernet0/4/3
port link-mode bridge
#
interface Ethernet0/4/4
port link-mode bridge
#
interface Ethernet0/4/5
port link-mode bridge
#
interface Ethernet0/4/6
port link-mode bridge
#
interface Ethernet0/4/7
port link-mode bridge
#
ospf 1 router-id 10.1.1.2
asbr-summary 6.1.0.0 255.255.0.0 not-advertise
import-route direct
area 0.0.0.0
network 3.3.3.0 0.0.0.3
#
load xml-configuration
#
user-interface con 0
user-interface vty 0 4
#
return




R2

<R2>dis cu
#
version 5.20, Alpha 1011
#
sysname R2
#
password-control login-attempt 3 exceed lock-time 120
#
undo voice vlan mac-address 00e0-bb00-0000
#
ipsec cpu-backup enable
#
undo cryptoengine enable
#
domain default enable system
#
vlan 1
#
domain system
access-limit disable
state active
idle-cut disable
self-service-url disable
#
interface Serial0/6/0
link-protocol ppp
ip address 3.3.3.2 255.255.255.252
#
interface Serial0/6/1
link-protocol ppp
ip address 4.4.4.1 255.255.255.252
#
interface Serial0/6/2
link-protocol ppp
#
interface Serial0/6/3
link-protocol ppp
#
interface NULL0
#
interface LoopBack0
ip address 10.1.1.3 255.255.255.255
#
interface Ethernet0/4/0
port link-mode bridge
#
interface Ethernet0/4/1
port link-mode bridge
#
interface Ethernet0/4/2
port link-mode bridge
#
interface Ethernet0/4/3
port link-mode bridge
#
interface Ethernet0/4/4
port link-mode bridge
#
interface Ethernet0/4/5
port link-mode bridge
#
interface Ethernet0/4/6
port link-mode bridge
#
interface Ethernet0/4/7
port link-mode bridge
#
ospf 1 router-id 10.1.1.3
area 0.0.0.0
network 3.3.3.0 0.0.0.3
area 0.0.0.1   
abr-summary 7.1.0.0 255.255.0.0not-advertise
network 4.4.4.0 0.0.0.3
#
load xml-configuration
#
user-interface con 0
user-interface vty 0 4
#
return




R4

dis cu
#
version 5.20, Alpha 1011
#
sysname R4
#
password-control login-attempt 3 exceed lock-time 120
#
undo voice vlan mac-address 00e0-bb00-0000
#
ipsec cpu-backup enable
#
undo cryptoengine enable
#
domain default enable system
#
vlan 1
#
domain system
access-limit disable
state active
idle-cut disable
self-service-url disable
#
interface Serial0/6/0
link-protocol ppp
#
interface Serial0/6/1
link-protocol ppp
ip address 4.4.4.2 255.255.255.252
#
interface Serial0/6/2
link-protocol ppp
#
interface Serial0/6/3
link-protocol ppp
#
interface NULL0
#
interface LoopBack0
ip address 10.1.1.4 255.255.255.255
#
interface LoopBack1
ip address 7.1.1.1 255.255.255.255
#
interface LoopBack2
ip address 7.1.2.1 255.255.255.255
#               
interface LoopBack3
ip address 7.1.3.1 255.255.255.255
#
interface Ethernet0/4/0
port link-mode bridge
#
interface Ethernet0/4/1
port link-mode bridge
#
interface Ethernet0/4/2
port link-mode bridge
#
interface Ethernet0/4/3
port link-mode bridge
#
interface Ethernet0/4/4
port link-mode bridge
#
interface Ethernet0/4/5
port link-mode bridge
#
interface Ethernet0/4/6
port link-mode bridge
#
interface Ethernet0/4/7
port link-mode bridge
#
ospf 1 router-id 10.1.1.4
area 0.0.0.1
network 4.4.4.0 0.0.0.3
network 7.1.1.1 0.0.0.0
network 7.1.2.1 0.0.0.0
network 7.1.3.1 0.0.0.0
#
load xml-configuration
#
user-interface con 0
user-interface vty 0 4
#
return

阿里狼 发表于 2013-3-18 20:17:06

谢谢楼主,共同发展

十二12 发表于 2013-5-17 07:06:02

女,喜甜食,甚胖!该女有一癖好:痛恨蚂蚁,见必杀之。问其故曰:这小东西,那么爱吃甜食,腰还那么细!

ukula 发表于 2013-5-19 17:28:13

老天,你让夏天和冬天同房了吧?生出这鬼天气!

色魔王子7 发表于 2013-5-22 17:08:01

沙发!沙发!

q968 发表于 2013-5-26 22:42:04

一时的冲动,子孙的危机!

pond2539 发表于 2013-5-31 14:32:32

我喜欢孩子,更喜欢造孩子的过程!
页: [1]
查看完整版本: OSPF路由聚合实验(详细)