3 配置步骤三、也就是配置R5和R5为stub区域后的测试:
R5的路由表和ospf lsdb类型如下:
[R5]dis ip ro
Routing Tables: Public
Destinations : 10 Routes : 10
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/0 OSPF 10 1563 2.2.2.1 S0/6/3
2.2.2.0/30 Direct 0 0 2.2.2.2 S0/6/3
2.2.2.1/32 Direct 0 0 2.2.2.1 S0/6/3
2.2.2.2/32 Direct 0 0 127.0.0.1 InLoop0
3.3.3.0/30 OSPF 10 3124 2.2.2.1 S0/6/3
4.4.4.0/30 OSPF 10 4686 2.2.2.1 S0/6/3
6.6.6.1/32 Direct 0 0 127.0.0.1 InLoop0
10.1.1.1/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
[R5]dis ospf ro
OSPF Process 1 with Router ID 10.1.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
0.0.0.0/0 1563 Inter 2.2.2.1 10.1.1.2 0.0.0.1
4.4.4.0/30 4686 Inter 2.2.2.1 10.1.1.2 0.0.0.1
3.3.3.0/30 3124 Inter 2.2.2.1 10.1.1.2 0.0.0.1
2.2.2.0/30 1562 Stub 2.2.2.2 10.1.1.1 0.0.0.1
Total Nets: 4
Intra Area: 1 Inter Area: 3 ASE: 0 NSSA: 0
[R5] dis ospf lsdb
OSPF Process 1 with Router ID 10.1.1.1
Link State Database
Area: 0.0.0.1
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 10.1.1.2 10.1.1.2 33 48 80000002 0
Router 10.1.1.1 10.1.1.1 37 48 80000002 0
Sum-Net 0.0.0.0 10.1.1.2 38 28 80000001 1
Sum-Net 3.3.3.0 10.1.1.2 33 28 80000001 1562
Sum-Net 4.4.4.0 10.1.1.2 33 28 80000001 3124
R1的路由表和ospf lsdb类型如下:
[R1]dis ip ro
Routing Tables: Public
Destinations : 17 Routes : 17
Destination/Mask Proto Pre Cost 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
4.4.4.1/32 O_ASE 150 1 3.3.3.2 S0/6/0
4.4.4.2/32 O_ASE 150 1 3.3.3.2 S0/6/0
7.7.7.1/32 Direct 0 0 127.0.0.1 InLoop0
8.8.8.1/32 O_ASE 150 1 3.3.3.2 S0/6/0
9.9.9.1/32 O_ASE 150 1 3.3.3.2 S0/6/0
10.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
10.1.1.3/32 O_ASE 150 1 3.3.3.2 S0/6/0
10.1.1.4/32 O_ASE 150 1 3.3.3.2 S0/6/0
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 ospf ro
OSPF Process 1 with Router ID 10.1.1.2
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
4.4.4.0/30 3124 Inter 3.3.3.2 10.1.1.3 0.0.0.0
3.3.3.0/30 1562 Stub 3.3.3.1 10.1.1.2 0.0.0.0
2.2.2.0/30 1562 Stub 2.2.2.1 10.1.1.2 0.0.0.1
Routing for ASEs
Destination Cost Type Tag NextHop AdvRouter
9.9.9.1/32 1 Type2 1 3.3.3.2 10.1.1.4
8.8.8.1/32 1 Type2 1 3.3.3.2 10.1.1.3
4.4.4.1/32 1 Type2 1 3.3.3.2 10.1.1.4
4.4.4.2/32 1 Type2 1 3.3.3.2 10.1.1.3
3.3.3.1/32 1 Type2 1 3.3.3.2 10.1.1.3
10.1.1.3/32 1 Type2 1 3.3.3.2 10.1.1.3
10.1.1.4/32 1 Type2 1 3.3.3.2 10.1.1.4
Total Nets: 10
Intra Area: 2 Inter Area: 1 ASE: 7 NSSA: 0
[R1] 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 Age Len Sequence Metric
Router 10.1.1.3 10.1.1.3 929 48 8000000D 0
Router 10.1.1.2 10.1.1.2 1444 48 8000000E 0
Sum-Net 4.4.4.0 10.1.1.3 310 28 80000002 1562
Sum-Net 2.2.2.0 10.1.1.2 76 28 80000001 1562
Sum-Asbr 10.1.1.4 10.1.1.3 277 28 80000002 1562
Area: 0.0.0.1
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 10.1.1.2 10.1.1.2 76 48 80000002 0
Router 10.1.1.1 10.1.1.1 82 48 80000002 0
Sum-Net 0.0.0.0 10.1.1.2 81 28 80000001 1
Sum-Net 3.3.3.0 10.1.1.2 76 28 80000001 1562
Sum-Net 4.4.4.0 10.1.1.2 76 28 80000001 3124
AS External Database
Type LinkState ID AdvRouter Age Len Sequence Metric
External 7.7.7.1 10.1.1.2 1330 36 8000000B 1
External 3.3.3.0 10.1.1.2 1406 36 8000000B 1
External 3.3.3.2 10.1.1.2 1406 36 8000000B 1
External 2.2.2.0 10.1.1.2 1406 36 8000000B 1
External 2.2.2.2 10.1.1.2 1406 36 8000000B 1
External 10.1.1.2 10.1.1.2 1416 36 8000000B 1
External 6.6.6.1 10.1.1.1 534 36 80000001 1
External 9.9.9.1 10.1.1.4 331 36 80000002 1
External 8.8.8.1 10.1.1.3 885 36 8000000B 1
External 4.4.4.1 10.1.1.4 331 36 80000002 1
External 4.4.4.0 10.1.1.3 894 36 8000000B 1
External 4.4.4.0 10.1.1.4 331 36 80000002 1
External 4.4.4.2 10.1.1.3 894 36 8000000B 1
External 3.3.3.1 10.1.1.3 892 36 8000000B 1
External 3.3.3.0 10.1.1.3 892 36 8000000B 1
External 2.2.2.1 10.1.1.1 534 36 80000001 1
External 2.2.2.0 10.1.1.1 534 36 80000001 1
External 10.1.1.4 10.1.1.4 327 36 80000002 1
External 10.1.1.1 10.1.1.1 534 36 80000001 1
External 10.1.1.3 10.1.1.3 880 36 8000000B 1
4 配置步骤四后的测试:
R4的路由表和ospf lsdb类型如下:
[R4]dis ip ro
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/0 OSPF 10 1563 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
9.9.9.1/32 Direct 0 0 127.0.0.1 InLoop0
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]dis ospf ro
OSPF Process 1 with Router ID 10.1.1.4
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
0.0.0.0/0 1563 Inter 4.4.4.1 10.1.1.3 0.0.0.2
4.4.4.0/30 1562 Stub 4.4.4.2 10.1.1.4 0.0.0.2
Total Nets: 2
Intra Area: 1 Inter Area: 1 ASE: 0 NSSA: 0
[R4]dis ospf lsdb
OSPF Process 1 with Router ID 10.1.1.4
Link State Database
Area: 0.0.0.2
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 10.1.1.4 10.1.1.4 51 48 80000002 0
Router 10.1.1.3 10.1.1.3 51 48 80000002 0
Sum-Net 0.0.0.0 10.1.1.3 76 28 80000001 1
上面的信息显示:在这个网络中,完全stub区域中只有一三类lsa,与R5相对比可知,其余的三类LSA被一条默认的LSA代替了,stub区域中也有默认的三类LSA,但明细也存在。
R2的路由表和ospf lsdb类型如下:
[R2]dis ip ro
Routing Tables: Public
Destinations : 14 Routes : 14
Destination/Mask Proto Pre Cost NextHop Interface
2.2.2.0/30 OSPF 10 3124 3.3.3.1 S0/6/0
2.2.2.2/32 O_ASE 150 1 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.7.7.1/32 O_ASE 150 1 3.3.3.1 S0/6/0
8.8.8.1/32 Direct 0 0 127.0.0.1 InLoop0
10.1.1.2/32 O_ASE 150 1 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
[R2] dis ospf ro
OSPF Process 1 with Router ID 10.1.1.3
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
4.4.4.0/30 1562 Stub 4.4.4.1 10.1.1.3 0.0.0.2
3.3.3.0/30 1562 Stub 3.3.3.2 10.1.1.3 0.0.0.0
2.2.2.0/30 3124 Inter 3.3.3.1 10.1.1.2 0.0.0.0
Routing for ASEs
Destination Cost Type Tag NextHop AdvRouter
7.7.7.1/32 1 Type2 1 3.3.3.1 10.1.1.2
3.3.3.2/32 1 Type2 1 3.3.3.1 10.1.1.2
10.1.1.2/32 1 Type2 1 3.3.3.1 10.1.1.2
2.2.2.2/32 1 Type2 1 3.3.3.1 10.1.1.2
Total Nets: 7
Intra Area: 2 Inter Area: 1 ASE: 4 NSSA: 0
[R2] dis ospf lsdb
OSPF Process 1 with Router ID 10.1.1.3
Link State Database
Area: 0.0.0.0
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 10.1.1.3 10.1.1.3 1072 48 8000000D 0
Router 10.1.1.2 10.1.1.2 1575 48 8000000E 0
Sum-Net 4.4.4.0 10.1.1.3 134 28 80000001 1562
Sum-Net 2.2.2.0 10.1.1.2 244 28 80000001 1562
Area: 0.0.0.2
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 10.1.1.4 10.1.1.4 116 48 80000002 0
Router 10.1.1.3 10.1.1.3 115 48 80000002 0
Sum-Net 0.0.0.0 10.1.1.3 139 28 80000001 1
AS External Database
Type LinkState ID AdvRouter Age Len Sequence Metric
External 8.8.8.1 10.1.1.3 1028 36 8000000B 1
External 4.4.4.0 10.1.1.3 1038 36 8000000B 1
External 4.4.4.2 10.1.1.3 1038 36 8000000B 1
External 3.3.3.1 10.1.1.3 1036 36 8000000B 1
External 3.3.3.0 10.1.1.3 1036 36 8000000B 1
External 10.1.1.3 10.1.1.3 1024 36 8000000B 1
External 7.7.7.1 10.1.1.2 1464 36 8000000B 1
External 6.6.6.1 10.1.1.1 690 36 80000001 1
External 9.9.9.1 10.1.1.4 491 36 80000002 1
External 4.4.4.1 10.1.1.4 491 36 80000002 1
External 4.4.4.0 10.1.1.4 491 36 80000002 1
External 3.3.3.0 10.1.1.2 1538 36 8000000B 1
External 3.3.3.2 10.1.1.2 1538 36 8000000B 1
External 2.2.2.1 10.1.1.1 690 36 80000001 1
External 2.2.2.0 10.1.1.2 1538 36 8000000B 1
External 2.2.2.0 10.1.1.1 690 36 80000001 1
External 2.2.2.2 10.1.1.2 1538 36 8000000B 1
External 10.1.1.4 10.1.1.4 487 36 80000002 1
External 10.1.1.1 10.1.1.1 690 36 80000001 1
External 10.1.1.2 10.1.1.2 1547 36 8000000B 1
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
我们再来看两个有趣的问题,这两个问题我也是在网上看到的,觉得比较有意思,就做了实验来验证:
1、为什么邻居full了,stub区域的路由器没有获得abr传递给他的默认路由?
如下,OSPF邻居建立起来了,为什么路由表没有默认路由呢
[R5-ospf-1]dis ip ro
Routing Tables: Public
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost NextHop Interface
2.2.2.0/30 Direct 0 0 2.2.2.2 S0/6/3
2.2.2.1/32 Direct 0 0 2.2.2.1 S0/6/3
2.2.2.2/32 Direct 0 0 127.0.0.1 InLoop0
6.6.6.6/32 Direct 0 0 127.0.0.1 InLoop0
10.1.1.1/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
[R5-ospf-1]dis ospf peer
OSPF Process 1 with Router ID 10.1.1.1
Neighbor Brief Information
Area: 0.0.0.1
Router ID Address Pri Dead-Time Interface State
10.1.1.2 2.2.2.1 1 33 S0/6/3 Full/ -
原因是我把R1上的area0接口给shutdown了,导至R1没有发布默认路由给R5
2,在一个stub区域,有2个abr,他们产生的缺省路由,不会让他们相互指向,形成路由环路吗?
这里就是LSA和路由的区别了。当一个stub区域中的ABR接收到同一个区域另外一个ABR发出的默认0.0.0.0的LSA,它只会将其存放在OSPF LSA的数据库中,而不会计算出路由来。这样就避免环路的产生。
如下R5连接的两个邻居都是area 0的,但是在lsdb中只有area 2有三类lsa area1中没有三类lsa ,默认路由表的下一跳指向的是area2的邻居,
[R5]dis ospf peer
OSPF Process 1 with Router ID 10.1.1.1
Neighbor Brief Information
Area: 0.0.0.1
Router ID Address Pri Dead-Time Interface State
10.1.1.2 2.2.2.1 1 32 S0/6/3 Full/ -
Area: 0.0.0.2
Router ID Address Pri Dead-Time Interface State
10.1.1.4 172.16.0.1 1 36 S0/6/2 Full/ -
[R5]dis ospf lsdb
OSPF Process 1 with Router ID 10.1.1.1
Link State Database
Area: 0.0.0.1
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 10.1.1.2 10.1.1.2 741 48 80000003 0
Router 10.1.1.1 10.1.1.1 698 48 80000003 0
Area: 0.0.0.2
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 10.1.1.4 10.1.1.4 462 48 80000002 0
Router 10.1.1.1 10.1.1.1 464 48 80000002 0
Sum-Net 0.0.0.0 10.1.1.4 467 28 80000001 1
Sum-Net 4.4.4.0 10.1.1.4 463 28 80000001 1562
[R5]
[R5]dis ip ro
Routing Tables: Public
Destinations : 12 Routes : 12
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/0 OSPF 10 1563 172.16.0.1 S0/6/2
2.2.2.0/30 Direct 0 0 2.2.2.2 S0/6/3
2.2.2.1/32 Direct 0 0 2.2.2.1 S0/6/3
2.2.2.2/32 Direct 0 0 127.0.0.1 InLoop0
4.4.4.0/30 OSPF 10 3124 172.16.0.1 S0/6/2
6.6.6.6/32 Direct 0 0 127.0.0.1 InLoop0
10.1.1.1/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
172.16.0.0/30 Direct 0 0 172.16.0.2 S0/6/2
172.16.0.1/32 Direct 0 0 172.16.0.1 S0/6/2
172.16.0.2/32 Direct 0 0 127.0.0.1 InLoop0
转载于:https://blog.51cto.com/hciewd/1122376