OSPF缺省路由发布

1. 当area1为普通区域时:
[RTA]ip route-static 0.0.0.0 0 12.12.12.2
[RTA-ospf-1]dis th
#
ospf 1 router-id 1.1.1.1 
 default-route-advertise
 area 0.0.0.1 
  network 12.12.12.0 0.0.0.255
或者
[RTA-ospf-1]default-route-advertise always //aways表示强制
DIS OSPF LSDB查看每台路由器的lsdb,发现每台路由器都产生了一条五类的缺省路由
例如:<RTD>dis ospf lsdb 
         OSPF Process 1 with Router ID 4.4.4.4
                 Link State Database 
                         Area: 0.0.0.2
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    3.3.3.3         3.3.3.3            873  48    80000002       0
 Router    4.4.4.4         4.4.4.4            872  48    80000002       0
 Sum-Net   23.23.23.0      3.3.3.3            901  28    80000001    1562
 Sum-Net   12.12.12.0      3.3.3.3            901  28    80000001    3124
 Sum-Asbr  1.1.1.1         3.3.3.3            821  28    80000001    3124
                 AS External Database
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 External  0.0.0.0         1.1.1.1            828  36    80000001       1
2. 当area1为stub区域时:
在RTA,RTBarea1里配置stub
[RTA-ospf-1]dis th
#
ospf 1 router-id 1.1.1.1 
 area 0.0.0.1 
  network 12.12.12.0 0.0.0.255 
  stub 
[RTB-ospf-1]dis th
#
ospf 1 router-id 2.2.2.2 
 import-route direct
 area 0.0.0.0 
  network 23.23.23.0 0.0.0.255 
 area 0.0.0.1 
  network 12.12.12.0 0.0.0.255 
  stub 
查看area1的lsdb
[RTA-ospf-1]dis ospf lsdb 
         OSPF Process 1 with Router ID 1.1.1.1
                 Link State Database 
                         Area: 0.0.0.1
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    1.1.1.1         1.1.1.1            230  48    80000003       0
 Router    2.2.2.2         2.2.2.2            305  48    80000002       0
 Sum-Net   0.0.0.0         2.2.2.2            311  28    80000001       1
 Sum-Net   34.34.34.0      2.2.2.2            306  28    80000001    3124
 Sum-Net   23.23.23.0      2.2.2.2            306  28    80000001    1562
发现只有stub区域里的路由器存在一条三类的缺省路由
[RTB-ospf-1-area-0.0.0.1]stub no-summary //将area1改成完全stub区域
可以通过查看ospf的链路状态数据库发现,现象与stub区域时一样,完全stub区域内存在一条3类的缺省路由
3. 当area1为nssa时:
[RTA]dis cu | in ip ro
 ip route-static 0.0.0.0 0.0.0.0 12.12.12.2
[RTA]dis cu conf ospf 
#
ospf 1 router-id 1.1.1.1
 area 0.0.0.1
  network 12.12.12.0 0.0.0.255
  nssa default-route-advertise
#
第一种情况,在asbr上配置,必须有一条默认路由,才能使nssa区域产生一条7类的缺省路由
[RTA]dis ospf lsdb 
         OSPF Process 1 with Router ID 1.1.1.1
                 Link State Database 
                         Area: 0.0.0.1
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    1.1.1.1         1.1.1.1            231  48    80000003       0
 Router    2.2.2.2         2.2.2.2            260  48    80000002       0
 Sum-Net   34.34.34.0      2.2.2.2            262  28    80000001    3124
 Sum-Net   23.23.23.0      2.2.2.2            262  28    80000001    1562
 NSSA      0.0.0.0         1.1.1.1            197  36    80000001       1
第二种情况在abr上配置:
[RTB-ospf-1-area-0.0.0.1]dis th
#
 area 0.0.0.1 
  network 12.12.12.0 0.0.0.255 
  nssa default-route-advertise
这种情况无需先做出缺省路由,并且自动产生一条7类的缺省路由
现在加工下nssa变成完全nssa区域:
[RTB-ospf-1]dis th
#
ospf 1 router-id 2.2.2.2 
 area 0.0.0.0 
  network 23.23.23.0 0.0.0.255 
 area 0.0.0.1 
  network 12.12.12.0 0.0.0.255 
  nssa no-summary
可以发现,完全nssa在asbr自动产生了三类的默认路由
[RTA]dis ip routing-table 
Routing Tables: Public
        Destinations : 7        Routes : 7
Destination/Mask    Proto  Pre  Cost         NextHop         Interface
0.0.0.0/0           OSPF   10   1563         12.12.12.2      S0/2/0
1.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0
12.12.12.0/24       Direct 0    0            12.12.12.1      S0/2/0
12.12.12.1/32       Direct 0    0            127.0.0.1       InLoop0
12.12.12.2/32       Direct 0    0            12.12.12.2      S0/2/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
[RTA]dis ospf lsdb 
         OSPF Process 1 with Router ID 1.1.1.1
                 Link State Database 
                         Area: 0.0.0.1
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    1.1.1.1         1.1.1.1             99  48    80000006       0
 Router    2.2.2.2         2.2.2.2            104  48    80000004       0
 Sum-Net   0.0.0.0         2.2.2.2            108  28    80000001       1
小结:1.普通区域产生的默认路由都是5类的lsa,在asbr上操作,可以分为强制和手写两种
      2.特殊区域自动产生的都是默认路由都是三类lsa
      3.特殊区域只有nssa区域需要手动配置,产生7类的lsa的默认路由,分为两种情况
Asbr配置+默认路由或者abr配置
后记:默认路由在网络中用处很大,往往担当着重要角色,据统计,9成的路由设备都含有默认路由,ospf作为igp王者,缺省路由的配置我们理所当然应该掌握!

你可能感兴趣的:(总结,休闲,实验,ospf,缺省路由)